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 const IOleUndoManagerVtbl *lpOleUndoManagerVtbl;
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);
53 if(IsEqualGUID(riid, &IID_IUnknown)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56 }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
57 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
62 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
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);
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);
89 static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
91 UndoManager *This = UNDOMGR_THIS(iface);
92 FIXME("(%p)->(%p)\n", This, pPUU);
96 static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
99 UndoManager *This = UNDOMGR_THIS(iface);
100 FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
104 static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
106 UndoManager *This = UNDOMGR_THIS(iface);
107 FIXME("(%p)->(%p)\n", This, pUU);
111 static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
113 UndoManager *This = UNDOMGR_THIS(iface);
114 FIXME("(%p)->(%p)\n", This, pdwState);
118 static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
120 UndoManager *This = UNDOMGR_THIS(iface);
121 FIXME("(%p)->(%p)\n", This, pUU);
125 static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
127 UndoManager *This = UNDOMGR_THIS(iface);
128 FIXME("(%p)->(%p)\n", This, pUU);
132 static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
134 UndoManager *This = UNDOMGR_THIS(iface);
135 FIXME("(%p)->(%p)\n", This, pUU);
139 static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
140 IEnumOleUndoUnits **ppEnum)
142 UndoManager *This = UNDOMGR_THIS(iface);
143 FIXME("(%p)->(%p)\n", This, ppEnum);
147 static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
148 IEnumOleUndoUnits **ppEnum)
150 UndoManager *This = UNDOMGR_THIS(iface);
151 FIXME("(%p)->(%p)\n", This, ppEnum);
155 static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
157 UndoManager *This = UNDOMGR_THIS(iface);
158 FIXME("(%p)->(%p)\n", This, pBstr);
162 static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
164 UndoManager *This = UNDOMGR_THIS(iface);
165 FIXME("(%p)->(%p)\n", This, pBstr);
169 static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
171 UndoManager *This = UNDOMGR_THIS(iface);
172 FIXME("(%p)->(%x)\n", This, fEnable);
178 static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
179 OleUndoManager_QueryInterface,
180 OleUndoManager_AddRef,
181 OleUndoManager_Release,
183 OleUndoManager_Close,
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 = mshtml_alloc(sizeof(UndoManager));
200 ret->lpOleUndoManagerVtbl = &OleUndoManagerVtbl;
206 /**********************************************************
207 * IServiceProvider impementation
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 /* See http://msdn.microsoft.com/workshop/browser/hosting/wbcustompart2.asp */
236 if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
237 FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
238 return E_NOINTERFACE;
241 if(IsEqualGUID(&IID_IOleUndoManager, riid)) {
242 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
245 This->undomgr = create_undomgr();
247 IOleUndoManager_AddRef(This->undomgr);
248 *ppv = This->undomgr;
252 FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
257 static const IServiceProviderVtbl ServiceProviderVtbl = {
258 ServiceProvider_QueryInterface,
259 ServiceProvider_AddRef,
260 ServiceProvider_Release,
261 ServiceProvider_QueryService
264 void HTMLDocument_Service_Init(HTMLDocument *This)
266 This->lpServiceProviderVtbl = &ServiceProviderVtbl;
268 This->undomgr = NULL;