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
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 IOleUndoManager IOleUndoManager_iface;
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);
54 if(IsEqualGUID(riid, &IID_IUnknown)) {
55 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56 *ppv = &This->IOleUndoManager_iface;
57 }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
58 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
59 *ppv = &This->IOleUndoManager_iface;
63 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
67 static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
69 UndoManager *This = impl_from_IOleUndoManager(iface);
70 LONG ref = InterlockedIncrement(&This->ref);
72 TRACE("(%p) ref=%d\n", This, ref);
77 static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
79 UndoManager *This = impl_from_IOleUndoManager(iface);
80 LONG ref = InterlockedDecrement(&This->ref);
82 TRACE("(%p) ref=%d\n", This, ref);
90 static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
92 UndoManager *This = impl_from_IOleUndoManager(iface);
93 FIXME("(%p)->(%p)\n", This, pPUU);
97 static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
100 UndoManager *This = impl_from_IOleUndoManager(iface);
101 FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
105 static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
107 UndoManager *This = impl_from_IOleUndoManager(iface);
108 FIXME("(%p)->(%p)\n", This, pUU);
112 static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
114 UndoManager *This = impl_from_IOleUndoManager(iface);
115 FIXME("(%p)->(%p)\n", This, pdwState);
119 static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
121 UndoManager *This = impl_from_IOleUndoManager(iface);
122 FIXME("(%p)->(%p)\n", This, pUU);
126 static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
128 UndoManager *This = impl_from_IOleUndoManager(iface);
129 FIXME("(%p)->(%p)\n", This, pUU);
133 static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
135 UndoManager *This = impl_from_IOleUndoManager(iface);
136 FIXME("(%p)->(%p)\n", This, pUU);
140 static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
141 IEnumOleUndoUnits **ppEnum)
143 UndoManager *This = impl_from_IOleUndoManager(iface);
144 FIXME("(%p)->(%p)\n", This, ppEnum);
148 static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
149 IEnumOleUndoUnits **ppEnum)
151 UndoManager *This = impl_from_IOleUndoManager(iface);
152 FIXME("(%p)->(%p)\n", This, ppEnum);
156 static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
158 UndoManager *This = impl_from_IOleUndoManager(iface);
159 FIXME("(%p)->(%p)\n", This, pBstr);
163 static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
165 UndoManager *This = impl_from_IOleUndoManager(iface);
166 FIXME("(%p)->(%p)\n", This, pBstr);
170 static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
172 UndoManager *This = impl_from_IOleUndoManager(iface);
173 FIXME("(%p)->(%x)\n", This, fEnable);
177 static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
178 OleUndoManager_QueryInterface,
179 OleUndoManager_AddRef,
180 OleUndoManager_Release,
182 OleUndoManager_Close,
184 OleUndoManager_GetOpenParentState,
185 OleUndoManager_DiscardFrom,
186 OleUndoManager_UndoTo,
187 OleUndoManager_RedoTo,
188 OleUndoManager_EnumUndoable,
189 OleUndoManager_EnumRedoable,
190 OleUndoManager_GetLastUndoDescription,
191 OleUndoManager_GetLastRedoDescription,
192 OleUndoManager_Enable
195 static IOleUndoManager *create_undomgr(void)
197 UndoManager *ret = heap_alloc(sizeof(UndoManager));
199 ret->IOleUndoManager_iface.lpVtbl = &OleUndoManagerVtbl;
202 return &ret->IOleUndoManager_iface;
205 /**********************************************************
206 * IServiceProvider implementation
209 #define SERVPROV_THIS(iface) DEFINE_THIS(HTMLDocument, ServiceProvider, iface)
211 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
213 HTMLDocument *This = SERVPROV_THIS(iface);
214 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
217 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
219 HTMLDocument *This = SERVPROV_THIS(iface);
220 return IHTMLDocument2_AddRef(HTMLDOC(This));
223 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
225 HTMLDocument *This = SERVPROV_THIS(iface);
226 return IHTMLDocument_Release(HTMLDOC(This));
229 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
230 REFIID riid, void **ppv)
232 HTMLDocument *This = SERVPROV_THIS(iface);
234 if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
235 FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
236 return E_NOINTERFACE;
239 if(IsEqualGUID(&SID_SOleUndoManager, guidService)) {
240 TRACE("SID_SOleUndoManager\n");
242 if(!This->doc_obj->undomgr)
243 This->doc_obj->undomgr = create_undomgr();
245 return IOleUndoManager_QueryInterface(This->doc_obj->undomgr, riid, ppv);
248 if(This->doc_obj->client) {
249 IServiceProvider *sp;
252 hres = IOleClientSite_QueryInterface(This->doc_obj->client,
253 &IID_IServiceProvider, (void**)&sp);
254 if(SUCCEEDED(hres)) {
255 hres = IServiceProvider_QueryService(sp, guidService, riid, ppv);
256 IServiceProvider_Release(sp);
263 FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
265 return E_NOINTERFACE;
268 static const IServiceProviderVtbl ServiceProviderVtbl = {
269 ServiceProvider_QueryInterface,
270 ServiceProvider_AddRef,
271 ServiceProvider_Release,
272 ServiceProvider_QueryService
275 void HTMLDocument_Service_Init(HTMLDocument *This)
277 This->lpServiceProviderVtbl = &ServiceProviderVtbl;