winemac: Consolidate mouse move handling into -[WineApplicationController handleMouse...
[wine.git] / dlls / mshtml / service.c
blob56744e6d44004a74a325f970d894d9e16cecc091
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 IOleUndoManager IOleUndoManager_iface;
40 LONG ref;
41 } UndoManager;
43 static inline UndoManager *impl_from_IOleUndoManager(IOleUndoManager *iface)
45 return CONTAINING_RECORD(iface, UndoManager, IOleUndoManager_iface);
48 static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv)
50 UndoManager *This = impl_from_IOleUndoManager(iface);
52 if(IsEqualGUID(riid, &IID_IUnknown)) {
53 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
54 *ppv = &This->IOleUndoManager_iface;
55 }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
56 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
57 *ppv = &This->IOleUndoManager_iface;
58 }else {
59 *ppv = NULL;
60 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
61 return E_NOINTERFACE;
64 IUnknown_AddRef((IUnknown*)*ppv);
65 return S_OK;
68 static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
70 UndoManager *This = impl_from_IOleUndoManager(iface);
71 LONG ref = InterlockedIncrement(&This->ref);
73 TRACE("(%p) ref=%d\n", This, ref);
75 return ref;
78 static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
80 UndoManager *This = impl_from_IOleUndoManager(iface);
81 LONG ref = InterlockedDecrement(&This->ref);
83 TRACE("(%p) ref=%d\n", This, ref);
85 if(!ref)
86 heap_free(This);
88 return ref;
91 static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
93 UndoManager *This = impl_from_IOleUndoManager(iface);
94 FIXME("(%p)->(%p)\n", This, pPUU);
95 return E_NOTIMPL;
98 static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
99 BOOL fCommit)
101 UndoManager *This = impl_from_IOleUndoManager(iface);
102 FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
103 return E_NOTIMPL;
106 static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
108 UndoManager *This = impl_from_IOleUndoManager(iface);
109 FIXME("(%p)->(%p)\n", This, pUU);
110 return E_NOTIMPL;
113 static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
115 UndoManager *This = impl_from_IOleUndoManager(iface);
116 FIXME("(%p)->(%p)\n", This, pdwState);
117 return E_NOTIMPL;
120 static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
122 UndoManager *This = impl_from_IOleUndoManager(iface);
123 FIXME("(%p)->(%p)\n", This, pUU);
124 return S_OK;
127 static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
129 UndoManager *This = impl_from_IOleUndoManager(iface);
130 FIXME("(%p)->(%p)\n", This, pUU);
131 return E_NOTIMPL;
134 static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
136 UndoManager *This = impl_from_IOleUndoManager(iface);
137 FIXME("(%p)->(%p)\n", This, pUU);
138 return E_NOTIMPL;
141 static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
142 IEnumOleUndoUnits **ppEnum)
144 UndoManager *This = impl_from_IOleUndoManager(iface);
145 FIXME("(%p)->(%p)\n", This, ppEnum);
146 return E_NOTIMPL;
149 static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
150 IEnumOleUndoUnits **ppEnum)
152 UndoManager *This = impl_from_IOleUndoManager(iface);
153 FIXME("(%p)->(%p)\n", This, ppEnum);
154 return E_NOTIMPL;
157 static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
159 UndoManager *This = impl_from_IOleUndoManager(iface);
160 FIXME("(%p)->(%p)\n", This, pBstr);
161 return E_NOTIMPL;
164 static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
166 UndoManager *This = impl_from_IOleUndoManager(iface);
167 FIXME("(%p)->(%p)\n", This, pBstr);
168 return E_NOTIMPL;
171 static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
173 UndoManager *This = impl_from_IOleUndoManager(iface);
174 FIXME("(%p)->(%x)\n", This, fEnable);
175 return E_NOTIMPL;
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->IOleUndoManager_iface.lpVtbl = &OleUndoManagerVtbl;
201 ret->ref = 1;
203 return &ret->IOleUndoManager_iface;
206 /**********************************************************
207 * IServiceProvider implementation
210 static inline HTMLDocument *impl_from_IServiceProvider(IServiceProvider *iface)
212 return CONTAINING_RECORD(iface, HTMLDocument, IServiceProvider_iface);
215 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
217 HTMLDocument *This = impl_from_IServiceProvider(iface);
218 return htmldoc_query_interface(This, riid, ppv);
221 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
223 HTMLDocument *This = impl_from_IServiceProvider(iface);
224 return htmldoc_addref(This);
227 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
229 HTMLDocument *This = impl_from_IServiceProvider(iface);
230 return htmldoc_release(This);
233 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
234 REFIID riid, void **ppv)
236 HTMLDocument *This = impl_from_IServiceProvider(iface);
238 if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
239 FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
240 return E_NOINTERFACE;
243 if(IsEqualGUID(&SID_SOleUndoManager, guidService)) {
244 TRACE("SID_SOleUndoManager\n");
246 if(!This->doc_obj->undomgr)
247 This->doc_obj->undomgr = create_undomgr();
249 return IOleUndoManager_QueryInterface(This->doc_obj->undomgr, riid, ppv);
252 if(IsEqualGUID(&SID_SContainerDispatch, guidService)) {
253 TRACE("SID_SContainerDispatch\n");
254 return IHTMLDocument2_QueryInterface(&This->IHTMLDocument2_iface, riid, ppv);
257 if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
258 TRACE("IID_IWindowForBindingUI\n");
259 return IWindowForBindingUI_QueryInterface(&This->doc_obj->IWindowForBindingUI_iface, riid, ppv);
262 TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
264 if(This->doc_obj->client) {
265 HRESULT hres;
267 hres = do_query_service((IUnknown*)This->doc_obj->client, guidService, riid, ppv);
268 if(SUCCEEDED(hres))
269 return hres;
272 FIXME("unknown service %s\n", debugstr_guid(guidService));
273 return E_NOINTERFACE;
276 static const IServiceProviderVtbl ServiceProviderVtbl = {
277 ServiceProvider_QueryInterface,
278 ServiceProvider_AddRef,
279 ServiceProvider_Release,
280 ServiceProvider_QueryService
283 void HTMLDocument_Service_Init(HTMLDocument *This)
285 This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;