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
32 #include "shdeprecated.h"
36 #include "wine/debug.h"
38 #include "mshtml_private.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
42 #define DOCHOST_DOCCANNAVIGATE 0
45 IEnumUnknown IEnumUnknown_iface
;
49 static inline EnumUnknown
*impl_from_IEnumUnknown(IEnumUnknown
*iface
)
51 return CONTAINING_RECORD(iface
, EnumUnknown
, IEnumUnknown_iface
);
54 static HRESULT WINAPI
EnumUnknown_QueryInterface(IEnumUnknown
*iface
, REFIID riid
, void **ppv
)
56 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
58 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
59 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
60 *ppv
= &This
->IEnumUnknown_iface
;
61 }else if(IsEqualGUID(&IID_IEnumUnknown
, riid
)) {
62 TRACE("(%p)->(IID_IEnumUnknown %p)\n", This
, ppv
);
63 *ppv
= &This
->IEnumUnknown_iface
;
65 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
70 IUnknown_AddRef((IUnknown
*)*ppv
);
74 static ULONG WINAPI
EnumUnknown_AddRef(IEnumUnknown
*iface
)
76 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
77 LONG ref
= InterlockedIncrement(&This
->ref
);
79 TRACE("(%p) ref=%d\n", This
, ref
);
84 static ULONG WINAPI
EnumUnknown_Release(IEnumUnknown
*iface
)
86 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
87 LONG ref
= InterlockedDecrement(&This
->ref
);
89 TRACE("(%p) ref=%d\n", This
, ref
);
97 static HRESULT WINAPI
EnumUnknown_Next(IEnumUnknown
*iface
, ULONG celt
, IUnknown
**rgelt
, ULONG
*pceltFetched
)
99 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
101 TRACE("(%p)->(%u %p %p)\n", This
, celt
, rgelt
, pceltFetched
);
103 /* FIXME: It's not clear if we should ever return something here */
109 static HRESULT WINAPI
EnumUnknown_Skip(IEnumUnknown
*iface
, ULONG celt
)
111 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
112 FIXME("(%p)->(%u)\n", This
, celt
);
116 static HRESULT WINAPI
EnumUnknown_Reset(IEnumUnknown
*iface
)
118 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
119 FIXME("(%p)\n", This
);
123 static HRESULT WINAPI
EnumUnknown_Clone(IEnumUnknown
*iface
, IEnumUnknown
**ppenum
)
125 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
126 FIXME("(%p)->(%p)\n", This
, ppenum
);
130 static const IEnumUnknownVtbl EnumUnknownVtbl
= {
131 EnumUnknown_QueryInterface
,
140 /**********************************************************
141 * IOleObject implementation
144 static inline HTMLDocument
*impl_from_IOleObject(IOleObject
*iface
)
146 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleObject_iface
);
149 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
151 HTMLDocument
*This
= impl_from_IOleObject(iface
);
152 return htmldoc_query_interface(This
, riid
, ppv
);
155 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
157 HTMLDocument
*This
= impl_from_IOleObject(iface
);
158 return htmldoc_addref(This
);
161 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
163 HTMLDocument
*This
= impl_from_IOleObject(iface
);
164 return htmldoc_release(This
);
167 static void update_hostinfo(HTMLDocumentObj
*This
, DOCHOSTUIINFO
*hostinfo
)
169 nsIScrollable
*scrollable
;
172 if(!This
->nscontainer
)
175 nsres
= nsIWebBrowser_QueryInterface(This
->nscontainer
->webbrowser
, &IID_nsIScrollable
, (void**)&scrollable
);
176 if(NS_SUCCEEDED(nsres
)) {
177 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_Y
,
178 (hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
) ? Scrollbar_Never
: Scrollbar_Always
);
180 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres
);
182 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_X
,
183 hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
? Scrollbar_Never
: Scrollbar_Auto
);
185 ERR("Could not set default X scrollbar prefs: %08x\n", nsres
);
187 nsIScrollable_Release(scrollable
);
189 ERR("Could not get nsIScrollable: %08x\n", nsres
);
193 /* Calls undocumented 84 cmd of CGID_ShellDocView */
194 void call_docview_84(HTMLDocumentObj
*doc
)
196 IOleCommandTarget
*olecmd
;
203 hres
= IOleClientSite_QueryInterface(doc
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
208 hres
= IOleCommandTarget_Exec(olecmd
, &CGID_ShellDocView
, 84, 0, NULL
, &var
);
209 IOleCommandTarget_Release(olecmd
);
210 if(SUCCEEDED(hres
) && V_VT(&var
) != VT_NULL
)
211 FIXME("handle result\n");
214 void set_document_navigation(HTMLDocumentObj
*doc
, BOOL doc_can_navigate
)
218 if(!doc
->client_cmdtrg
)
221 if(doc_can_navigate
) {
222 V_VT(&var
) = VT_UNKNOWN
;
223 V_UNKNOWN(&var
) = (IUnknown
*)&doc
->basedoc
.window
->base
.IHTMLWindow2_iface
;
226 IOleCommandTarget_Exec(doc
->client_cmdtrg
, &CGID_DocHostCmdPriv
, DOCHOST_DOCCANNAVIGATE
, 0,
227 doc_can_navigate
? &var
: NULL
, NULL
);
230 static void load_settings(HTMLDocumentObj
*doc
)
236 static const WCHAR ie_keyW
[] = {
237 'S','O','F','T','W','A','R','E','\\',
238 'M','i','c','r','o','s','o','f','t','\\',
239 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0};
240 static const WCHAR zoomW
[] = {'Z','o','o','m',0};
241 static const WCHAR zoom_factorW
[] = {'Z','o','o','m','F','a','c','t','o','r',0};
243 res
= RegOpenKeyW(HKEY_CURRENT_USER
, ie_keyW
, &settings_key
);
244 if(res
!= ERROR_SUCCESS
)
248 res
= RegGetValueW(settings_key
, zoomW
, zoom_factorW
, RRF_RT_REG_DWORD
, NULL
, &val
, &size
);
249 RegCloseKey(settings_key
);
250 if(res
== ERROR_SUCCESS
)
251 set_viewer_zoom(doc
->nscontainer
, (float)val
/100000);
254 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, IOleClientSite
*pClientSite
)
256 HTMLDocument
*This
= impl_from_IOleObject(iface
);
257 IOleCommandTarget
*cmdtrg
= NULL
;
258 IOleWindow
*ole_window
;
259 IBrowserService
*browser_service
;
265 TRACE("(%p)->(%p)\n", This
, pClientSite
);
267 if(pClientSite
== This
->doc_obj
->client
)
270 if(This
->doc_obj
->client
) {
271 IOleClientSite_Release(This
->doc_obj
->client
);
272 This
->doc_obj
->client
= NULL
;
273 This
->doc_obj
->usermode
= UNKNOWN_USERMODE
;
276 if(This
->doc_obj
->client_cmdtrg
) {
277 IOleCommandTarget_Release(This
->doc_obj
->client_cmdtrg
);
278 This
->doc_obj
->client_cmdtrg
= NULL
;
281 if(This
->doc_obj
->hostui
&& !This
->doc_obj
->custom_hostui
) {
282 IDocHostUIHandler_Release(This
->doc_obj
->hostui
);
283 This
->doc_obj
->hostui
= NULL
;
286 if(This
->doc_obj
->doc_object_service
) {
287 IDocObjectService_Release(This
->doc_obj
->doc_object_service
);
288 This
->doc_obj
->doc_object_service
= NULL
;
291 if(This
->doc_obj
->webbrowser
) {
292 IUnknown_Release(This
->doc_obj
->webbrowser
);
293 This
->doc_obj
->webbrowser
= NULL
;
296 if(This
->doc_obj
->browser_service
) {
297 IUnknown_Release(This
->doc_obj
->browser_service
);
298 This
->doc_obj
->browser_service
= NULL
;
301 if(This
->doc_obj
->travel_log
) {
302 ITravelLog_Release(This
->doc_obj
->travel_log
);
303 This
->doc_obj
->travel_log
= NULL
;
306 memset(&This
->doc_obj
->hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
311 IOleClientSite_AddRef(pClientSite
);
312 This
->doc_obj
->client
= pClientSite
;
314 hostui_setup
= This
->doc_obj
->hostui_setup
;
316 if(!This
->doc_obj
->hostui
) {
317 IDocHostUIHandler
*uihandler
;
319 This
->doc_obj
->custom_hostui
= FALSE
;
321 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IDocHostUIHandler
, (void**)&uihandler
);
323 This
->doc_obj
->hostui
= uihandler
;
326 if(This
->doc_obj
->hostui
) {
327 DOCHOSTUIINFO hostinfo
;
328 LPOLESTR key_path
= NULL
, override_key_path
= NULL
;
329 IDocHostUIHandler2
*uihandler2
;
331 memset(&hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
332 hostinfo
.cbSize
= sizeof(DOCHOSTUIINFO
);
333 hres
= IDocHostUIHandler_GetHostInfo(This
->doc_obj
->hostui
, &hostinfo
);
334 if(SUCCEEDED(hres
)) {
335 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
336 hostinfo
.cbSize
, hostinfo
.dwFlags
, hostinfo
.dwDoubleClick
,
337 debugstr_w(hostinfo
.pchHostCss
), debugstr_w(hostinfo
.pchHostNS
));
338 update_hostinfo(This
->doc_obj
, &hostinfo
);
339 This
->doc_obj
->hostinfo
= hostinfo
;
343 hres
= IDocHostUIHandler_GetOptionKeyPath(This
->doc_obj
->hostui
, &key_path
, 0);
344 if(hres
== S_OK
&& key_path
) {
346 /* FIXME: use key_path */
347 FIXME("key_path = %s\n", debugstr_w(key_path
));
349 CoTaskMemFree(key_path
);
352 hres
= IDocHostUIHandler_QueryInterface(This
->doc_obj
->hostui
, &IID_IDocHostUIHandler2
,
353 (void**)&uihandler2
);
354 if(SUCCEEDED(hres
)) {
355 hres
= IDocHostUIHandler2_GetOverrideKeyPath(uihandler2
, &override_key_path
, 0);
356 if(hres
== S_OK
&& override_key_path
) {
357 if(override_key_path
[0]) {
358 /*FIXME: use override_key_path */
359 FIXME("override_key_path = %s\n", debugstr_w(override_key_path
));
361 CoTaskMemFree(override_key_path
);
363 IDocHostUIHandler2_Release(uihandler2
);
366 This
->doc_obj
->hostui_setup
= TRUE
;
370 load_settings(This
->doc_obj
);
372 /* Native calls here GetWindow. What is it for?
373 * We don't have anything to do with it here (yet). */
374 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleWindow
, (void**)&ole_window
);
375 if(SUCCEEDED(hres
)) {
376 IOleWindow_GetWindow(ole_window
, &hwnd
);
377 IOleWindow_Release(ole_window
);
380 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IShellBrowser
,
381 &IID_IBrowserService
, (void**)&browser_service
);
382 if(SUCCEEDED(hres
)) {
383 ITravelLog
*travel_log
;
385 This
->doc_obj
->browser_service
= (IUnknown
*)browser_service
;
387 hres
= IBrowserService_GetTravelLog(browser_service
, &travel_log
);
389 This
->doc_obj
->travel_log
= travel_log
;
391 browser_service
= NULL
;
394 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
395 if(SUCCEEDED(hres
)) {
397 OLECMD cmd
= {OLECMDID_SETPROGRESSTEXT
, 0};
399 This
->doc_obj
->client_cmdtrg
= cmdtrg
;
402 IDocObjectService
*doc_object_service
;
405 set_document_navigation(This
->doc_obj
, TRUE
);
407 if(browser_service
) {
408 hres
= IBrowserService_QueryInterface(browser_service
,
409 &IID_IDocObjectService
, (void**)&doc_object_service
);
410 if(SUCCEEDED(hres
)) {
411 This
->doc_obj
->doc_object_service
= doc_object_service
;
414 * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
415 * embedder supports IWebBrowserApp.
417 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IWebBrowserApp
, &IID_IWebBrowser2
, (void**)&wb
);
419 This
->doc_obj
->webbrowser
= (IUnknown
*)wb
;
424 call_docview_84(This
->doc_obj
);
426 IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 1, &cmd
, NULL
);
430 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
431 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
432 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
433 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
436 if(This
->doc_obj
->usermode
== UNKNOWN_USERMODE
)
437 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERMODE
);
439 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
,
440 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
442 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_SILENT
, &silent
);
443 if(SUCCEEDED(hres
)) {
444 if(V_VT(&silent
) != VT_BOOL
)
445 WARN("silent = %s\n", debugstr_variant(&silent
));
446 else if(V_BOOL(&silent
))
447 FIXME("silent == true\n");
450 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERAGENT
);
451 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_PALETTE
);
456 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
458 HTMLDocument
*This
= impl_from_IOleObject(iface
);
460 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
465 if(This
->doc_obj
->client
)
466 IOleClientSite_AddRef(This
->doc_obj
->client
);
467 *ppClientSite
= This
->doc_obj
->client
;
472 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
474 HTMLDocument
*This
= impl_from_IOleObject(iface
);
475 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
479 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
481 HTMLDocument
*This
= impl_from_IOleObject(iface
);
483 TRACE("(%p)->(%08x)\n", This
, dwSaveOption
);
485 if(dwSaveOption
== OLECLOSE_PROMPTSAVE
)
486 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
488 if(This
->doc_obj
->in_place_active
)
489 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
491 HTMLDocument_LockContainer(This
->doc_obj
, FALSE
);
493 if(This
->doc_obj
->advise_holder
)
494 IOleAdviseHolder_SendOnClose(This
->doc_obj
->advise_holder
);
499 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
501 HTMLDocument
*This
= impl_from_IOleObject(iface
);
502 FIXME("(%p %d %p)->()\n", This
, dwWhichMoniker
, pmk
);
506 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
508 HTMLDocument
*This
= impl_from_IOleObject(iface
);
509 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
513 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
516 HTMLDocument
*This
= impl_from_IOleObject(iface
);
517 FIXME("(%p)->(%p %x %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
521 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
523 HTMLDocument
*This
= impl_from_IOleObject(iface
);
524 FIXME("(%p)->(%d %p)\n", This
, dwReserved
, ppDataObject
);
528 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
529 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
531 HTMLDocument
*This
= impl_from_IOleObject(iface
);
532 IOleDocumentSite
*pDocSite
;
535 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
, lprcPosRect
);
537 if(iVerb
!= OLEIVERB_SHOW
&& iVerb
!= OLEIVERB_UIACTIVATE
&& iVerb
!= OLEIVERB_INPLACEACTIVATE
) {
538 FIXME("iVerb = %d not supported\n", iVerb
);
543 pActiveSite
= This
->doc_obj
->client
;
545 hres
= IOleClientSite_QueryInterface(pActiveSite
, &IID_IOleDocumentSite
, (void**)&pDocSite
);
546 if(SUCCEEDED(hres
)) {
547 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
549 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
550 hres
= IOleDocumentSite_ActivateMe(pDocSite
, &This
->doc_obj
->IOleDocumentView_iface
);
551 IOleDocumentSite_Release(pDocSite
);
553 hres
= IOleDocumentView_UIActivate(&This
->doc_obj
->IOleDocumentView_iface
, TRUE
);
554 if(SUCCEEDED(hres
)) {
556 RECT rect
; /* We need to pass rect as not const pointer */
558 IOleDocumentView_SetRect(&This
->doc_obj
->IOleDocumentView_iface
, &rect
);
560 IOleDocumentView_Show(&This
->doc_obj
->IOleDocumentView_iface
, TRUE
);
567 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
569 HTMLDocument
*This
= impl_from_IOleObject(iface
);
570 FIXME("(%p)->(%p)\n", This
, ppEnumOleVerb
);
574 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
576 HTMLDocument
*This
= impl_from_IOleObject(iface
);
577 FIXME("(%p)\n", This
);
581 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
583 HTMLDocument
*This
= impl_from_IOleObject(iface
);
584 FIXME("(%p)\n", This
);
588 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
590 HTMLDocument
*This
= impl_from_IOleObject(iface
);
592 TRACE("(%p)->(%p)\n", This
, pClsid
);
597 *pClsid
= CLSID_HTMLDocument
;
601 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
603 HTMLDocument
*This
= impl_from_IOleObject(iface
);
604 FIXME("(%p)->(%d %p)\n", This
, dwFormOfType
, pszUserType
);
608 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
610 HTMLDocument
*This
= impl_from_IOleObject(iface
);
611 FIXME("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
615 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
617 HTMLDocument
*This
= impl_from_IOleObject(iface
);
618 FIXME("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
622 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
624 HTMLDocument
*This
= impl_from_IOleObject(iface
);
625 TRACE("(%p)->(%p %p)\n", This
, pAdvSink
, pdwConnection
);
635 if(!This
->doc_obj
->advise_holder
) {
636 CreateOleAdviseHolder(&This
->doc_obj
->advise_holder
);
637 if(!This
->doc_obj
->advise_holder
)
638 return E_OUTOFMEMORY
;
641 return IOleAdviseHolder_Advise(This
->doc_obj
->advise_holder
, pAdvSink
, pdwConnection
);
644 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
646 HTMLDocument
*This
= impl_from_IOleObject(iface
);
647 TRACE("(%p)->(%d)\n", This
, dwConnection
);
649 if(!This
->doc_obj
->advise_holder
)
650 return OLE_E_NOCONNECTION
;
652 return IOleAdviseHolder_Unadvise(This
->doc_obj
->advise_holder
, dwConnection
);
655 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
657 HTMLDocument
*This
= impl_from_IOleObject(iface
);
659 if(!This
->doc_obj
->advise_holder
) {
660 *ppenumAdvise
= NULL
;
664 return IOleAdviseHolder_EnumAdvise(This
->doc_obj
->advise_holder
, ppenumAdvise
);
667 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
669 HTMLDocument
*This
= impl_from_IOleObject(iface
);
670 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pdwStatus
);
674 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
676 HTMLDocument
*This
= impl_from_IOleObject(iface
);
677 FIXME("(%p)->(%p)\n", This
, pLogpal
);
681 static const IOleObjectVtbl OleObjectVtbl
= {
682 OleObject_QueryInterface
,
685 OleObject_SetClientSite
,
686 OleObject_GetClientSite
,
687 OleObject_SetHostNames
,
689 OleObject_SetMoniker
,
690 OleObject_GetMoniker
,
691 OleObject_InitFromData
,
692 OleObject_GetClipboardData
,
696 OleObject_IsUpToDate
,
697 OleObject_GetUserClassID
,
698 OleObject_GetUserType
,
703 OleObject_EnumAdvise
,
704 OleObject_GetMiscStatus
,
705 OleObject_SetColorScheme
708 /**********************************************************
709 * IOleDocument implementation
712 static inline HTMLDocument
*impl_from_IOleDocument(IOleDocument
*iface
)
714 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleDocument_iface
);
717 static HRESULT WINAPI
OleDocument_QueryInterface(IOleDocument
*iface
, REFIID riid
, void **ppv
)
719 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
720 return htmldoc_query_interface(This
, riid
, ppv
);
723 static ULONG WINAPI
OleDocument_AddRef(IOleDocument
*iface
)
725 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
726 return htmldoc_addref(This
);
729 static ULONG WINAPI
OleDocument_Release(IOleDocument
*iface
)
731 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
732 return htmldoc_release(This
);
735 static HRESULT WINAPI
OleDocument_CreateView(IOleDocument
*iface
, IOleInPlaceSite
*pIPSite
, IStream
*pstm
,
736 DWORD dwReserved
, IOleDocumentView
**ppView
)
738 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
741 TRACE("(%p)->(%p %p %d %p)\n", This
, pIPSite
, pstm
, dwReserved
, ppView
);
747 * Windows implementation creates new IOleDocumentView when function is called for the
748 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
749 * if the application uses returned interfaces, passed to ActivateMe or returned by
750 * QueryInterface, so there is no reason to create new interface. This needs more testing.
754 hres
= IOleDocumentView_SetInPlaceSite(&This
->doc_obj
->IOleDocumentView_iface
, pIPSite
);
760 FIXME("pstm is not supported\n");
762 IOleDocumentView_AddRef(&This
->doc_obj
->IOleDocumentView_iface
);
763 *ppView
= &This
->doc_obj
->IOleDocumentView_iface
;
767 static HRESULT WINAPI
OleDocument_GetDocMiscStatus(IOleDocument
*iface
, DWORD
*pdwStatus
)
769 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
770 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
774 static HRESULT WINAPI
OleDocument_EnumViews(IOleDocument
*iface
, IEnumOleDocumentViews
**ppEnum
,
775 IOleDocumentView
**ppView
)
777 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
778 FIXME("(%p)->(%p %p)\n", This
, ppEnum
, ppView
);
782 static const IOleDocumentVtbl OleDocumentVtbl
= {
783 OleDocument_QueryInterface
,
786 OleDocument_CreateView
,
787 OleDocument_GetDocMiscStatus
,
788 OleDocument_EnumViews
791 /**********************************************************
792 * IOleControl implementation
795 static inline HTMLDocument
*impl_from_IOleControl(IOleControl
*iface
)
797 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleControl_iface
);
800 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
802 HTMLDocument
*This
= impl_from_IOleControl(iface
);
803 return htmldoc_query_interface(This
, riid
, ppv
);
806 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
808 HTMLDocument
*This
= impl_from_IOleControl(iface
);
809 return htmldoc_addref(This
);
812 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
814 HTMLDocument
*This
= impl_from_IOleControl(iface
);
815 return htmldoc_release(This
);
818 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
820 HTMLDocument
*This
= impl_from_IOleControl(iface
);
821 FIXME("(%p)->(%p)\n", This
, pCI
);
825 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*pMsg
)
827 HTMLDocument
*This
= impl_from_IOleControl(iface
);
828 FIXME("(%p)->(%p)\n", This
, pMsg
);
832 HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
834 IDispatch
*disp
= NULL
;
835 DISPPARAMS dispparams
= {NULL
, 0};
839 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
841 TRACE("Could not get IDispatch\n");
847 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
848 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, &err
);
850 IDispatch_Release(disp
);
855 static HRESULT
on_change_dlcontrol(HTMLDocument
*This
)
860 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_DLCONTROL
, &res
);
862 FIXME("unsupported dlcontrol %08x\n", V_I4(&res
));
867 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
869 HTMLDocument
*This
= impl_from_IOleControl(iface
);
870 IOleClientSite
*client
;
874 client
= This
->doc_obj
->client
;
876 TRACE("client = NULL\n");
881 case DISPID_AMBIENT_USERMODE
:
882 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This
);
883 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERMODE
, &res
);
887 if(V_VT(&res
) == VT_BOOL
) {
889 This
->doc_obj
->usermode
= BROWSEMODE
;
891 FIXME("edit mode is not supported\n");
892 This
->doc_obj
->usermode
= EDITMODE
;
895 FIXME("usermode=%s\n", debugstr_variant(&res
));
898 case DISPID_AMBIENT_DLCONTROL
:
899 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This
);
900 return on_change_dlcontrol(This
);
901 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
902 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This
);
903 on_change_dlcontrol(This
);
904 hres
= get_client_disp_property(client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &res
);
908 if(V_VT(&res
) == VT_BOOL
) {
910 FIXME("offline connection is not supported\n");
914 FIXME("offlineconnected=%s\n", debugstr_variant(&res
));
917 case DISPID_AMBIENT_SILENT
:
918 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This
);
919 on_change_dlcontrol(This
);
920 hres
= get_client_disp_property(client
, DISPID_AMBIENT_SILENT
, &res
);
924 if(V_VT(&res
) == VT_BOOL
) {
926 FIXME("silent mode is not supported\n");
930 FIXME("silent=%s\n", debugstr_variant(&res
));
933 case DISPID_AMBIENT_USERAGENT
:
934 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This
);
935 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERAGENT
, &res
);
939 FIXME("not supported AMBIENT_USERAGENT\n");
942 case DISPID_AMBIENT_PALETTE
:
943 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This
);
944 hres
= get_client_disp_property(client
, DISPID_AMBIENT_PALETTE
, &res
);
948 FIXME("not supported AMBIENT_PALETTE\n");
953 FIXME("(%p) unsupported dispID=%d\n", This
, dispID
);
957 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
959 HTMLDocument
*This
= impl_from_IOleControl(iface
);
960 FIXME("(%p)->(%x)\n", This
, bFreeze
);
964 static const IOleControlVtbl OleControlVtbl
= {
965 OleControl_QueryInterface
,
968 OleControl_GetControlInfo
,
969 OleControl_OnMnemonic
,
970 OleControl_OnAmbientPropertyChange
,
971 OleControl_FreezeEvents
974 /**********************************************************
975 * IOleInPlaceActiveObject implementation
978 static inline HTMLDocument
*impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject
*iface
)
980 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleInPlaceActiveObject_iface
);
983 static HRESULT WINAPI
OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
*iface
, REFIID riid
, void **ppv
)
985 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
986 return htmldoc_query_interface(This
, riid
, ppv
);
989 static ULONG WINAPI
OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject
*iface
)
991 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
992 return htmldoc_addref(This
);
995 static ULONG WINAPI
OleInPlaceActiveObject_Release(IOleInPlaceActiveObject
*iface
)
997 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
998 return htmldoc_release(This
);
1001 static HRESULT WINAPI
OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject
*iface
, HWND
*phwnd
)
1003 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1005 TRACE("(%p)->(%p)\n", This
, phwnd
);
1008 return E_INVALIDARG
;
1010 if(!This
->doc_obj
->in_place_active
) {
1015 *phwnd
= This
->doc_obj
->hwnd
;
1019 static HRESULT WINAPI
OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
, BOOL fEnterMode
)
1021 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1022 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
1026 static HRESULT WINAPI
OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
, LPMSG lpmsg
)
1028 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1029 FIXME("(%p)->(%p)\n", This
, lpmsg
);
1033 static HRESULT WINAPI
OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
1036 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1038 TRACE("(%p)->(%x)\n", This
, fActivate
);
1040 if(This
->doc_obj
->hostui
)
1041 IDocHostUIHandler_OnFrameWindowActivate(This
->doc_obj
->hostui
, fActivate
);
1046 static HRESULT WINAPI
OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
, BOOL fActivate
)
1048 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1049 FIXME("(%p)->(%x)\n", This
, fActivate
);
1053 static HRESULT WINAPI
OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
, LPCRECT prcBorder
,
1054 IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
1056 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1057 FIXME("(%p)->(%p %p %x)\n", This
, prcBorder
, pUIWindow
, fFrameWindow
);
1061 static HRESULT WINAPI
OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
, BOOL fEnable
)
1063 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1064 FIXME("(%p)->(%x)\n", This
, fEnable
);
1068 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
1069 OleInPlaceActiveObject_QueryInterface
,
1070 OleInPlaceActiveObject_AddRef
,
1071 OleInPlaceActiveObject_Release
,
1072 OleInPlaceActiveObject_GetWindow
,
1073 OleInPlaceActiveObject_ContextSensitiveHelp
,
1074 OleInPlaceActiveObject_TranslateAccelerator
,
1075 OleInPlaceActiveObject_OnFrameWindowActivate
,
1076 OleInPlaceActiveObject_OnDocWindowActivate
,
1077 OleInPlaceActiveObject_ResizeBorder
,
1078 OleInPlaceActiveObject_EnableModeless
1081 /**********************************************************
1082 * IOleInPlaceObjectWindowless implementation
1085 static inline HTMLDocument
*impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless
*iface
)
1087 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleInPlaceObjectWindowless_iface
);
1090 static HRESULT WINAPI
OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless
*iface
,
1091 REFIID riid
, void **ppv
)
1093 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1094 return htmldoc_query_interface(This
, riid
, ppv
);
1097 static ULONG WINAPI
OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless
*iface
)
1099 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1100 return htmldoc_addref(This
);
1103 static ULONG WINAPI
OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless
*iface
)
1105 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1106 return htmldoc_release(This
);
1109 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless
*iface
,
1112 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1113 return IOleInPlaceActiveObject_GetWindow(&This
->IOleInPlaceActiveObject_iface
, phwnd
);
1116 static HRESULT WINAPI
OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
1119 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1120 return IOleInPlaceActiveObject_ContextSensitiveHelp(&This
->IOleInPlaceActiveObject_iface
, fEnterMode
);
1123 static HRESULT WINAPI
OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless
*iface
)
1125 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1127 TRACE("(%p)\n", This
);
1129 if(This
->doc_obj
->ui_active
)
1130 IOleDocumentView_UIActivate(&This
->doc_obj
->IOleDocumentView_iface
, FALSE
);
1131 This
->doc_obj
->window_active
= FALSE
;
1133 if(!This
->doc_obj
->in_place_active
)
1136 if(This
->doc_obj
->frame
) {
1137 IOleInPlaceFrame_Release(This
->doc_obj
->frame
);
1138 This
->doc_obj
->frame
= NULL
;
1141 if(This
->doc_obj
->hwnd
) {
1142 ShowWindow(This
->doc_obj
->hwnd
, SW_HIDE
);
1143 SetWindowPos(This
->doc_obj
->hwnd
, HWND_TOPMOST
, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
);
1146 This
->doc_obj
->focus
= FALSE
;
1147 notif_focus(This
->doc_obj
);
1149 This
->doc_obj
->in_place_active
= FALSE
;
1150 if(This
->doc_obj
->ipsite
) {
1151 IOleInPlaceSiteEx
*ipsiteex
;
1154 hres
= IOleInPlaceSite_QueryInterface(This
->doc_obj
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
1155 if(SUCCEEDED(hres
)) {
1156 IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex
, TRUE
);
1157 IOleInPlaceSiteEx_Release(ipsiteex
);
1159 IOleInPlaceSite_OnInPlaceDeactivate(This
->doc_obj
->ipsite
);
1166 static HRESULT WINAPI
OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
1168 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1169 FIXME("(%p)\n", This
);
1173 static HRESULT WINAPI
OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless
*iface
,
1174 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
1176 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1177 FIXME("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
1181 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
1183 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1184 FIXME("(%p)\n", This
);
1188 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
1189 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
1191 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1192 FIXME("(%p)->(%u %lu %lu %p)\n", This
, msg
, wParam
, lParam
, lpResult
);
1196 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
1197 IDropTarget
**ppDropTarget
)
1199 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1200 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
1204 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
1205 OleInPlaceObjectWindowless_QueryInterface
,
1206 OleInPlaceObjectWindowless_AddRef
,
1207 OleInPlaceObjectWindowless_Release
,
1208 OleInPlaceObjectWindowless_GetWindow
,
1209 OleInPlaceObjectWindowless_ContextSensitiveHelp
,
1210 OleInPlaceObjectWindowless_InPlaceDeactivate
,
1211 OleInPlaceObjectWindowless_UIDeactivate
,
1212 OleInPlaceObjectWindowless_SetObjectRects
,
1213 OleInPlaceObjectWindowless_ReactivateAndUndo
,
1214 OleInPlaceObjectWindowless_OnWindowMessage
,
1215 OleInPlaceObjectWindowless_GetDropTarget
1218 /**********************************************************
1219 * IObjectWithSite implementation
1222 static inline HTMLDocument
*impl_from_IObjectWithSite(IObjectWithSite
*iface
)
1224 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectWithSite_iface
);
1227 static HRESULT WINAPI
ObjectWithSite_QueryInterface(IObjectWithSite
*iface
, REFIID riid
, void **ppv
)
1229 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1230 return htmldoc_query_interface(This
, riid
, ppv
);
1233 static ULONG WINAPI
ObjectWithSite_AddRef(IObjectWithSite
*iface
)
1235 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1236 return htmldoc_addref(This
);
1239 static ULONG WINAPI
ObjectWithSite_Release(IObjectWithSite
*iface
)
1241 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1242 return htmldoc_release(This
);
1245 static HRESULT WINAPI
ObjectWithSite_SetSite(IObjectWithSite
*iface
, IUnknown
*pUnkSite
)
1247 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1248 FIXME("(%p)->(%p)\n", This
, pUnkSite
);
1252 static HRESULT WINAPI
ObjectWithSite_GetSite(IObjectWithSite
* iface
, REFIID riid
, PVOID
*ppvSite
)
1254 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1255 FIXME("(%p)->(%p)\n", This
, ppvSite
);
1259 static const IObjectWithSiteVtbl ObjectWithSiteVtbl
= {
1260 ObjectWithSite_QueryInterface
,
1261 ObjectWithSite_AddRef
,
1262 ObjectWithSite_Release
,
1263 ObjectWithSite_SetSite
,
1264 ObjectWithSite_GetSite
1267 /**********************************************************
1268 * IOleContainer implementation
1271 static inline HTMLDocument
*impl_from_IOleContainer(IOleContainer
*iface
)
1273 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleContainer_iface
);
1276 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1278 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1279 return htmldoc_query_interface(This
, riid
, ppv
);
1282 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1284 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1285 return htmldoc_addref(This
);
1288 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1290 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1291 return htmldoc_release(This
);
1294 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
, LPOLESTR pszDisplayName
,
1295 ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1297 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1298 FIXME("(%p)->(%p %s %p %p)\n", This
, pbc
, debugstr_w(pszDisplayName
), pchEaten
, ppmkOut
);
1302 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
, IEnumUnknown
**ppenum
)
1304 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1307 TRACE("(%p)->(%x %p)\n", This
, grfFlags
, ppenum
);
1309 ret
= heap_alloc(sizeof(*ret
));
1311 return E_OUTOFMEMORY
;
1313 ret
->IEnumUnknown_iface
.lpVtbl
= &EnumUnknownVtbl
;
1316 *ppenum
= &ret
->IEnumUnknown_iface
;
1320 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1322 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1323 FIXME("(%p)->(%x)\n", This
, fLock
);
1327 static const IOleContainerVtbl OleContainerVtbl
= {
1328 OleContainer_QueryInterface
,
1329 OleContainer_AddRef
,
1330 OleContainer_Release
,
1331 OleContainer_ParseDisplayName
,
1332 OleContainer_EnumObjects
,
1333 OleContainer_LockContainer
1336 static inline HTMLDocumentObj
*impl_from_ITargetContainer(ITargetContainer
*iface
)
1338 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ITargetContainer_iface
);
1341 static HRESULT WINAPI
TargetContainer_QueryInterface(ITargetContainer
*iface
, REFIID riid
, void **ppv
)
1343 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1344 return ICustomDoc_QueryInterface(&This
->ICustomDoc_iface
, riid
, ppv
);
1347 static ULONG WINAPI
TargetContainer_AddRef(ITargetContainer
*iface
)
1349 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1350 return ICustomDoc_AddRef(&This
->ICustomDoc_iface
);
1353 static ULONG WINAPI
TargetContainer_Release(ITargetContainer
*iface
)
1355 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1356 return ICustomDoc_Release(&This
->ICustomDoc_iface
);
1359 static HRESULT WINAPI
TargetContainer_GetFrameUrl(ITargetContainer
*iface
, LPWSTR
*ppszFrameSrc
)
1361 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1362 FIXME("(%p)->(%p)\n", This
, ppszFrameSrc
);
1366 static HRESULT WINAPI
TargetContainer_GetFramesContainer(ITargetContainer
*iface
, IOleContainer
**ppContainer
)
1368 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1370 TRACE("(%p)->(%p)\n", This
, ppContainer
);
1372 /* NOTE: we should return wrapped interface here */
1373 IOleContainer_AddRef(&This
->basedoc
.IOleContainer_iface
);
1374 *ppContainer
= &This
->basedoc
.IOleContainer_iface
;
1378 static const ITargetContainerVtbl TargetContainerVtbl
= {
1379 TargetContainer_QueryInterface
,
1380 TargetContainer_AddRef
,
1381 TargetContainer_Release
,
1382 TargetContainer_GetFrameUrl
,
1383 TargetContainer_GetFramesContainer
1386 void TargetContainer_Init(HTMLDocumentObj
*This
)
1388 This
->ITargetContainer_iface
.lpVtbl
= &TargetContainerVtbl
;
1391 /**********************************************************
1392 * IObjectSafety implementation
1395 static inline HTMLDocument
*impl_from_IObjectSafety(IObjectSafety
*iface
)
1397 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectSafety_iface
);
1400 static HRESULT WINAPI
ObjectSafety_QueryInterface(IObjectSafety
*iface
, REFIID riid
, void **ppv
)
1402 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1403 return htmldoc_query_interface(This
, riid
, ppv
);
1406 static ULONG WINAPI
ObjectSafety_AddRef(IObjectSafety
*iface
)
1408 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1409 return htmldoc_addref(This
);
1412 static ULONG WINAPI
ObjectSafety_Release(IObjectSafety
*iface
)
1414 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1415 return htmldoc_release(This
);
1418 static HRESULT WINAPI
ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety
*iface
,
1419 REFIID riid
, DWORD
*pdwSupportedOptions
, DWORD
*pdwEnabledOptions
)
1421 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1422 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_guid(riid
), pdwSupportedOptions
, pdwEnabledOptions
);
1426 static HRESULT WINAPI
ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety
*iface
,
1427 REFIID riid
, DWORD dwOptionSetMask
, DWORD dwEnabledOptions
)
1429 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1430 FIXME("(%p)->(%s %x %x)\n", This
, debugstr_guid(riid
), dwOptionSetMask
, dwEnabledOptions
);
1432 if(IsEqualGUID(&IID_IPersistMoniker
, riid
) &&
1433 dwOptionSetMask
==INTERFACESAFE_FOR_UNTRUSTED_DATA
&&
1434 dwEnabledOptions
==INTERFACESAFE_FOR_UNTRUSTED_DATA
)
1440 static const IObjectSafetyVtbl ObjectSafetyVtbl
= {
1441 ObjectSafety_QueryInterface
,
1442 ObjectSafety_AddRef
,
1443 ObjectSafety_Release
,
1444 ObjectSafety_GetInterfaceSafetyOptions
,
1445 ObjectSafety_SetInterfaceSafetyOptions
1448 void HTMLDocument_LockContainer(HTMLDocumentObj
*This
, BOOL fLock
)
1450 IOleContainer
*container
;
1453 if(!This
->client
|| This
->container_locked
== fLock
)
1456 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
1457 if(SUCCEEDED(hres
)) {
1458 IOleContainer_LockContainer(container
, fLock
);
1459 This
->container_locked
= fLock
;
1460 IOleContainer_Release(container
);
1464 void HTMLDocument_OleObj_Init(HTMLDocument
*This
)
1466 This
->IOleObject_iface
.lpVtbl
= &OleObjectVtbl
;
1467 This
->IOleDocument_iface
.lpVtbl
= &OleDocumentVtbl
;
1468 This
->IOleControl_iface
.lpVtbl
= &OleControlVtbl
;
1469 This
->IOleInPlaceActiveObject_iface
.lpVtbl
= &OleInPlaceActiveObjectVtbl
;
1470 This
->IOleInPlaceObjectWindowless_iface
.lpVtbl
= &OleInPlaceObjectWindowlessVtbl
;
1471 This
->IObjectWithSite_iface
.lpVtbl
= &ObjectWithSiteVtbl
;
1472 This
->IOleContainer_iface
.lpVtbl
= &OleContainerVtbl
;
1473 This
->IObjectSafety_iface
.lpVtbl
= &ObjectSafetyVtbl
;