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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 /**********************************************************
41 * IOleObject implementation
45 HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleObjectVtbl));
47 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject)
50 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
53 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
56 return IHTMLDocument2_AddRef(HTMLDOC(This));
59 static ULONG WINAPI OleObject_Release(IOleObject *iface)
62 return IHTMLDocument2_Release(HTMLDOC(This));
65 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
68 TRACE("(%p)->(%p)\n", This, pClientSite);
71 IOleClientSite_Release(This->client);
73 IOleClientSite_AddRef(pClientSite);
74 This->client = pClientSite;
79 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
82 TRACE("(%p)->(%p)\n", This, ppClientSite);
88 IOleClientSite_AddRef(This->client);
89 *ppClientSite = This->client;
94 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
97 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
101 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
104 FIXME("(%p)->(%08lx)\n", This, dwSaveOption);
108 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
111 FIXME("(%p %ld %p)->()\n", This, dwWhichMoniker, pmk);
115 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
118 FIXME("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
122 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
126 FIXME("(%p)->(%p %x %ld)\n", This, pDataObject, fCreation, dwReserved);
130 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
133 FIXME("(%p)->(%ld %p)\n", This, dwReserved, ppDataObject);
137 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
138 LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
141 IOleDocumentSite *pDocSite;
144 TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
146 if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE) {
147 FIXME("iVerb = %ld not supported\n", iVerb);
152 pActiveSite = This->client;
154 hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite);
155 if(SUCCEEDED(hres)) {
156 IOleContainer *pContainer;
157 hres = IOleClientSite_GetContainer(pActiveSite, &pContainer);
158 if(SUCCEEDED(hres)) {
159 IOleContainer_LockContainer(pContainer, TRUE);
160 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
161 hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
162 IOleContainer_Release(pContainer);
164 IOleDocumentSite_Release(pDocSite);
166 hres = IOleDocumentView_UIActivate(DOCVIEW(This), TRUE);
167 if(SUCCEEDED(hres)) {
169 RECT rect; /* We need to pass rect as not const pointer */
170 memcpy(&rect, lprcPosRect, sizeof(RECT));
171 IOleDocumentView_SetRect(DOCVIEW(This), &rect);
173 IOleDocumentView_Show(DOCVIEW(This), TRUE);
180 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
183 FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
187 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
190 FIXME("(%p)\n", This);
194 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
197 FIXME("(%p)\n", This);
201 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
204 TRACE("(%p)->(%p)\n", This, pClsid);
209 memcpy(pClsid, &CLSID_HTMLDocument, sizeof(GUID));
213 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
216 FIXME("(%p)->(%ld %p)\n", This, dwFormOfType, pszUserType);
220 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
223 FIXME("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel);
227 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
230 FIXME("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel);
234 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
237 FIXME("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
241 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
244 FIXME("(%p)->(%ld)\n", This, dwConnection);
248 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
251 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
255 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
258 FIXME("(%p)->(%ld %p)\n", This, dwAspect, pdwStatus);
262 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
265 FIXME("(%p)->(%p)\n", This, pLogpal);
269 static IOleObjectVtbl OleObjectVtbl = {
270 OleObject_QueryInterface,
273 OleObject_SetClientSite,
274 OleObject_GetClientSite,
275 OleObject_SetHostNames,
277 OleObject_SetMoniker,
278 OleObject_GetMoniker,
279 OleObject_InitFromData,
280 OleObject_GetClipboardData,
284 OleObject_IsUpToDate,
285 OleObject_GetUserClassID,
286 OleObject_GetUserType,
291 OleObject_EnumAdvise,
292 OleObject_GetMiscStatus,
293 OleObject_SetColorScheme
296 /**********************************************************
297 * IOleDocument implementation
300 #define OLEDOC_THIS \
301 HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentVtbl));
303 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppvObject)
306 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
309 static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
312 return IHTMLDocument2_AddRef(HTMLDOC(This));
315 static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
318 return IHTMLDocument2_Release(HTMLDOC(This));
321 static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
322 DWORD dwReserved, IOleDocumentView **ppView)
327 TRACE("(%p)->(%p %p %ld %p)\n", This, pIPSite, pstm, dwReserved, ppView);
333 * Windows implementation creates new IOleDocumentView when function is called for the
334 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
335 * if the application uses returned interfaces, passed to ActivateMe or returned by
336 * QueryInterface, so there is no reason to create new interface. This needs more testing.
340 hres = IOleDocumentView_SetInPlaceSite(DOCVIEW(This), pIPSite);
346 FIXME("pstm is not supported\n");
348 IOleDocumentView_AddRef(DOCVIEW(This));
349 *ppView = DOCVIEW(This);
353 static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
356 FIXME("(%p)->(%p)\n", This, pdwStatus);
360 static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
361 IOleDocumentView **ppView)
364 FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
368 static IOleDocumentVtbl OleDocumentVtbl = {
369 OleDocument_QueryInterface,
372 OleDocument_CreateView,
373 OleDocument_GetDocMiscStatus,
374 OleDocument_EnumViews
377 /**********************************************************
378 * IOleInPlaceActiveObject implementation
381 #define ACTOBJ_THIS \
382 HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleInPlaceActiveObjectVtbl));
384 static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
387 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
390 static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
393 return IHTMLDocument2_AddRef(HTMLDOC(This));
396 static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
399 return IHTMLDocument2_Release(HTMLDOC(This));
402 static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
405 TRACE("(%p)->(%p)\n", This, phwnd);
414 static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
417 FIXME("(%p)->(%x)\n", This, fEnterMode);
421 static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
424 FIXME("(%p)->(%p)\n", This, lpmsg);
428 static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
431 FIXME("(%p)->(%x)\n", This, fActivate);
435 static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
438 FIXME("(%p)->(%x)\n", This, fActivate);
442 static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
443 IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
446 FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
450 static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
453 FIXME("(%p)->(%x)\n", This, fEnable);
457 static IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
458 OleInPlaceActiveObject_QueryInterface,
459 OleInPlaceActiveObject_AddRef,
460 OleInPlaceActiveObject_Release,
461 OleInPlaceActiveObject_GetWindow,
462 OleInPlaceActiveObject_ContextSensitiveHelp,
463 OleInPlaceActiveObject_TranslateAccelerator,
464 OleInPlaceActiveObject_OnFrameWindowActivate,
465 OleInPlaceActiveObject_OnDocWindowActivate,
466 OleInPlaceActiveObject_ResizeBorder,
467 OleInPlaceActiveObject_EnableModeless
470 void HTMLDocument_OleObj_Init(HTMLDocument *This)
472 This->lpOleObjectVtbl = &OleObjectVtbl;
473 This->lpOleDocumentVtbl = &OleDocumentVtbl;
474 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;