quartz: Fix flushing in dsound renderer.
[wine/multimedia.git] / dlls / mshtml / service.c
blobc77afe4b750869e690804f4057afde768677230e
1 /*
2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
37 typedef struct {
38 const IOleUndoManagerVtbl *lpOleUndoManagerVtbl;
40 LONG ref;
41 } UndoManager;
43 #define UNDOMGR(x) ((IOleUndoManager*) &(x)->lpOleUndoManagerVtbl)
45 #define UNDOMGR_THIS(iface) DEFINE_THIS(UndoManager, OleUndoManager, iface)
47 static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv)
49 UndoManager *This = UNDOMGR_THIS(iface);
51 *ppv = NULL;
53 if(IsEqualGUID(riid, &IID_IUnknown)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
55 *ppv = UNDOMGR(This);
56 }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
57 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
58 *ppv = UNDOMGR(This);
62 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
63 return E_NOINTERFACE;
66 static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
68 UndoManager *This = UNDOMGR_THIS(iface);
69 LONG ref = InterlockedIncrement(&This->ref);
71 TRACE("(%p) ref=%d\n", This, ref);
73 return ref;
76 static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
78 UndoManager *This = UNDOMGR_THIS(iface);
79 LONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%d\n", This, ref);
83 if(!ref)
84 heap_free(This);
86 return ref;
89 static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
91 UndoManager *This = UNDOMGR_THIS(iface);
92 FIXME("(%p)->(%p)\n", This, pPUU);
93 return E_NOTIMPL;
96 static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
97 BOOL fCommit)
99 UndoManager *This = UNDOMGR_THIS(iface);
100 FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
101 return E_NOTIMPL;
104 static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
106 UndoManager *This = UNDOMGR_THIS(iface);
107 FIXME("(%p)->(%p)\n", This, pUU);
108 return E_NOTIMPL;
111 static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
113 UndoManager *This = UNDOMGR_THIS(iface);
114 FIXME("(%p)->(%p)\n", This, pdwState);
115 return E_NOTIMPL;
118 static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
120 UndoManager *This = UNDOMGR_THIS(iface);
121 FIXME("(%p)->(%p)\n", This, pUU);
122 return S_OK;
125 static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
127 UndoManager *This = UNDOMGR_THIS(iface);
128 FIXME("(%p)->(%p)\n", This, pUU);
129 return E_NOTIMPL;
132 static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
134 UndoManager *This = UNDOMGR_THIS(iface);
135 FIXME("(%p)->(%p)\n", This, pUU);
136 return E_NOTIMPL;
139 static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
140 IEnumOleUndoUnits **ppEnum)
142 UndoManager *This = UNDOMGR_THIS(iface);
143 FIXME("(%p)->(%p)\n", This, ppEnum);
144 return E_NOTIMPL;
147 static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
148 IEnumOleUndoUnits **ppEnum)
150 UndoManager *This = UNDOMGR_THIS(iface);
151 FIXME("(%p)->(%p)\n", This, ppEnum);
152 return E_NOTIMPL;
155 static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
157 UndoManager *This = UNDOMGR_THIS(iface);
158 FIXME("(%p)->(%p)\n", This, pBstr);
159 return E_NOTIMPL;
162 static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
164 UndoManager *This = UNDOMGR_THIS(iface);
165 FIXME("(%p)->(%p)\n", This, pBstr);
166 return E_NOTIMPL;
169 static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
171 UndoManager *This = UNDOMGR_THIS(iface);
172 FIXME("(%p)->(%x)\n", This, fEnable);
173 return E_NOTIMPL;
176 #undef UNDOMGR_THIS
178 static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
179 OleUndoManager_QueryInterface,
180 OleUndoManager_AddRef,
181 OleUndoManager_Release,
182 OleUndoManager_Open,
183 OleUndoManager_Close,
184 OleUndoManager_Add,
185 OleUndoManager_GetOpenParentState,
186 OleUndoManager_DiscardFrom,
187 OleUndoManager_UndoTo,
188 OleUndoManager_RedoTo,
189 OleUndoManager_EnumUndoable,
190 OleUndoManager_EnumRedoable,
191 OleUndoManager_GetLastUndoDescription,
192 OleUndoManager_GetLastRedoDescription,
193 OleUndoManager_Enable
196 static IOleUndoManager *create_undomgr(void)
198 UndoManager *ret = heap_alloc(sizeof(UndoManager));
200 ret->lpOleUndoManagerVtbl = &OleUndoManagerVtbl;
201 ret->ref = 1;
203 return UNDOMGR(ret);
206 /**********************************************************
207 * IServiceProvider implementation
210 #define SERVPROV_THIS(iface) DEFINE_THIS(HTMLDocument, ServiceProvider, iface)
212 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
214 HTMLDocument *This = SERVPROV_THIS(iface);
215 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
218 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
220 HTMLDocument *This = SERVPROV_THIS(iface);
221 return IHTMLDocument2_AddRef(HTMLDOC(This));
224 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
226 HTMLDocument *This = SERVPROV_THIS(iface);
227 return IHTMLDocument_Release(HTMLDOC(This));
230 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
231 REFIID riid, void **ppv)
233 HTMLDocument *This = SERVPROV_THIS(iface);
235 if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
236 FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
237 return E_NOINTERFACE;
240 if(IsEqualGUID(&IID_IOleUndoManager, riid)) {
241 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
243 if(!This->doc_obj->undomgr)
244 This->doc_obj->undomgr = create_undomgr();
246 IOleUndoManager_AddRef(This->doc_obj->undomgr);
247 *ppv = This->doc_obj->undomgr;
248 return S_OK;
251 if(This->doc_obj->client) {
252 IServiceProvider *sp;
253 HRESULT hres;
255 hres = IOleClientSite_QueryInterface(This->doc_obj->client,
256 &IID_IServiceProvider, (void**)&sp);
257 if(SUCCEEDED(hres)) {
258 hres = IServiceProvider_QueryService(sp, guidService, riid, ppv);
259 IServiceProvider_Release(sp);
261 if(SUCCEEDED(hres))
262 return hres;
266 FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
268 return E_NOINTERFACE;
271 static const IServiceProviderVtbl ServiceProviderVtbl = {
272 ServiceProvider_QueryInterface,
273 ServiceProvider_AddRef,
274 ServiceProvider_Release,
275 ServiceProvider_QueryService
278 void HTMLDocument_Service_Init(HTMLDocument *This)
280 This->lpServiceProviderVtbl = &ServiceProviderVtbl;