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 IServiceProvider
*sp
;
208 V_VT(&var
) = VT_UNKNOWN
;
209 V_UNKNOWN(&var
) = (IUnknown
*)&This
->window
->IHTMLWindow2_iface
;
210 IOleCommandTarget_Exec(cmdtrg
, &CGID_DocHostCmdPriv
, DOCHOST_DOCCANNAVIGATE
, 0, &var
, NULL
);
212 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IServiceProvider
, (void**)&sp
);
213 if(SUCCEEDED(hres
)) {
214 IDocObjectService
*doc_object_service
;
215 IBrowserService
*browser_service
;
218 hres
= IServiceProvider_QueryService(sp
, &IID_IShellBrowser
,
219 &IID_IBrowserService
, (void**)&browser_service
);
220 if(SUCCEEDED(hres
)) {
221 hres
= IBrowserService_QueryInterface(browser_service
,
222 &IID_IDocObjectService
, (void**)&doc_object_service
);
223 if(SUCCEEDED(hres
)) {
224 This
->doc_obj
->doc_object_service
= doc_object_service
;
227 * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
228 * embedder supports IWebBrowserApp.
230 hres
= IServiceProvider_QueryService(sp
, &IID_IWebBrowserApp
, &IID_IWebBrowser2
, (void**)&wb
);
231 if(SUCCEEDED(hres
)) {
232 This
->doc_obj
->is_webbrowser
= TRUE
;
233 IWebBrowser2_Release(wb
);
237 IBrowserService_Release(browser_service
);
240 IServiceProvider_Release(sp
);
244 IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 1, &cmd
, NULL
);
248 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
249 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
250 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
251 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
253 IOleCommandTarget_Release(cmdtrg
);
256 if(This
->doc_obj
->usermode
== UNKNOWN_USERMODE
)
257 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERMODE
);
259 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
,
260 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
262 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_SILENT
, &silent
);
263 if(SUCCEEDED(hres
)) {
264 if(V_VT(&silent
) != VT_BOOL
)
265 WARN("V_VT(silent) = %d\n", V_VT(&silent
));
266 else if(V_BOOL(&silent
))
267 FIXME("silent == true\n");
270 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERAGENT
);
271 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_PALETTE
);
276 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
278 HTMLDocument
*This
= impl_from_IOleObject(iface
);
280 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
285 if(This
->doc_obj
->client
)
286 IOleClientSite_AddRef(This
->doc_obj
->client
);
287 *ppClientSite
= This
->doc_obj
->client
;
292 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
294 HTMLDocument
*This
= impl_from_IOleObject(iface
);
295 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
299 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
301 HTMLDocument
*This
= impl_from_IOleObject(iface
);
303 TRACE("(%p)->(%08x)\n", This
, dwSaveOption
);
305 if(dwSaveOption
== OLECLOSE_PROMPTSAVE
)
306 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
308 if(This
->doc_obj
->in_place_active
)
309 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
311 HTMLDocument_LockContainer(This
->doc_obj
, FALSE
);
313 if(This
->advise_holder
)
314 IOleAdviseHolder_SendOnClose(This
->advise_holder
);
319 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
321 HTMLDocument
*This
= impl_from_IOleObject(iface
);
322 FIXME("(%p %d %p)->()\n", This
, dwWhichMoniker
, pmk
);
326 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
328 HTMLDocument
*This
= impl_from_IOleObject(iface
);
329 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
333 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
336 HTMLDocument
*This
= impl_from_IOleObject(iface
);
337 FIXME("(%p)->(%p %x %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
341 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
343 HTMLDocument
*This
= impl_from_IOleObject(iface
);
344 FIXME("(%p)->(%d %p)\n", This
, dwReserved
, ppDataObject
);
348 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
349 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
351 HTMLDocument
*This
= impl_from_IOleObject(iface
);
352 IOleDocumentSite
*pDocSite
;
355 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
, lprcPosRect
);
357 if(iVerb
!= OLEIVERB_SHOW
&& iVerb
!= OLEIVERB_UIACTIVATE
&& iVerb
!= OLEIVERB_INPLACEACTIVATE
) {
358 FIXME("iVerb = %d not supported\n", iVerb
);
363 pActiveSite
= This
->doc_obj
->client
;
365 hres
= IOleClientSite_QueryInterface(pActiveSite
, &IID_IOleDocumentSite
, (void**)&pDocSite
);
366 if(SUCCEEDED(hres
)) {
367 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
369 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
370 hres
= IOleDocumentSite_ActivateMe(pDocSite
, &This
->IOleDocumentView_iface
);
371 IOleDocumentSite_Release(pDocSite
);
373 hres
= IOleDocumentView_UIActivate(&This
->IOleDocumentView_iface
, TRUE
);
374 if(SUCCEEDED(hres
)) {
376 RECT rect
; /* We need to pass rect as not const pointer */
378 IOleDocumentView_SetRect(&This
->IOleDocumentView_iface
, &rect
);
380 IOleDocumentView_Show(&This
->IOleDocumentView_iface
, TRUE
);
387 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
389 HTMLDocument
*This
= impl_from_IOleObject(iface
);
390 FIXME("(%p)->(%p)\n", This
, ppEnumOleVerb
);
394 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
396 HTMLDocument
*This
= impl_from_IOleObject(iface
);
397 FIXME("(%p)\n", This
);
401 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
403 HTMLDocument
*This
= impl_from_IOleObject(iface
);
404 FIXME("(%p)\n", This
);
408 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
410 HTMLDocument
*This
= impl_from_IOleObject(iface
);
412 TRACE("(%p)->(%p)\n", This
, pClsid
);
417 *pClsid
= CLSID_HTMLDocument
;
421 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
423 HTMLDocument
*This
= impl_from_IOleObject(iface
);
424 FIXME("(%p)->(%d %p)\n", This
, dwFormOfType
, pszUserType
);
428 static HRESULT WINAPI
OleObject_SetExtent(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_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
437 HTMLDocument
*This
= impl_from_IOleObject(iface
);
438 FIXME("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
442 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
444 HTMLDocument
*This
= impl_from_IOleObject(iface
);
445 TRACE("(%p)->(%p %p)\n", This
, pAdvSink
, pdwConnection
);
455 if(!This
->advise_holder
) {
456 CreateOleAdviseHolder(&This
->advise_holder
);
457 if(!This
->advise_holder
)
458 return E_OUTOFMEMORY
;
461 return IOleAdviseHolder_Advise(This
->advise_holder
, pAdvSink
, pdwConnection
);
464 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
466 HTMLDocument
*This
= impl_from_IOleObject(iface
);
467 TRACE("(%p)->(%d)\n", This
, dwConnection
);
469 if(!This
->advise_holder
)
470 return OLE_E_NOCONNECTION
;
472 return IOleAdviseHolder_Unadvise(This
->advise_holder
, dwConnection
);
475 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
477 HTMLDocument
*This
= impl_from_IOleObject(iface
);
479 if(!This
->advise_holder
) {
480 *ppenumAdvise
= NULL
;
484 return IOleAdviseHolder_EnumAdvise(This
->advise_holder
, ppenumAdvise
);
487 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
489 HTMLDocument
*This
= impl_from_IOleObject(iface
);
490 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pdwStatus
);
494 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
496 HTMLDocument
*This
= impl_from_IOleObject(iface
);
497 FIXME("(%p)->(%p)\n", This
, pLogpal
);
501 static const IOleObjectVtbl OleObjectVtbl
= {
502 OleObject_QueryInterface
,
505 OleObject_SetClientSite
,
506 OleObject_GetClientSite
,
507 OleObject_SetHostNames
,
509 OleObject_SetMoniker
,
510 OleObject_GetMoniker
,
511 OleObject_InitFromData
,
512 OleObject_GetClipboardData
,
516 OleObject_IsUpToDate
,
517 OleObject_GetUserClassID
,
518 OleObject_GetUserType
,
523 OleObject_EnumAdvise
,
524 OleObject_GetMiscStatus
,
525 OleObject_SetColorScheme
528 /**********************************************************
529 * IOleDocument implementation
532 static inline HTMLDocument
*impl_from_IOleDocument(IOleDocument
*iface
)
534 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleDocument_iface
);
537 static HRESULT WINAPI
OleDocument_QueryInterface(IOleDocument
*iface
, REFIID riid
, void **ppv
)
539 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
540 return htmldoc_query_interface(This
, riid
, ppv
);
543 static ULONG WINAPI
OleDocument_AddRef(IOleDocument
*iface
)
545 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
546 return htmldoc_addref(This
);
549 static ULONG WINAPI
OleDocument_Release(IOleDocument
*iface
)
551 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
552 return htmldoc_release(This
);
555 static HRESULT WINAPI
OleDocument_CreateView(IOleDocument
*iface
, IOleInPlaceSite
*pIPSite
, IStream
*pstm
,
556 DWORD dwReserved
, IOleDocumentView
**ppView
)
558 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
561 TRACE("(%p)->(%p %p %d %p)\n", This
, pIPSite
, pstm
, dwReserved
, ppView
);
567 * Windows implementation creates new IOleDocumentView when function is called for the
568 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
569 * if the application uses returned interfaces, passed to ActivateMe or returned by
570 * QueryInterface, so there is no reason to create new interface. This needs more testing.
574 hres
= IOleDocumentView_SetInPlaceSite(&This
->IOleDocumentView_iface
, pIPSite
);
580 FIXME("pstm is not supported\n");
582 IOleDocumentView_AddRef(&This
->IOleDocumentView_iface
);
583 *ppView
= &This
->IOleDocumentView_iface
;
587 static HRESULT WINAPI
OleDocument_GetDocMiscStatus(IOleDocument
*iface
, DWORD
*pdwStatus
)
589 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
590 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
594 static HRESULT WINAPI
OleDocument_EnumViews(IOleDocument
*iface
, IEnumOleDocumentViews
**ppEnum
,
595 IOleDocumentView
**ppView
)
597 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
598 FIXME("(%p)->(%p %p)\n", This
, ppEnum
, ppView
);
602 static const IOleDocumentVtbl OleDocumentVtbl
= {
603 OleDocument_QueryInterface
,
606 OleDocument_CreateView
,
607 OleDocument_GetDocMiscStatus
,
608 OleDocument_EnumViews
611 /**********************************************************
612 * IOleControl implementation
615 static inline HTMLDocument
*impl_from_IOleControl(IOleControl
*iface
)
617 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleControl_iface
);
620 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
622 HTMLDocument
*This
= impl_from_IOleControl(iface
);
623 return htmldoc_query_interface(This
, riid
, ppv
);
626 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
628 HTMLDocument
*This
= impl_from_IOleControl(iface
);
629 return htmldoc_addref(This
);
632 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
634 HTMLDocument
*This
= impl_from_IOleControl(iface
);
635 return htmldoc_release(This
);
638 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
640 HTMLDocument
*This
= impl_from_IOleControl(iface
);
641 FIXME("(%p)->(%p)\n", This
, pCI
);
645 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*pMsg
)
647 HTMLDocument
*This
= impl_from_IOleControl(iface
);
648 FIXME("(%p)->(%p)\n", This
, pMsg
);
652 HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
654 IDispatch
*disp
= NULL
;
655 DISPPARAMS dispparams
= {NULL
, 0};
659 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
661 TRACE("Could not get IDispatch\n");
667 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
668 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, &err
);
670 IDispatch_Release(disp
);
675 static HRESULT
on_change_dlcontrol(HTMLDocument
*This
)
680 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_DLCONTROL
, &res
);
682 FIXME("unsupported dlcontrol %08x\n", V_I4(&res
));
687 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
689 HTMLDocument
*This
= impl_from_IOleControl(iface
);
690 IOleClientSite
*client
;
694 client
= This
->doc_obj
->client
;
696 TRACE("client = NULL\n");
701 case DISPID_AMBIENT_USERMODE
:
702 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This
);
703 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERMODE
, &res
);
707 if(V_VT(&res
) == VT_BOOL
) {
709 This
->doc_obj
->usermode
= BROWSEMODE
;
711 FIXME("edit mode is not supported\n");
712 This
->doc_obj
->usermode
= EDITMODE
;
715 FIXME("V_VT(res)=%d\n", V_VT(&res
));
718 case DISPID_AMBIENT_DLCONTROL
:
719 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This
);
720 return on_change_dlcontrol(This
);
721 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
722 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This
);
723 on_change_dlcontrol(This
);
724 hres
= get_client_disp_property(client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &res
);
728 if(V_VT(&res
) == VT_BOOL
) {
730 FIXME("offline connection is not supported\n");
734 FIXME("V_VT(res)=%d\n", V_VT(&res
));
737 case DISPID_AMBIENT_SILENT
:
738 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This
);
739 on_change_dlcontrol(This
);
740 hres
= get_client_disp_property(client
, DISPID_AMBIENT_SILENT
, &res
);
744 if(V_VT(&res
) == VT_BOOL
) {
746 FIXME("silent mode is not supported\n");
750 FIXME("V_VT(res)=%d\n", V_VT(&res
));
753 case DISPID_AMBIENT_USERAGENT
:
754 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This
);
755 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERAGENT
, &res
);
759 FIXME("not supported AMBIENT_USERAGENT\n");
762 case DISPID_AMBIENT_PALETTE
:
763 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This
);
764 hres
= get_client_disp_property(client
, DISPID_AMBIENT_PALETTE
, &res
);
768 FIXME("not supported AMBIENT_PALETTE\n");
773 FIXME("(%p) unsupported dispID=%d\n", This
, dispID
);
777 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
779 HTMLDocument
*This
= impl_from_IOleControl(iface
);
780 FIXME("(%p)->(%x)\n", This
, bFreeze
);
784 static const IOleControlVtbl OleControlVtbl
= {
785 OleControl_QueryInterface
,
788 OleControl_GetControlInfo
,
789 OleControl_OnMnemonic
,
790 OleControl_OnAmbientPropertyChange
,
791 OleControl_FreezeEvents
794 /**********************************************************
795 * IObjectWithSite implementation
798 static inline HTMLDocument
*impl_from_IObjectWithSite(IObjectWithSite
*iface
)
800 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectWithSite_iface
);
803 static HRESULT WINAPI
ObjectWithSite_QueryInterface(IObjectWithSite
*iface
, REFIID riid
, void **ppv
)
805 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
806 return htmldoc_query_interface(This
, riid
, ppv
);
809 static ULONG WINAPI
ObjectWithSite_AddRef(IObjectWithSite
*iface
)
811 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
812 return htmldoc_addref(This
);
815 static ULONG WINAPI
ObjectWithSite_Release(IObjectWithSite
*iface
)
817 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
818 return htmldoc_release(This
);
821 static HRESULT WINAPI
ObjectWithSite_SetSite(IObjectWithSite
*iface
, IUnknown
*pUnkSite
)
823 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
824 FIXME("(%p)->(%p)\n", This
, pUnkSite
);
828 static HRESULT WINAPI
ObjectWithSite_GetSite(IObjectWithSite
* iface
, REFIID riid
, PVOID
*ppvSite
)
830 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
831 FIXME("(%p)->(%p)\n", This
, ppvSite
);
835 static const IObjectWithSiteVtbl ObjectWithSiteVtbl
= {
836 ObjectWithSite_QueryInterface
,
837 ObjectWithSite_AddRef
,
838 ObjectWithSite_Release
,
839 ObjectWithSite_SetSite
,
840 ObjectWithSite_GetSite
843 /**********************************************************
844 * IOleContainer implementation
847 static inline HTMLDocument
*impl_from_IOleContainer(IOleContainer
*iface
)
849 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleContainer_iface
);
852 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
854 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
855 return htmldoc_query_interface(This
, riid
, ppv
);
858 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
860 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
861 return htmldoc_addref(This
);
864 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
866 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
867 return htmldoc_release(This
);
870 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
, LPOLESTR pszDisplayName
,
871 ULONG
*pchEaten
, IMoniker
**ppmkOut
)
873 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
874 FIXME("(%p)->(%p %s %p %p)\n", This
, pbc
, debugstr_w(pszDisplayName
), pchEaten
, ppmkOut
);
878 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
, IEnumUnknown
**ppenum
)
880 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
881 FIXME("(%p)->(%x %p)\n", This
, grfFlags
, ppenum
);
885 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
887 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
888 FIXME("(%p)->(%x)\n", This
, fLock
);
892 static const IOleContainerVtbl OleContainerVtbl
= {
893 OleContainer_QueryInterface
,
895 OleContainer_Release
,
896 OleContainer_ParseDisplayName
,
897 OleContainer_EnumObjects
,
898 OleContainer_LockContainer
901 /**********************************************************
902 * IObjectSafety implementation
905 static inline HTMLDocument
*impl_from_IObjectSafety(IObjectSafety
*iface
)
907 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectSafety_iface
);
910 static HRESULT WINAPI
ObjectSafety_QueryInterface(IObjectSafety
*iface
, REFIID riid
, void **ppv
)
912 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
913 return htmldoc_query_interface(This
, riid
, ppv
);
916 static ULONG WINAPI
ObjectSafety_AddRef(IObjectSafety
*iface
)
918 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
919 return htmldoc_addref(This
);
922 static ULONG WINAPI
ObjectSafety_Release(IObjectSafety
*iface
)
924 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
925 return htmldoc_release(This
);
928 static HRESULT WINAPI
ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety
*iface
,
929 REFIID riid
, DWORD
*pdwSupportedOptions
, DWORD
*pdwEnabledOptions
)
931 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
932 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_guid(riid
), pdwSupportedOptions
, pdwEnabledOptions
);
936 static HRESULT WINAPI
ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety
*iface
,
937 REFIID riid
, DWORD dwOptionSetMask
, DWORD dwEnabledOptions
)
939 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
940 FIXME("(%p)->(%s %x %x)\n", This
, debugstr_guid(riid
), dwOptionSetMask
, dwEnabledOptions
);
942 if(IsEqualGUID(&IID_IPersistMoniker
, riid
) &&
943 dwOptionSetMask
==INTERFACESAFE_FOR_UNTRUSTED_DATA
&&
944 dwEnabledOptions
==INTERFACESAFE_FOR_UNTRUSTED_DATA
)
950 static const IObjectSafetyVtbl ObjectSafetyVtbl
= {
951 ObjectSafety_QueryInterface
,
953 ObjectSafety_Release
,
954 ObjectSafety_GetInterfaceSafetyOptions
,
955 ObjectSafety_SetInterfaceSafetyOptions
958 void HTMLDocument_LockContainer(HTMLDocumentObj
*This
, BOOL fLock
)
960 IOleContainer
*container
;
963 if(!This
->client
|| This
->container_locked
== fLock
)
966 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
967 if(SUCCEEDED(hres
)) {
968 IOleContainer_LockContainer(container
, fLock
);
969 This
->container_locked
= fLock
;
970 IOleContainer_Release(container
);
974 void HTMLDocument_OleObj_Init(HTMLDocument
*This
)
976 This
->IOleObject_iface
.lpVtbl
= &OleObjectVtbl
;
977 This
->IOleDocument_iface
.lpVtbl
= &OleDocumentVtbl
;
978 This
->IOleControl_iface
.lpVtbl
= &OleControlVtbl
;
979 This
->IObjectWithSite_iface
.lpVtbl
= &ObjectWithSiteVtbl
;
980 This
->IOleContainer_iface
.lpVtbl
= &OleContainerVtbl
;
981 This
->IObjectSafety_iface
.lpVtbl
= &ObjectSafetyVtbl
;