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 "shdeprecated.h"
35 #include "wine/debug.h"
37 #include "mshtml_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
41 #define DOCHOST_DOCCANNAVIGATE 0
43 /**********************************************************
44 * IOleObject implementation
47 static inline HTMLDocument *impl_from_IOleObject(IOleObject *iface)
49 return CONTAINING_RECORD(iface, HTMLDocument, IOleObject_iface);
52 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
54 HTMLDocument *This = impl_from_IOleObject(iface);
55 return htmldoc_query_interface(This, riid, ppv);
58 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
60 HTMLDocument *This = impl_from_IOleObject(iface);
61 return htmldoc_addref(This);
64 static ULONG WINAPI OleObject_Release(IOleObject *iface)
66 HTMLDocument *This = impl_from_IOleObject(iface);
67 return htmldoc_release(This);
70 static void update_hostinfo(HTMLDocumentObj *This, DOCHOSTUIINFO *hostinfo)
72 nsIScrollable *scrollable;
75 if(!This->nscontainer)
78 nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser, &IID_nsIScrollable, (void**)&scrollable);
79 if(NS_SUCCEEDED(nsres)) {
80 nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_Y,
81 (hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO) ? Scrollbar_Never : Scrollbar_Always);
83 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres);
85 nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_X,
86 hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO ? Scrollbar_Never : Scrollbar_Auto);
88 ERR("Could not set default X scrollbar prefs: %08x\n", nsres);
90 nsIScrollable_Release(scrollable);
92 ERR("Could not get nsIScrollable: %08x\n", nsres);
96 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
98 HTMLDocument *This = impl_from_IOleObject(iface);
99 IOleCommandTarget *cmdtrg = NULL;
100 IOleWindow *ole_window;
106 TRACE("(%p)->(%p)\n", This, pClientSite);
108 if(pClientSite == This->doc_obj->client)
111 if(This->doc_obj->client) {
112 IOleClientSite_Release(This->doc_obj->client);
113 This->doc_obj->client = NULL;
114 This->doc_obj->usermode = UNKNOWN_USERMODE;
117 if(This->doc_obj->hostui && !This->doc_obj->custom_hostui) {
118 IDocHostUIHandler_Release(This->doc_obj->hostui);
119 This->doc_obj->hostui = NULL;
122 if(This->doc_obj->doc_object_service) {
123 IDocObjectService_Release(This->doc_obj->doc_object_service);
124 This->doc_obj->doc_object_service = NULL;
127 memset(&This->doc_obj->hostinfo, 0, sizeof(DOCHOSTUIINFO));
128 This->doc_obj->is_webbrowser = FALSE;
133 IOleClientSite_AddRef(pClientSite);
134 This->doc_obj->client = pClientSite;
136 hostui_setup = This->doc_obj->hostui_setup;
138 if(!This->doc_obj->hostui) {
139 IDocHostUIHandler *uihandler;
141 This->doc_obj->custom_hostui = FALSE;
143 hres = IOleObject_QueryInterface(pClientSite, &IID_IDocHostUIHandler, (void**)&uihandler);
145 This->doc_obj->hostui = uihandler;
148 if(This->doc_obj->hostui) {
149 DOCHOSTUIINFO hostinfo;
150 LPOLESTR key_path = NULL, override_key_path = NULL;
151 IDocHostUIHandler2 *uihandler2;
153 memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
154 hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
155 hres = IDocHostUIHandler_GetHostInfo(This->doc_obj->hostui, &hostinfo);
156 if(SUCCEEDED(hres)) {
157 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
158 hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
159 debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
160 update_hostinfo(This->doc_obj, &hostinfo);
161 This->doc_obj->hostinfo = hostinfo;
165 hres = IDocHostUIHandler_GetOptionKeyPath(This->doc_obj->hostui, &key_path, 0);
166 if(hres == S_OK && key_path) {
168 /* FIXME: use key_path */
169 TRACE("key_path = %s\n", debugstr_w(key_path));
171 CoTaskMemFree(key_path);
174 hres = IDocHostUIHandler_QueryInterface(This->doc_obj->hostui, &IID_IDocHostUIHandler2,
175 (void**)&uihandler2);
176 if(SUCCEEDED(hres)) {
177 hres = IDocHostUIHandler2_GetOverrideKeyPath(uihandler2, &override_key_path, 0);
178 if(hres == S_OK && override_key_path && override_key_path[0]) {
179 if(override_key_path[0]) {
180 /*FIXME: use override_key_path */
181 TRACE("override_key_path = %s\n", debugstr_w(override_key_path));
183 CoTaskMemFree(override_key_path);
185 IDocHostUIHandler2_Release(uihandler2);
188 This->doc_obj->hostui_setup = TRUE;
192 /* Native calls here GetWindow. What is it for?
193 * We don't have anything to do with it here (yet). */
194 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleWindow, (void**)&ole_window);
195 if(SUCCEEDED(hres)) {
196 IOleWindow_GetWindow(ole_window, &hwnd);
197 IOleWindow_Release(ole_window);
200 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleCommandTarget, (void**)&cmdtrg);
201 if(SUCCEEDED(hres)) {
203 OLECMD cmd = {OLECMDID_SETPROGRESSTEXT, 0};
206 IDocObjectService *doc_object_service;
207 IBrowserService *browser_service;
210 V_VT(&var) = VT_UNKNOWN;
211 V_UNKNOWN(&var) = (IUnknown*)&This->window->IHTMLWindow2_iface;
212 IOleCommandTarget_Exec(cmdtrg, &CGID_DocHostCmdPriv, DOCHOST_DOCCANNAVIGATE, 0, &var, NULL);
214 hres = do_query_service((IUnknown*)pClientSite, &IID_IShellBrowser,
215 &IID_IBrowserService, (void**)&browser_service);
216 if(SUCCEEDED(hres)) {
217 hres = IBrowserService_QueryInterface(browser_service,
218 &IID_IDocObjectService, (void**)&doc_object_service);
219 if(SUCCEEDED(hres)) {
220 This->doc_obj->doc_object_service = doc_object_service;
223 * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
224 * embedder supports IWebBrowserApp.
226 hres = do_query_service((IUnknown*)pClientSite, &IID_IWebBrowserApp, &IID_IWebBrowser2, (void**)&wb);
227 if(SUCCEEDED(hres)) {
228 This->doc_obj->is_webbrowser = TRUE;
229 IWebBrowser2_Release(wb);
232 IBrowserService_Release(browser_service);
237 IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &cmd, NULL);
241 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
242 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
243 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
244 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
246 IOleCommandTarget_Release(cmdtrg);
249 if(This->doc_obj->usermode == UNKNOWN_USERMODE)
250 IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_USERMODE);
252 IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface,
253 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
255 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
256 if(SUCCEEDED(hres)) {
257 if(V_VT(&silent) != VT_BOOL)
258 WARN("V_VT(silent) = %d\n", V_VT(&silent));
259 else if(V_BOOL(&silent))
260 FIXME("silent == true\n");
263 IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_USERAGENT);
264 IOleControl_OnAmbientPropertyChange(&This->IOleControl_iface, DISPID_AMBIENT_PALETTE);
269 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
271 HTMLDocument *This = impl_from_IOleObject(iface);
273 TRACE("(%p)->(%p)\n", This, ppClientSite);
278 if(This->doc_obj->client)
279 IOleClientSite_AddRef(This->doc_obj->client);
280 *ppClientSite = This->doc_obj->client;
285 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
287 HTMLDocument *This = impl_from_IOleObject(iface);
288 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
292 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
294 HTMLDocument *This = impl_from_IOleObject(iface);
296 TRACE("(%p)->(%08x)\n", This, dwSaveOption);
298 if(dwSaveOption == OLECLOSE_PROMPTSAVE)
299 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
301 if(This->doc_obj->in_place_active)
302 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->IOleInPlaceObjectWindowless_iface);
304 HTMLDocument_LockContainer(This->doc_obj, FALSE);
306 if(This->advise_holder)
307 IOleAdviseHolder_SendOnClose(This->advise_holder);
312 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
314 HTMLDocument *This = impl_from_IOleObject(iface);
315 FIXME("(%p %d %p)->()\n", This, dwWhichMoniker, pmk);
319 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
321 HTMLDocument *This = impl_from_IOleObject(iface);
322 FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
326 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
329 HTMLDocument *This = impl_from_IOleObject(iface);
330 FIXME("(%p)->(%p %x %d)\n", This, pDataObject, fCreation, dwReserved);
334 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
336 HTMLDocument *This = impl_from_IOleObject(iface);
337 FIXME("(%p)->(%d %p)\n", This, dwReserved, ppDataObject);
341 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
342 LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
344 HTMLDocument *This = impl_from_IOleObject(iface);
345 IOleDocumentSite *pDocSite;
348 TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
350 if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE && iVerb != OLEIVERB_INPLACEACTIVATE) {
351 FIXME("iVerb = %d not supported\n", iVerb);
356 pActiveSite = This->doc_obj->client;
358 hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite);
359 if(SUCCEEDED(hres)) {
360 HTMLDocument_LockContainer(This->doc_obj, TRUE);
362 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
363 hres = IOleDocumentSite_ActivateMe(pDocSite, &This->IOleDocumentView_iface);
364 IOleDocumentSite_Release(pDocSite);
366 hres = IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, TRUE);
367 if(SUCCEEDED(hres)) {
369 RECT rect; /* We need to pass rect as not const pointer */
371 IOleDocumentView_SetRect(&This->IOleDocumentView_iface, &rect);
373 IOleDocumentView_Show(&This->IOleDocumentView_iface, TRUE);
380 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
382 HTMLDocument *This = impl_from_IOleObject(iface);
383 FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
387 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
389 HTMLDocument *This = impl_from_IOleObject(iface);
390 FIXME("(%p)\n", This);
394 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
396 HTMLDocument *This = impl_from_IOleObject(iface);
397 FIXME("(%p)\n", This);
401 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
403 HTMLDocument *This = impl_from_IOleObject(iface);
405 TRACE("(%p)->(%p)\n", This, pClsid);
410 *pClsid = CLSID_HTMLDocument;
414 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
416 HTMLDocument *This = impl_from_IOleObject(iface);
417 FIXME("(%p)->(%d %p)\n", This, dwFormOfType, pszUserType);
421 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
423 HTMLDocument *This = impl_from_IOleObject(iface);
424 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
428 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
430 HTMLDocument *This = impl_from_IOleObject(iface);
431 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
435 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
437 HTMLDocument *This = impl_from_IOleObject(iface);
438 TRACE("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
448 if(!This->advise_holder) {
449 CreateOleAdviseHolder(&This->advise_holder);
450 if(!This->advise_holder)
451 return E_OUTOFMEMORY;
454 return IOleAdviseHolder_Advise(This->advise_holder, pAdvSink, pdwConnection);
457 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
459 HTMLDocument *This = impl_from_IOleObject(iface);
460 TRACE("(%p)->(%d)\n", This, dwConnection);
462 if(!This->advise_holder)
463 return OLE_E_NOCONNECTION;
465 return IOleAdviseHolder_Unadvise(This->advise_holder, dwConnection);
468 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
470 HTMLDocument *This = impl_from_IOleObject(iface);
472 if(!This->advise_holder) {
473 *ppenumAdvise = NULL;
477 return IOleAdviseHolder_EnumAdvise(This->advise_holder, ppenumAdvise);
480 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
482 HTMLDocument *This = impl_from_IOleObject(iface);
483 FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
487 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
489 HTMLDocument *This = impl_from_IOleObject(iface);
490 FIXME("(%p)->(%p)\n", This, pLogpal);
494 static const IOleObjectVtbl OleObjectVtbl = {
495 OleObject_QueryInterface,
498 OleObject_SetClientSite,
499 OleObject_GetClientSite,
500 OleObject_SetHostNames,
502 OleObject_SetMoniker,
503 OleObject_GetMoniker,
504 OleObject_InitFromData,
505 OleObject_GetClipboardData,
509 OleObject_IsUpToDate,
510 OleObject_GetUserClassID,
511 OleObject_GetUserType,
516 OleObject_EnumAdvise,
517 OleObject_GetMiscStatus,
518 OleObject_SetColorScheme
521 /**********************************************************
522 * IOleDocument implementation
525 static inline HTMLDocument *impl_from_IOleDocument(IOleDocument *iface)
527 return CONTAINING_RECORD(iface, HTMLDocument, IOleDocument_iface);
530 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppv)
532 HTMLDocument *This = impl_from_IOleDocument(iface);
533 return htmldoc_query_interface(This, riid, ppv);
536 static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
538 HTMLDocument *This = impl_from_IOleDocument(iface);
539 return htmldoc_addref(This);
542 static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
544 HTMLDocument *This = impl_from_IOleDocument(iface);
545 return htmldoc_release(This);
548 static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
549 DWORD dwReserved, IOleDocumentView **ppView)
551 HTMLDocument *This = impl_from_IOleDocument(iface);
554 TRACE("(%p)->(%p %p %d %p)\n", This, pIPSite, pstm, dwReserved, ppView);
560 * Windows implementation creates new IOleDocumentView when function is called for the
561 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
562 * if the application uses returned interfaces, passed to ActivateMe or returned by
563 * QueryInterface, so there is no reason to create new interface. This needs more testing.
567 hres = IOleDocumentView_SetInPlaceSite(&This->IOleDocumentView_iface, pIPSite);
573 FIXME("pstm is not supported\n");
575 IOleDocumentView_AddRef(&This->IOleDocumentView_iface);
576 *ppView = &This->IOleDocumentView_iface;
580 static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
582 HTMLDocument *This = impl_from_IOleDocument(iface);
583 FIXME("(%p)->(%p)\n", This, pdwStatus);
587 static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
588 IOleDocumentView **ppView)
590 HTMLDocument *This = impl_from_IOleDocument(iface);
591 FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
595 static const IOleDocumentVtbl OleDocumentVtbl = {
596 OleDocument_QueryInterface,
599 OleDocument_CreateView,
600 OleDocument_GetDocMiscStatus,
601 OleDocument_EnumViews
604 /**********************************************************
605 * IOleControl implementation
608 static inline HTMLDocument *impl_from_IOleControl(IOleControl *iface)
610 return CONTAINING_RECORD(iface, HTMLDocument, IOleControl_iface);
613 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
615 HTMLDocument *This = impl_from_IOleControl(iface);
616 return htmldoc_query_interface(This, riid, ppv);
619 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
621 HTMLDocument *This = impl_from_IOleControl(iface);
622 return htmldoc_addref(This);
625 static ULONG WINAPI OleControl_Release(IOleControl *iface)
627 HTMLDocument *This = impl_from_IOleControl(iface);
628 return htmldoc_release(This);
631 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI)
633 HTMLDocument *This = impl_from_IOleControl(iface);
634 FIXME("(%p)->(%p)\n", This, pCI);
638 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *pMsg)
640 HTMLDocument *This = impl_from_IOleControl(iface);
641 FIXME("(%p)->(%p)\n", This, pMsg);
645 HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
647 IDispatch *disp = NULL;
648 DISPPARAMS dispparams = {NULL, 0};
652 hres = IOleClientSite_QueryInterface(client, &IID_IDispatch, (void**)&disp);
654 TRACE("Could not get IDispatch\n");
660 hres = IDispatch_Invoke(disp, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
661 DISPATCH_PROPERTYGET, &dispparams, res, NULL, &err);
663 IDispatch_Release(disp);
668 static HRESULT on_change_dlcontrol(HTMLDocument *This)
673 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_DLCONTROL, &res);
675 FIXME("unsupported dlcontrol %08x\n", V_I4(&res));
680 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
682 HTMLDocument *This = impl_from_IOleControl(iface);
683 IOleClientSite *client;
687 client = This->doc_obj->client;
689 TRACE("client = NULL\n");
694 case DISPID_AMBIENT_USERMODE:
695 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This);
696 hres = get_client_disp_property(client, DISPID_AMBIENT_USERMODE, &res);
700 if(V_VT(&res) == VT_BOOL) {
702 This->doc_obj->usermode = BROWSEMODE;
704 FIXME("edit mode is not supported\n");
705 This->doc_obj->usermode = EDITMODE;
708 FIXME("V_VT(res)=%d\n", V_VT(&res));
711 case DISPID_AMBIENT_DLCONTROL:
712 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This);
713 return on_change_dlcontrol(This);
714 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
715 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This);
716 on_change_dlcontrol(This);
717 hres = get_client_disp_property(client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &res);
721 if(V_VT(&res) == VT_BOOL) {
723 FIXME("offline connection is not supported\n");
727 FIXME("V_VT(res)=%d\n", V_VT(&res));
730 case DISPID_AMBIENT_SILENT:
731 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This);
732 on_change_dlcontrol(This);
733 hres = get_client_disp_property(client, DISPID_AMBIENT_SILENT, &res);
737 if(V_VT(&res) == VT_BOOL) {
739 FIXME("silent mode is not supported\n");
743 FIXME("V_VT(res)=%d\n", V_VT(&res));
746 case DISPID_AMBIENT_USERAGENT:
747 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This);
748 hres = get_client_disp_property(client, DISPID_AMBIENT_USERAGENT, &res);
752 FIXME("not supported AMBIENT_USERAGENT\n");
755 case DISPID_AMBIENT_PALETTE:
756 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This);
757 hres = get_client_disp_property(client, DISPID_AMBIENT_PALETTE, &res);
761 FIXME("not supported AMBIENT_PALETTE\n");
766 FIXME("(%p) unsupported dispID=%d\n", This, dispID);
770 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
772 HTMLDocument *This = impl_from_IOleControl(iface);
773 FIXME("(%p)->(%x)\n", This, bFreeze);
777 static const IOleControlVtbl OleControlVtbl = {
778 OleControl_QueryInterface,
781 OleControl_GetControlInfo,
782 OleControl_OnMnemonic,
783 OleControl_OnAmbientPropertyChange,
784 OleControl_FreezeEvents
787 /**********************************************************
788 * IObjectWithSite implementation
791 static inline HTMLDocument *impl_from_IObjectWithSite(IObjectWithSite *iface)
793 return CONTAINING_RECORD(iface, HTMLDocument, IObjectWithSite_iface);
796 static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppv)
798 HTMLDocument *This = impl_from_IObjectWithSite(iface);
799 return htmldoc_query_interface(This, riid, ppv);
802 static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
804 HTMLDocument *This = impl_from_IObjectWithSite(iface);
805 return htmldoc_addref(This);
808 static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
810 HTMLDocument *This = impl_from_IObjectWithSite(iface);
811 return htmldoc_release(This);
814 static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
816 HTMLDocument *This = impl_from_IObjectWithSite(iface);
817 FIXME("(%p)->(%p)\n", This, pUnkSite);
821 static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite* iface, REFIID riid, PVOID *ppvSite)
823 HTMLDocument *This = impl_from_IObjectWithSite(iface);
824 FIXME("(%p)->(%p)\n", This, ppvSite);
828 static const IObjectWithSiteVtbl ObjectWithSiteVtbl = {
829 ObjectWithSite_QueryInterface,
830 ObjectWithSite_AddRef,
831 ObjectWithSite_Release,
832 ObjectWithSite_SetSite,
833 ObjectWithSite_GetSite
836 /**********************************************************
837 * IOleContainer implementation
840 static inline HTMLDocument *impl_from_IOleContainer(IOleContainer *iface)
842 return CONTAINING_RECORD(iface, HTMLDocument, IOleContainer_iface);
845 static HRESULT WINAPI OleContainer_QueryInterface(IOleContainer *iface, REFIID riid, void **ppv)
847 HTMLDocument *This = impl_from_IOleContainer(iface);
848 return htmldoc_query_interface(This, riid, ppv);
851 static ULONG WINAPI OleContainer_AddRef(IOleContainer *iface)
853 HTMLDocument *This = impl_from_IOleContainer(iface);
854 return htmldoc_addref(This);
857 static ULONG WINAPI OleContainer_Release(IOleContainer *iface)
859 HTMLDocument *This = impl_from_IOleContainer(iface);
860 return htmldoc_release(This);
863 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer *iface, IBindCtx *pbc, LPOLESTR pszDisplayName,
864 ULONG *pchEaten, IMoniker **ppmkOut)
866 HTMLDocument *This = impl_from_IOleContainer(iface);
867 FIXME("(%p)->(%p %s %p %p)\n", This, pbc, debugstr_w(pszDisplayName), pchEaten, ppmkOut);
871 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer *iface, DWORD grfFlags, IEnumUnknown **ppenum)
873 HTMLDocument *This = impl_from_IOleContainer(iface);
874 FIXME("(%p)->(%x %p)\n", This, grfFlags, ppenum);
878 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer *iface, BOOL fLock)
880 HTMLDocument *This = impl_from_IOleContainer(iface);
881 FIXME("(%p)->(%x)\n", This, fLock);
885 static const IOleContainerVtbl OleContainerVtbl = {
886 OleContainer_QueryInterface,
888 OleContainer_Release,
889 OleContainer_ParseDisplayName,
890 OleContainer_EnumObjects,
891 OleContainer_LockContainer
894 /**********************************************************
895 * IObjectSafety implementation
898 static inline HTMLDocument *impl_from_IObjectSafety(IObjectSafety *iface)
900 return CONTAINING_RECORD(iface, HTMLDocument, IObjectSafety_iface);
903 static HRESULT WINAPI ObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
905 HTMLDocument *This = impl_from_IObjectSafety(iface);
906 return htmldoc_query_interface(This, riid, ppv);
909 static ULONG WINAPI ObjectSafety_AddRef(IObjectSafety *iface)
911 HTMLDocument *This = impl_from_IObjectSafety(iface);
912 return htmldoc_addref(This);
915 static ULONG WINAPI ObjectSafety_Release(IObjectSafety *iface)
917 HTMLDocument *This = impl_from_IObjectSafety(iface);
918 return htmldoc_release(This);
921 static HRESULT WINAPI ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety *iface,
922 REFIID riid, DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
924 HTMLDocument *This = impl_from_IObjectSafety(iface);
925 FIXME("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), pdwSupportedOptions, pdwEnabledOptions);
929 static HRESULT WINAPI ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface,
930 REFIID riid, DWORD dwOptionSetMask, DWORD dwEnabledOptions)
932 HTMLDocument *This = impl_from_IObjectSafety(iface);
933 FIXME("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
935 if(IsEqualGUID(&IID_IPersistMoniker, riid) &&
936 dwOptionSetMask==INTERFACESAFE_FOR_UNTRUSTED_DATA &&
937 dwEnabledOptions==INTERFACESAFE_FOR_UNTRUSTED_DATA)
943 static const IObjectSafetyVtbl ObjectSafetyVtbl = {
944 ObjectSafety_QueryInterface,
946 ObjectSafety_Release,
947 ObjectSafety_GetInterfaceSafetyOptions,
948 ObjectSafety_SetInterfaceSafetyOptions
951 void HTMLDocument_LockContainer(HTMLDocumentObj *This, BOOL fLock)
953 IOleContainer *container;
956 if(!This->client || This->container_locked == fLock)
959 hres = IOleClientSite_GetContainer(This->client, &container);
960 if(SUCCEEDED(hres)) {
961 IOleContainer_LockContainer(container, fLock);
962 This->container_locked = fLock;
963 IOleContainer_Release(container);
967 void HTMLDocument_OleObj_Init(HTMLDocument *This)
969 This->IOleObject_iface.lpVtbl = &OleObjectVtbl;
970 This->IOleDocument_iface.lpVtbl = &OleDocumentVtbl;
971 This->IOleControl_iface.lpVtbl = &OleControlVtbl;
972 This->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
973 This->IOleContainer_iface.lpVtbl = &OleContainerVtbl;
974 This->IObjectSafety_iface.lpVtbl = &ObjectSafetyVtbl;