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
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 /**********************************************************
41 * IOleObject implementation
44 #define OLEOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleObject, iface)
46 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject)
48 HTMLDocument *This = OLEOBJ_THIS(iface);
49 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
52 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
54 HTMLDocument *This = OLEOBJ_THIS(iface);
55 return IHTMLDocument2_AddRef(HTMLDOC(This));
58 static ULONG WINAPI OleObject_Release(IOleObject *iface)
60 HTMLDocument *This = OLEOBJ_THIS(iface);
61 return IHTMLDocument2_Release(HTMLDOC(This));
64 static void update_hostinfo(HTMLDocumentObj *This, DOCHOSTUIINFO *hostinfo)
66 nsIScrollable *scrollable;
69 if(!This->nscontainer)
72 nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser, &IID_nsIScrollable, (void**)&scrollable);
73 if(NS_SUCCEEDED(nsres)) {
74 nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_Y,
75 (hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO) ? Scrollbar_Never : Scrollbar_Always);
77 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres);
79 nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_X,
80 hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO ? Scrollbar_Never : Scrollbar_Auto);
82 ERR("Could not set default X scrollbar prefs: %08x\n", nsres);
84 nsIScrollable_Release(scrollable);
86 ERR("Could not get nsIScrollable: %08x\n", nsres);
90 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
92 HTMLDocument *This = OLEOBJ_THIS(iface);
93 IDocHostUIHandler *pDocHostUIHandler = NULL;
94 IOleCommandTarget *cmdtrg = NULL;
98 TRACE("(%p)->(%p)\n", This, pClientSite);
100 if(pClientSite == This->doc_obj->client)
103 if(This->doc_obj->client) {
104 IOleClientSite_Release(This->doc_obj->client);
105 This->doc_obj->client = NULL;
106 This->doc_obj->usermode = UNKNOWN_USERMODE;
109 if(This->doc_obj->hostui) {
110 IDocHostUIHandler_Release(This->doc_obj->hostui);
111 This->doc_obj->hostui = NULL;
114 memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
119 hres = IOleObject_QueryInterface(pClientSite, &IID_IDocHostUIHandler, (void**)&pDocHostUIHandler);
120 if(SUCCEEDED(hres)) {
121 DOCHOSTUIINFO hostinfo;
122 LPOLESTR key_path = NULL, override_key_path = NULL;
123 IDocHostUIHandler2 *pDocHostUIHandler2;
125 memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
126 hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
127 hres = IDocHostUIHandler_GetHostInfo(pDocHostUIHandler, &hostinfo);
128 if(SUCCEEDED(hres)) {
129 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
130 hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
131 debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
132 update_hostinfo(This->doc_obj, &hostinfo);
133 This->doc_obj->hostinfo = hostinfo;
136 if(!This->doc_obj->has_key_path) {
137 hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
138 if(hres == S_OK && key_path) {
140 /* FIXME: use key_path */
141 TRACE("key_path = %s\n", debugstr_w(key_path));
143 CoTaskMemFree(key_path);
146 hres = IDocHostUIHandler_QueryInterface(pDocHostUIHandler, &IID_IDocHostUIHandler2,
147 (void**)&pDocHostUIHandler2);
148 if(SUCCEEDED(hres)) {
149 hres = IDocHostUIHandler2_GetOverrideKeyPath(pDocHostUIHandler2, &override_key_path, 0);
150 if(hres == S_OK && override_key_path && override_key_path[0]) {
151 if(override_key_path[0]) {
152 /*FIXME: use override_key_path */
153 TRACE("override_key_path = %s\n", debugstr_w(override_key_path));
155 CoTaskMemFree(override_key_path);
157 IDocHostUIHandler2_Release(pDocHostUIHandler2);
160 This->doc_obj->has_key_path = TRUE;
164 /* Native calls here GetWindow. What is it for?
165 * We don't have anything to do with it here (yet). */
167 IOleWindow *pOleWindow = NULL;
170 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleWindow, (void**)&pOleWindow);
171 if(SUCCEEDED(hres)) {
172 IOleWindow_GetWindow(pOleWindow, &hwnd);
173 IOleWindow_Release(pOleWindow);
177 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleCommandTarget, (void**)&cmdtrg);
178 if(SUCCEEDED(hres)) {
180 OLECMD cmd = {OLECMDID_SETPROGRESSTEXT, 0};
182 IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &cmd, NULL);
186 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
187 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
188 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
189 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
191 IOleCommandTarget_Release(cmdtrg);
194 IOleClientSite_AddRef(pClientSite);
195 This->doc_obj->client = pClientSite;
196 This->doc_obj->hostui = pDocHostUIHandler;
198 if(This->doc_obj->usermode == UNKNOWN_USERMODE)
199 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERMODE);
201 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
203 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
204 if(SUCCEEDED(hres)) {
205 if(V_VT(&silent) != VT_BOOL)
206 WARN("V_VT(silent) = %d\n", V_VT(&silent));
207 else if(V_BOOL(&silent))
208 FIXME("silent == true\n");
211 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERAGENT);
212 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_PALETTE);
217 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
219 HTMLDocument *This = OLEOBJ_THIS(iface);
221 TRACE("(%p)->(%p)\n", This, ppClientSite);
226 if(This->doc_obj->client)
227 IOleClientSite_AddRef(This->doc_obj->client);
228 *ppClientSite = This->doc_obj->client;
233 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
235 HTMLDocument *This = OLEOBJ_THIS(iface);
236 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
240 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
242 HTMLDocument *This = OLEOBJ_THIS(iface);
244 TRACE("(%p)->(%08x)\n", This, dwSaveOption);
246 if(dwSaveOption == OLECLOSE_PROMPTSAVE)
247 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
249 if(This->doc_obj->in_place_active)
250 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
252 HTMLDocument_LockContainer(This->doc_obj, FALSE);
254 if(This->advise_holder)
255 IOleAdviseHolder_SendOnClose(This->advise_holder);
260 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
262 HTMLDocument *This = OLEOBJ_THIS(iface);
263 FIXME("(%p %d %p)->()\n", This, dwWhichMoniker, pmk);
267 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
269 HTMLDocument *This = OLEOBJ_THIS(iface);
270 FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
274 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
277 HTMLDocument *This = OLEOBJ_THIS(iface);
278 FIXME("(%p)->(%p %x %d)\n", This, pDataObject, fCreation, dwReserved);
282 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
284 HTMLDocument *This = OLEOBJ_THIS(iface);
285 FIXME("(%p)->(%d %p)\n", This, dwReserved, ppDataObject);
289 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
290 LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
292 HTMLDocument *This = OLEOBJ_THIS(iface);
293 IOleDocumentSite *pDocSite;
296 TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
298 if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE && iVerb != OLEIVERB_INPLACEACTIVATE) {
299 FIXME("iVerb = %d not supported\n", iVerb);
304 pActiveSite = This->doc_obj->client;
306 hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite);
307 if(SUCCEEDED(hres)) {
308 HTMLDocument_LockContainer(This->doc_obj, TRUE);
310 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
311 hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
312 IOleDocumentSite_Release(pDocSite);
314 hres = IOleDocumentView_UIActivate(DOCVIEW(This), TRUE);
315 if(SUCCEEDED(hres)) {
317 RECT rect; /* We need to pass rect as not const pointer */
319 IOleDocumentView_SetRect(DOCVIEW(This), &rect);
321 IOleDocumentView_Show(DOCVIEW(This), TRUE);
328 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
330 HTMLDocument *This = OLEOBJ_THIS(iface);
331 FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
335 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
337 HTMLDocument *This = OLEOBJ_THIS(iface);
338 FIXME("(%p)\n", This);
342 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
344 HTMLDocument *This = OLEOBJ_THIS(iface);
345 FIXME("(%p)\n", This);
349 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
351 HTMLDocument *This = OLEOBJ_THIS(iface);
353 TRACE("(%p)->(%p)\n", This, pClsid);
358 *pClsid = CLSID_HTMLDocument;
362 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
364 HTMLDocument *This = OLEOBJ_THIS(iface);
365 FIXME("(%p)->(%d %p)\n", This, dwFormOfType, pszUserType);
369 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
371 HTMLDocument *This = OLEOBJ_THIS(iface);
372 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
376 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
378 HTMLDocument *This = OLEOBJ_THIS(iface);
379 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
383 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
385 HTMLDocument *This = OLEOBJ_THIS(iface);
386 TRACE("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
396 if(!This->advise_holder) {
397 CreateOleAdviseHolder(&This->advise_holder);
398 if(!This->advise_holder)
399 return E_OUTOFMEMORY;
402 return IOleAdviseHolder_Advise(This->advise_holder, pAdvSink, pdwConnection);
405 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
407 HTMLDocument *This = OLEOBJ_THIS(iface);
408 TRACE("(%p)->(%d)\n", This, dwConnection);
410 if(!This->advise_holder)
411 return OLE_E_NOCONNECTION;
413 return IOleAdviseHolder_Unadvise(This->advise_holder, dwConnection);
416 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
418 HTMLDocument *This = OLEOBJ_THIS(iface);
420 if(!This->advise_holder) {
421 *ppenumAdvise = NULL;
425 return IOleAdviseHolder_EnumAdvise(This->advise_holder, ppenumAdvise);
428 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
430 HTMLDocument *This = OLEOBJ_THIS(iface);
431 FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
435 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
437 HTMLDocument *This = OLEOBJ_THIS(iface);
438 FIXME("(%p)->(%p)\n", This, pLogpal);
444 static const IOleObjectVtbl OleObjectVtbl = {
445 OleObject_QueryInterface,
448 OleObject_SetClientSite,
449 OleObject_GetClientSite,
450 OleObject_SetHostNames,
452 OleObject_SetMoniker,
453 OleObject_GetMoniker,
454 OleObject_InitFromData,
455 OleObject_GetClipboardData,
459 OleObject_IsUpToDate,
460 OleObject_GetUserClassID,
461 OleObject_GetUserType,
466 OleObject_EnumAdvise,
467 OleObject_GetMiscStatus,
468 OleObject_SetColorScheme
471 /**********************************************************
472 * IOleDocument implementation
475 #define OLEDOC_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocument, iface)
477 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppvObject)
479 HTMLDocument *This = OLEDOC_THIS(iface);
480 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
483 static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
485 HTMLDocument *This = OLEDOC_THIS(iface);
486 return IHTMLDocument2_AddRef(HTMLDOC(This));
489 static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
491 HTMLDocument *This = OLEDOC_THIS(iface);
492 return IHTMLDocument2_Release(HTMLDOC(This));
495 static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
496 DWORD dwReserved, IOleDocumentView **ppView)
498 HTMLDocument *This = OLEDOC_THIS(iface);
501 TRACE("(%p)->(%p %p %d %p)\n", This, pIPSite, pstm, dwReserved, ppView);
507 * Windows implementation creates new IOleDocumentView when function is called for the
508 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
509 * if the application uses returned interfaces, passed to ActivateMe or returned by
510 * QueryInterface, so there is no reason to create new interface. This needs more testing.
514 hres = IOleDocumentView_SetInPlaceSite(DOCVIEW(This), pIPSite);
520 FIXME("pstm is not supported\n");
522 IOleDocumentView_AddRef(DOCVIEW(This));
523 *ppView = DOCVIEW(This);
527 static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
529 HTMLDocument *This = OLEDOC_THIS(iface);
530 FIXME("(%p)->(%p)\n", This, pdwStatus);
534 static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
535 IOleDocumentView **ppView)
537 HTMLDocument *This = OLEDOC_THIS(iface);
538 FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
544 static const IOleDocumentVtbl OleDocumentVtbl = {
545 OleDocument_QueryInterface,
548 OleDocument_CreateView,
549 OleDocument_GetDocMiscStatus,
550 OleDocument_EnumViews
553 /**********************************************************
554 * IOleControl implementation
557 #define CONTROL_THIS(iface) DEFINE_THIS(HTMLDocument, OleControl, iface)
559 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
561 HTMLDocument *This = CONTROL_THIS(iface);
562 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
565 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
567 HTMLDocument *This = CONTROL_THIS(iface);
568 return IHTMLDocument2_AddRef(HTMLDOC(This));
571 static ULONG WINAPI OleControl_Release(IOleControl *iface)
573 HTMLDocument *This = CONTROL_THIS(iface);
574 return IHTMLDocument_Release(HTMLDOC(This));
577 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI)
579 HTMLDocument *This = CONTROL_THIS(iface);
580 FIXME("(%p)->(%p)\n", This, pCI);
584 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *pMsg)
586 HTMLDocument *This = CONTROL_THIS(iface);
587 FIXME("(%p)->(%p)\n", This, pMsg);
591 HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
593 IDispatch *disp = NULL;
594 DISPPARAMS dispparams = {NULL, 0};
598 hres = IOleClientSite_QueryInterface(client, &IID_IDispatch, (void**)&disp);
600 TRACE("Could not get IDispatch\n");
606 hres = IDispatch_Invoke(disp, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
607 DISPATCH_PROPERTYGET, &dispparams, res, NULL, &err);
609 IDispatch_Release(disp);
614 static HRESULT on_change_dlcontrol(HTMLDocument *This)
619 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_DLCONTROL, &res);
621 FIXME("unsupported dlcontrol %08x\n", V_I4(&res));
626 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
628 HTMLDocument *This = CONTROL_THIS(iface);
629 IOleClientSite *client;
633 client = This->doc_obj->client;
635 TRACE("client = NULL\n");
640 case DISPID_AMBIENT_USERMODE:
641 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This);
642 hres = get_client_disp_property(client, DISPID_AMBIENT_USERMODE, &res);
646 if(V_VT(&res) == VT_BOOL) {
648 This->doc_obj->usermode = BROWSEMODE;
650 FIXME("edit mode is not supported\n");
651 This->doc_obj->usermode = EDITMODE;
654 FIXME("V_VT(res)=%d\n", V_VT(&res));
657 case DISPID_AMBIENT_DLCONTROL:
658 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This);
659 return on_change_dlcontrol(This);
660 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
661 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This);
662 on_change_dlcontrol(This);
663 hres = get_client_disp_property(client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &res);
667 if(V_VT(&res) == VT_BOOL) {
669 FIXME("offline connection is not supported\n");
673 FIXME("V_VT(res)=%d\n", V_VT(&res));
676 case DISPID_AMBIENT_SILENT:
677 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This);
678 on_change_dlcontrol(This);
679 hres = get_client_disp_property(client, DISPID_AMBIENT_SILENT, &res);
683 if(V_VT(&res) == VT_BOOL) {
685 FIXME("silent mode is not supported\n");
689 FIXME("V_VT(res)=%d\n", V_VT(&res));
692 case DISPID_AMBIENT_USERAGENT:
693 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This);
694 hres = get_client_disp_property(client, DISPID_AMBIENT_USERAGENT, &res);
698 FIXME("not supported AMBIENT_USERAGENT\n");
701 case DISPID_AMBIENT_PALETTE:
702 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This);
703 hres = get_client_disp_property(client, DISPID_AMBIENT_PALETTE, &res);
707 FIXME("not supported AMBIENT_PALETTE\n");
712 FIXME("(%p) unsupported dispID=%d\n", This, dispID);
716 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
718 HTMLDocument *This = CONTROL_THIS(iface);
719 FIXME("(%p)->(%x)\n", This, bFreeze);
725 static const IOleControlVtbl OleControlVtbl = {
726 OleControl_QueryInterface,
729 OleControl_GetControlInfo,
730 OleControl_OnMnemonic,
731 OleControl_OnAmbientPropertyChange,
732 OleControl_FreezeEvents
735 /**********************************************************
736 * IObjectWithSite implementation
739 #define OBJSITE_THIS(iface) DEFINE_THIS(HTMLDocument, ObjectWithSite, iface)
741 static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppvObject)
743 HTMLDocument *This = OBJSITE_THIS(iface);
744 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
747 static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
749 HTMLDocument *This = OBJSITE_THIS(iface);
750 return IHTMLDocument2_AddRef(HTMLDOC(This));
753 static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
755 HTMLDocument *This = OBJSITE_THIS(iface);
756 return IHTMLDocument2_Release(HTMLDOC(This));
759 static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
761 HTMLDocument *This = OBJSITE_THIS(iface);
762 FIXME("(%p)->(%p)\n", This, pUnkSite);
766 static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite* iface, REFIID riid, PVOID *ppvSite)
768 HTMLDocument *This = OBJSITE_THIS(iface);
769 FIXME("(%p)->(%p)\n", This, ppvSite);
775 static const IObjectWithSiteVtbl ObjectWithSiteVtbl = {
776 ObjectWithSite_QueryInterface,
777 ObjectWithSite_AddRef,
778 ObjectWithSite_Release,
779 ObjectWithSite_SetSite,
780 ObjectWithSite_GetSite
783 void HTMLDocument_LockContainer(HTMLDocumentObj *This, BOOL fLock)
785 IOleContainer *container;
788 if(!This->client || This->container_locked == fLock)
791 hres = IOleClientSite_GetContainer(This->client, &container);
792 if(SUCCEEDED(hres)) {
793 IOleContainer_LockContainer(container, fLock);
794 This->container_locked = fLock;
795 IOleContainer_Release(container);
799 void HTMLDocument_OleObj_Init(HTMLDocument *This)
801 This->lpOleObjectVtbl = &OleObjectVtbl;
802 This->lpOleDocumentVtbl = &OleDocumentVtbl;
803 This->lpOleControlVtbl = &OleControlVtbl;
804 This->lpObjectWithSiteVtbl = &ObjectWithSiteVtbl;