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
30 #include "shdeprecated.h"
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
40 #define DOCHOST_DOCCANNAVIGATE 0
43 IEnumUnknown IEnumUnknown_iface
;
47 static inline EnumUnknown
*impl_from_IEnumUnknown(IEnumUnknown
*iface
)
49 return CONTAINING_RECORD(iface
, EnumUnknown
, IEnumUnknown_iface
);
52 static HRESULT WINAPI
EnumUnknown_QueryInterface(IEnumUnknown
*iface
, REFIID riid
, void **ppv
)
54 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
56 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
57 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
58 *ppv
= &This
->IEnumUnknown_iface
;
59 }else if(IsEqualGUID(&IID_IEnumUnknown
, riid
)) {
60 TRACE("(%p)->(IID_IEnumUnknown %p)\n", This
, ppv
);
61 *ppv
= &This
->IEnumUnknown_iface
;
63 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
68 IUnknown_AddRef((IUnknown
*)*ppv
);
72 static ULONG WINAPI
EnumUnknown_AddRef(IEnumUnknown
*iface
)
74 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
75 LONG ref
= InterlockedIncrement(&This
->ref
);
77 TRACE("(%p) ref=%d\n", This
, ref
);
82 static ULONG WINAPI
EnumUnknown_Release(IEnumUnknown
*iface
)
84 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
85 LONG ref
= InterlockedDecrement(&This
->ref
);
87 TRACE("(%p) ref=%d\n", This
, ref
);
95 static HRESULT WINAPI
EnumUnknown_Next(IEnumUnknown
*iface
, ULONG celt
, IUnknown
**rgelt
, ULONG
*pceltFetched
)
97 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
99 TRACE("(%p)->(%u %p %p)\n", This
, celt
, rgelt
, pceltFetched
);
101 /* FIXME: It's not clear if we should ever return something here */
107 static HRESULT WINAPI
EnumUnknown_Skip(IEnumUnknown
*iface
, ULONG celt
)
109 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
110 FIXME("(%p)->(%u)\n", This
, celt
);
114 static HRESULT WINAPI
EnumUnknown_Reset(IEnumUnknown
*iface
)
116 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
117 FIXME("(%p)\n", This
);
121 static HRESULT WINAPI
EnumUnknown_Clone(IEnumUnknown
*iface
, IEnumUnknown
**ppenum
)
123 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
124 FIXME("(%p)->(%p)\n", This
, ppenum
);
128 static const IEnumUnknownVtbl EnumUnknownVtbl
= {
129 EnumUnknown_QueryInterface
,
138 /**********************************************************
139 * IOleObject implementation
142 static inline HTMLDocument
*impl_from_IOleObject(IOleObject
*iface
)
144 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleObject_iface
);
147 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
149 HTMLDocument
*This
= impl_from_IOleObject(iface
);
150 return htmldoc_query_interface(This
, riid
, ppv
);
153 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
155 HTMLDocument
*This
= impl_from_IOleObject(iface
);
156 return htmldoc_addref(This
);
159 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
161 HTMLDocument
*This
= impl_from_IOleObject(iface
);
162 return htmldoc_release(This
);
165 static void update_hostinfo(HTMLDocumentObj
*This
, DOCHOSTUIINFO
*hostinfo
)
167 nsIScrollable
*scrollable
;
170 if(!This
->nscontainer
)
173 nsres
= nsIWebBrowser_QueryInterface(This
->nscontainer
->webbrowser
, &IID_nsIScrollable
, (void**)&scrollable
);
174 if(NS_SUCCEEDED(nsres
)) {
175 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_Y
,
176 (hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
) ? Scrollbar_Never
: Scrollbar_Always
);
178 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres
);
180 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_X
,
181 hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
? Scrollbar_Never
: Scrollbar_Auto
);
183 ERR("Could not set default X scrollbar prefs: %08x\n", nsres
);
185 nsIScrollable_Release(scrollable
);
187 ERR("Could not get nsIScrollable: %08x\n", nsres
);
191 /* Calls undocumented 84 cmd of CGID_ShellDocView */
192 void call_docview_84(HTMLDocumentObj
*doc
)
194 IOleCommandTarget
*olecmd
;
201 hres
= IOleClientSite_QueryInterface(doc
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
206 hres
= IOleCommandTarget_Exec(olecmd
, &CGID_ShellDocView
, 84, 0, NULL
, &var
);
207 IOleCommandTarget_Release(olecmd
);
208 if(SUCCEEDED(hres
) && V_VT(&var
) != VT_NULL
)
209 FIXME("handle result\n");
212 void set_document_navigation(HTMLDocumentObj
*doc
, BOOL doc_can_navigate
)
216 if(!doc
->client_cmdtrg
)
219 if(doc_can_navigate
) {
220 V_VT(&var
) = VT_UNKNOWN
;
221 V_UNKNOWN(&var
) = (IUnknown
*)&doc
->basedoc
.window
->base
.IHTMLWindow2_iface
;
224 IOleCommandTarget_Exec(doc
->client_cmdtrg
, &CGID_DocHostCmdPriv
, DOCHOST_DOCCANNAVIGATE
, 0,
225 doc_can_navigate
? &var
: NULL
, NULL
);
228 static void load_settings(HTMLDocumentObj
*doc
)
234 res
= RegOpenKeyW(HKEY_CURRENT_USER
, L
"SOFTWARE\\Microsoft\\Internet Explorer", &settings_key
);
235 if(res
!= ERROR_SUCCESS
)
239 res
= RegGetValueW(settings_key
, L
"Zoom", L
"ZoomFactor", RRF_RT_REG_DWORD
, NULL
, &val
, &size
);
240 RegCloseKey(settings_key
);
241 if(res
== ERROR_SUCCESS
)
242 set_viewer_zoom(doc
->nscontainer
, (float)val
/100000);
245 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, IOleClientSite
*pClientSite
)
247 HTMLDocument
*This
= impl_from_IOleObject(iface
);
248 IOleCommandTarget
*cmdtrg
= NULL
;
249 IOleWindow
*ole_window
;
250 IBrowserService
*browser_service
;
256 TRACE("(%p)->(%p)\n", This
, pClientSite
);
258 if(pClientSite
== This
->doc_obj
->client
)
261 if(This
->doc_obj
->client
) {
262 IOleClientSite_Release(This
->doc_obj
->client
);
263 This
->doc_obj
->client
= NULL
;
264 This
->doc_obj
->nscontainer
->usermode
= UNKNOWN_USERMODE
;
267 if(This
->doc_obj
->client_cmdtrg
) {
268 IOleCommandTarget_Release(This
->doc_obj
->client_cmdtrg
);
269 This
->doc_obj
->client_cmdtrg
= NULL
;
272 if(This
->doc_obj
->hostui
&& !This
->doc_obj
->custom_hostui
) {
273 IDocHostUIHandler_Release(This
->doc_obj
->hostui
);
274 This
->doc_obj
->hostui
= NULL
;
277 if(This
->doc_obj
->doc_object_service
) {
278 IDocObjectService_Release(This
->doc_obj
->doc_object_service
);
279 This
->doc_obj
->doc_object_service
= NULL
;
282 if(This
->doc_obj
->webbrowser
) {
283 IUnknown_Release(This
->doc_obj
->webbrowser
);
284 This
->doc_obj
->webbrowser
= NULL
;
287 if(This
->doc_obj
->browser_service
) {
288 IUnknown_Release(This
->doc_obj
->browser_service
);
289 This
->doc_obj
->browser_service
= NULL
;
292 if(This
->doc_obj
->travel_log
) {
293 ITravelLog_Release(This
->doc_obj
->travel_log
);
294 This
->doc_obj
->travel_log
= NULL
;
297 memset(&This
->doc_obj
->hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
302 IOleClientSite_AddRef(pClientSite
);
303 This
->doc_obj
->client
= pClientSite
;
305 hostui_setup
= This
->doc_obj
->hostui_setup
;
307 if(!This
->doc_obj
->hostui
) {
308 IDocHostUIHandler
*uihandler
;
310 This
->doc_obj
->custom_hostui
= FALSE
;
312 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IDocHostUIHandler
, (void**)&uihandler
);
314 This
->doc_obj
->hostui
= uihandler
;
317 if(This
->doc_obj
->hostui
) {
318 DOCHOSTUIINFO hostinfo
;
319 LPOLESTR key_path
= NULL
, override_key_path
= NULL
;
320 IDocHostUIHandler2
*uihandler2
;
322 memset(&hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
323 hostinfo
.cbSize
= sizeof(DOCHOSTUIINFO
);
324 hres
= IDocHostUIHandler_GetHostInfo(This
->doc_obj
->hostui
, &hostinfo
);
325 if(SUCCEEDED(hres
)) {
326 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
327 hostinfo
.cbSize
, hostinfo
.dwFlags
, hostinfo
.dwDoubleClick
,
328 debugstr_w(hostinfo
.pchHostCss
), debugstr_w(hostinfo
.pchHostNS
));
329 update_hostinfo(This
->doc_obj
, &hostinfo
);
330 This
->doc_obj
->hostinfo
= hostinfo
;
334 hres
= IDocHostUIHandler_GetOptionKeyPath(This
->doc_obj
->hostui
, &key_path
, 0);
335 if(hres
== S_OK
&& key_path
) {
337 /* FIXME: use key_path */
338 FIXME("key_path = %s\n", debugstr_w(key_path
));
340 CoTaskMemFree(key_path
);
343 hres
= IDocHostUIHandler_QueryInterface(This
->doc_obj
->hostui
, &IID_IDocHostUIHandler2
,
344 (void**)&uihandler2
);
345 if(SUCCEEDED(hres
)) {
346 hres
= IDocHostUIHandler2_GetOverrideKeyPath(uihandler2
, &override_key_path
, 0);
347 if(hres
== S_OK
&& override_key_path
) {
348 if(override_key_path
[0]) {
349 /*FIXME: use override_key_path */
350 FIXME("override_key_path = %s\n", debugstr_w(override_key_path
));
352 CoTaskMemFree(override_key_path
);
354 IDocHostUIHandler2_Release(uihandler2
);
357 This
->doc_obj
->hostui_setup
= TRUE
;
361 load_settings(This
->doc_obj
);
363 /* Native calls here GetWindow. What is it for?
364 * We don't have anything to do with it here (yet). */
365 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleWindow
, (void**)&ole_window
);
366 if(SUCCEEDED(hres
)) {
367 IOleWindow_GetWindow(ole_window
, &hwnd
);
368 IOleWindow_Release(ole_window
);
371 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IShellBrowser
,
372 &IID_IBrowserService
, (void**)&browser_service
);
373 if(SUCCEEDED(hres
)) {
374 ITravelLog
*travel_log
;
376 This
->doc_obj
->browser_service
= (IUnknown
*)browser_service
;
378 hres
= IBrowserService_GetTravelLog(browser_service
, &travel_log
);
380 This
->doc_obj
->travel_log
= travel_log
;
382 browser_service
= NULL
;
385 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
386 if(SUCCEEDED(hres
)) {
388 OLECMD cmd
= {OLECMDID_SETPROGRESSTEXT
, 0};
390 This
->doc_obj
->client_cmdtrg
= cmdtrg
;
393 IDocObjectService
*doc_object_service
;
396 set_document_navigation(This
->doc_obj
, TRUE
);
398 if(browser_service
) {
399 hres
= IBrowserService_QueryInterface(browser_service
,
400 &IID_IDocObjectService
, (void**)&doc_object_service
);
401 if(SUCCEEDED(hres
)) {
402 This
->doc_obj
->doc_object_service
= doc_object_service
;
405 * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
406 * embedder supports IWebBrowserApp.
408 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IWebBrowserApp
, &IID_IWebBrowser2
, (void**)&wb
);
410 This
->doc_obj
->webbrowser
= (IUnknown
*)wb
;
415 call_docview_84(This
->doc_obj
);
417 IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 1, &cmd
, NULL
);
421 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
422 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
423 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
424 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
427 if(This
->doc_obj
->nscontainer
->usermode
== UNKNOWN_USERMODE
)
428 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERMODE
);
430 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
,
431 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
433 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_SILENT
, &silent
);
434 if(SUCCEEDED(hres
)) {
435 if(V_VT(&silent
) != VT_BOOL
)
436 WARN("silent = %s\n", debugstr_variant(&silent
));
437 else if(V_BOOL(&silent
))
438 FIXME("silent == true\n");
441 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERAGENT
);
442 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_PALETTE
);
447 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
449 HTMLDocument
*This
= impl_from_IOleObject(iface
);
451 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
456 if(This
->doc_obj
->client
)
457 IOleClientSite_AddRef(This
->doc_obj
->client
);
458 *ppClientSite
= This
->doc_obj
->client
;
463 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
465 HTMLDocument
*This
= impl_from_IOleObject(iface
);
466 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
470 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
472 HTMLDocument
*This
= impl_from_IOleObject(iface
);
474 TRACE("(%p)->(%08x)\n", This
, dwSaveOption
);
476 if(dwSaveOption
== OLECLOSE_PROMPTSAVE
)
477 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
479 if(This
->doc_obj
->in_place_active
)
480 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
482 HTMLDocument_LockContainer(This
->doc_obj
, FALSE
);
484 if(This
->doc_obj
->advise_holder
)
485 IOleAdviseHolder_SendOnClose(This
->doc_obj
->advise_holder
);
490 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
492 HTMLDocument
*This
= impl_from_IOleObject(iface
);
493 FIXME("(%p %d %p)->()\n", This
, dwWhichMoniker
, pmk
);
497 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
499 HTMLDocument
*This
= impl_from_IOleObject(iface
);
500 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
504 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
507 HTMLDocument
*This
= impl_from_IOleObject(iface
);
508 FIXME("(%p)->(%p %x %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
512 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
514 HTMLDocument
*This
= impl_from_IOleObject(iface
);
515 FIXME("(%p)->(%d %p)\n", This
, dwReserved
, ppDataObject
);
519 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
520 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
522 HTMLDocument
*This
= impl_from_IOleObject(iface
);
523 IOleDocumentSite
*pDocSite
;
526 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
, lprcPosRect
);
528 if(iVerb
!= OLEIVERB_SHOW
&& iVerb
!= OLEIVERB_UIACTIVATE
&& iVerb
!= OLEIVERB_INPLACEACTIVATE
) {
529 FIXME("iVerb = %d not supported\n", iVerb
);
534 pActiveSite
= This
->doc_obj
->client
;
536 hres
= IOleClientSite_QueryInterface(pActiveSite
, &IID_IOleDocumentSite
, (void**)&pDocSite
);
537 if(SUCCEEDED(hres
)) {
538 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
540 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
541 hres
= IOleDocumentSite_ActivateMe(pDocSite
, &This
->doc_obj
->IOleDocumentView_iface
);
542 IOleDocumentSite_Release(pDocSite
);
544 hres
= IOleDocumentView_UIActivate(&This
->doc_obj
->IOleDocumentView_iface
, TRUE
);
545 if(SUCCEEDED(hres
)) {
547 RECT rect
; /* We need to pass rect as not const pointer */
549 IOleDocumentView_SetRect(&This
->doc_obj
->IOleDocumentView_iface
, &rect
);
551 IOleDocumentView_Show(&This
->doc_obj
->IOleDocumentView_iface
, TRUE
);
558 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
560 HTMLDocument
*This
= impl_from_IOleObject(iface
);
561 FIXME("(%p)->(%p)\n", This
, ppEnumOleVerb
);
565 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
567 HTMLDocument
*This
= impl_from_IOleObject(iface
);
568 FIXME("(%p)\n", This
);
572 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
574 HTMLDocument
*This
= impl_from_IOleObject(iface
);
575 FIXME("(%p)\n", This
);
579 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
581 HTMLDocument
*This
= impl_from_IOleObject(iface
);
583 TRACE("(%p)->(%p)\n", This
, pClsid
);
588 *pClsid
= CLSID_HTMLDocument
;
592 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
594 HTMLDocument
*This
= impl_from_IOleObject(iface
);
595 FIXME("(%p)->(%d %p)\n", This
, dwFormOfType
, pszUserType
);
599 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
601 HTMLDocument
*This
= impl_from_IOleObject(iface
);
603 TRACE("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
605 if (dwDrawAspect
!= DVASPECT_CONTENT
)
608 This
->doc_obj
->extent
= *psizel
;
612 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
614 HTMLDocument
*This
= impl_from_IOleObject(iface
);
616 TRACE("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
618 if (dwDrawAspect
!= DVASPECT_CONTENT
)
621 *psizel
= This
->doc_obj
->extent
;
625 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
627 HTMLDocument
*This
= impl_from_IOleObject(iface
);
628 TRACE("(%p)->(%p %p)\n", This
, pAdvSink
, pdwConnection
);
638 if(!This
->doc_obj
->advise_holder
) {
639 CreateOleAdviseHolder(&This
->doc_obj
->advise_holder
);
640 if(!This
->doc_obj
->advise_holder
)
641 return E_OUTOFMEMORY
;
644 return IOleAdviseHolder_Advise(This
->doc_obj
->advise_holder
, pAdvSink
, pdwConnection
);
647 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
649 HTMLDocument
*This
= impl_from_IOleObject(iface
);
650 TRACE("(%p)->(%d)\n", This
, dwConnection
);
652 if(!This
->doc_obj
->advise_holder
)
653 return OLE_E_NOCONNECTION
;
655 return IOleAdviseHolder_Unadvise(This
->doc_obj
->advise_holder
, dwConnection
);
658 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
660 HTMLDocument
*This
= impl_from_IOleObject(iface
);
662 if(!This
->doc_obj
->advise_holder
) {
663 *ppenumAdvise
= NULL
;
667 return IOleAdviseHolder_EnumAdvise(This
->doc_obj
->advise_holder
, ppenumAdvise
);
670 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
672 HTMLDocument
*This
= impl_from_IOleObject(iface
);
673 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pdwStatus
);
677 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
679 HTMLDocument
*This
= impl_from_IOleObject(iface
);
680 FIXME("(%p)->(%p)\n", This
, pLogpal
);
684 static const IOleObjectVtbl OleObjectVtbl
= {
685 OleObject_QueryInterface
,
688 OleObject_SetClientSite
,
689 OleObject_GetClientSite
,
690 OleObject_SetHostNames
,
692 OleObject_SetMoniker
,
693 OleObject_GetMoniker
,
694 OleObject_InitFromData
,
695 OleObject_GetClipboardData
,
699 OleObject_IsUpToDate
,
700 OleObject_GetUserClassID
,
701 OleObject_GetUserType
,
706 OleObject_EnumAdvise
,
707 OleObject_GetMiscStatus
,
708 OleObject_SetColorScheme
711 /**********************************************************
712 * IOleDocument implementation
715 static inline HTMLDocument
*impl_from_IOleDocument(IOleDocument
*iface
)
717 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleDocument_iface
);
720 static HRESULT WINAPI
OleDocument_QueryInterface(IOleDocument
*iface
, REFIID riid
, void **ppv
)
722 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
723 return htmldoc_query_interface(This
, riid
, ppv
);
726 static ULONG WINAPI
OleDocument_AddRef(IOleDocument
*iface
)
728 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
729 return htmldoc_addref(This
);
732 static ULONG WINAPI
OleDocument_Release(IOleDocument
*iface
)
734 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
735 return htmldoc_release(This
);
738 static HRESULT WINAPI
OleDocument_CreateView(IOleDocument
*iface
, IOleInPlaceSite
*pIPSite
, IStream
*pstm
,
739 DWORD dwReserved
, IOleDocumentView
**ppView
)
741 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
744 TRACE("(%p)->(%p %p %d %p)\n", This
, pIPSite
, pstm
, dwReserved
, ppView
);
750 * Windows implementation creates new IOleDocumentView when function is called for the
751 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
752 * if the application uses returned interfaces, passed to ActivateMe or returned by
753 * QueryInterface, so there is no reason to create new interface. This needs more testing.
757 hres
= IOleDocumentView_SetInPlaceSite(&This
->doc_obj
->IOleDocumentView_iface
, pIPSite
);
763 FIXME("pstm is not supported\n");
765 IOleDocumentView_AddRef(&This
->doc_obj
->IOleDocumentView_iface
);
766 *ppView
= &This
->doc_obj
->IOleDocumentView_iface
;
770 static HRESULT WINAPI
OleDocument_GetDocMiscStatus(IOleDocument
*iface
, DWORD
*pdwStatus
)
772 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
773 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
777 static HRESULT WINAPI
OleDocument_EnumViews(IOleDocument
*iface
, IEnumOleDocumentViews
**ppEnum
,
778 IOleDocumentView
**ppView
)
780 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
781 FIXME("(%p)->(%p %p)\n", This
, ppEnum
, ppView
);
785 static const IOleDocumentVtbl OleDocumentVtbl
= {
786 OleDocument_QueryInterface
,
789 OleDocument_CreateView
,
790 OleDocument_GetDocMiscStatus
,
791 OleDocument_EnumViews
794 /**********************************************************
795 * IOleControl implementation
798 static inline HTMLDocument
*impl_from_IOleControl(IOleControl
*iface
)
800 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleControl_iface
);
803 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
805 HTMLDocument
*This
= impl_from_IOleControl(iface
);
806 return htmldoc_query_interface(This
, riid
, ppv
);
809 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
811 HTMLDocument
*This
= impl_from_IOleControl(iface
);
812 return htmldoc_addref(This
);
815 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
817 HTMLDocument
*This
= impl_from_IOleControl(iface
);
818 return htmldoc_release(This
);
821 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
823 HTMLDocument
*This
= impl_from_IOleControl(iface
);
824 FIXME("(%p)->(%p)\n", This
, pCI
);
828 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*pMsg
)
830 HTMLDocument
*This
= impl_from_IOleControl(iface
);
831 FIXME("(%p)->(%p)\n", This
, pMsg
);
835 HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
837 IDispatch
*disp
= NULL
;
838 DISPPARAMS dispparams
= {NULL
, 0};
842 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
844 TRACE("Could not get IDispatch\n");
850 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
851 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, &err
);
853 IDispatch_Release(disp
);
858 static HRESULT
on_change_dlcontrol(HTMLDocument
*This
)
863 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_DLCONTROL
, &res
);
865 FIXME("unsupported dlcontrol %08x\n", V_I4(&res
));
870 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
872 HTMLDocument
*This
= impl_from_IOleControl(iface
);
873 IOleClientSite
*client
;
877 client
= This
->doc_obj
->client
;
879 TRACE("client = NULL\n");
884 case DISPID_AMBIENT_USERMODE
:
885 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This
);
886 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERMODE
, &res
);
890 if(V_VT(&res
) == VT_BOOL
) {
892 This
->doc_obj
->nscontainer
->usermode
= BROWSEMODE
;
894 FIXME("edit mode is not supported\n");
895 This
->doc_obj
->nscontainer
->usermode
= EDITMODE
;
898 FIXME("usermode=%s\n", debugstr_variant(&res
));
901 case DISPID_AMBIENT_DLCONTROL
:
902 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This
);
903 return on_change_dlcontrol(This
);
904 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
905 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This
);
906 on_change_dlcontrol(This
);
907 hres
= get_client_disp_property(client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &res
);
911 if(V_VT(&res
) == VT_BOOL
) {
913 FIXME("offline connection is not supported\n");
917 FIXME("offlineconnected=%s\n", debugstr_variant(&res
));
920 case DISPID_AMBIENT_SILENT
:
921 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This
);
922 on_change_dlcontrol(This
);
923 hres
= get_client_disp_property(client
, DISPID_AMBIENT_SILENT
, &res
);
927 if(V_VT(&res
) == VT_BOOL
) {
929 FIXME("silent mode is not supported\n");
932 FIXME("silent=%s\n", debugstr_variant(&res
));
935 case DISPID_AMBIENT_USERAGENT
:
936 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This
);
937 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERAGENT
, &res
);
941 FIXME("not supported AMBIENT_USERAGENT\n");
943 case DISPID_AMBIENT_PALETTE
:
944 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This
);
945 hres
= get_client_disp_property(client
, DISPID_AMBIENT_PALETTE
, &res
);
949 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 const RECT
*pos
, const RECT
*clip
)
1176 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1179 TRACE("(%p)->(%s %s)\n", This
, wine_dbgstr_rect(pos
), wine_dbgstr_rect(clip
));
1181 if(clip
&& !EqualRect(clip
, pos
))
1182 FIXME("Ignoring clip rect %s\n", wine_dbgstr_rect(clip
));
1185 return IOleDocumentView_SetRect(&This
->doc_obj
->IOleDocumentView_iface
, &r
);
1188 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
1190 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1191 FIXME("(%p)\n", This
);
1195 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
1196 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
1198 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1199 FIXME("(%p)->(%u %lu %lu %p)\n", This
, msg
, wParam
, lParam
, lpResult
);
1203 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
1204 IDropTarget
**ppDropTarget
)
1206 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1207 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
1211 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
1212 OleInPlaceObjectWindowless_QueryInterface
,
1213 OleInPlaceObjectWindowless_AddRef
,
1214 OleInPlaceObjectWindowless_Release
,
1215 OleInPlaceObjectWindowless_GetWindow
,
1216 OleInPlaceObjectWindowless_ContextSensitiveHelp
,
1217 OleInPlaceObjectWindowless_InPlaceDeactivate
,
1218 OleInPlaceObjectWindowless_UIDeactivate
,
1219 OleInPlaceObjectWindowless_SetObjectRects
,
1220 OleInPlaceObjectWindowless_ReactivateAndUndo
,
1221 OleInPlaceObjectWindowless_OnWindowMessage
,
1222 OleInPlaceObjectWindowless_GetDropTarget
1225 /**********************************************************
1226 * IObjectWithSite implementation
1229 static inline HTMLDocument
*impl_from_IObjectWithSite(IObjectWithSite
*iface
)
1231 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectWithSite_iface
);
1234 static HRESULT WINAPI
ObjectWithSite_QueryInterface(IObjectWithSite
*iface
, REFIID riid
, void **ppv
)
1236 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1237 return htmldoc_query_interface(This
, riid
, ppv
);
1240 static ULONG WINAPI
ObjectWithSite_AddRef(IObjectWithSite
*iface
)
1242 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1243 return htmldoc_addref(This
);
1246 static ULONG WINAPI
ObjectWithSite_Release(IObjectWithSite
*iface
)
1248 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1249 return htmldoc_release(This
);
1252 static HRESULT WINAPI
ObjectWithSite_SetSite(IObjectWithSite
*iface
, IUnknown
*pUnkSite
)
1254 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1255 FIXME("(%p)->(%p)\n", This
, pUnkSite
);
1259 static HRESULT WINAPI
ObjectWithSite_GetSite(IObjectWithSite
* iface
, REFIID riid
, PVOID
*ppvSite
)
1261 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1262 FIXME("(%p)->(%p)\n", This
, ppvSite
);
1266 static const IObjectWithSiteVtbl ObjectWithSiteVtbl
= {
1267 ObjectWithSite_QueryInterface
,
1268 ObjectWithSite_AddRef
,
1269 ObjectWithSite_Release
,
1270 ObjectWithSite_SetSite
,
1271 ObjectWithSite_GetSite
1274 /**********************************************************
1275 * IOleContainer implementation
1278 static inline HTMLDocument
*impl_from_IOleContainer(IOleContainer
*iface
)
1280 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleContainer_iface
);
1283 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1285 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1286 return htmldoc_query_interface(This
, riid
, ppv
);
1289 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1291 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1292 return htmldoc_addref(This
);
1295 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1297 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1298 return htmldoc_release(This
);
1301 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
, LPOLESTR pszDisplayName
,
1302 ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1304 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1305 FIXME("(%p)->(%p %s %p %p)\n", This
, pbc
, debugstr_w(pszDisplayName
), pchEaten
, ppmkOut
);
1309 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
, IEnumUnknown
**ppenum
)
1311 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1314 TRACE("(%p)->(%x %p)\n", This
, grfFlags
, ppenum
);
1316 ret
= heap_alloc(sizeof(*ret
));
1318 return E_OUTOFMEMORY
;
1320 ret
->IEnumUnknown_iface
.lpVtbl
= &EnumUnknownVtbl
;
1323 *ppenum
= &ret
->IEnumUnknown_iface
;
1327 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1329 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1330 FIXME("(%p)->(%x)\n", This
, fLock
);
1334 static const IOleContainerVtbl OleContainerVtbl
= {
1335 OleContainer_QueryInterface
,
1336 OleContainer_AddRef
,
1337 OleContainer_Release
,
1338 OleContainer_ParseDisplayName
,
1339 OleContainer_EnumObjects
,
1340 OleContainer_LockContainer
1343 static inline HTMLDocumentObj
*impl_from_ITargetContainer(ITargetContainer
*iface
)
1345 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ITargetContainer_iface
);
1348 static HRESULT WINAPI
TargetContainer_QueryInterface(ITargetContainer
*iface
, REFIID riid
, void **ppv
)
1350 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1351 return ICustomDoc_QueryInterface(&This
->ICustomDoc_iface
, riid
, ppv
);
1354 static ULONG WINAPI
TargetContainer_AddRef(ITargetContainer
*iface
)
1356 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1357 return ICustomDoc_AddRef(&This
->ICustomDoc_iface
);
1360 static ULONG WINAPI
TargetContainer_Release(ITargetContainer
*iface
)
1362 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1363 return ICustomDoc_Release(&This
->ICustomDoc_iface
);
1366 static HRESULT WINAPI
TargetContainer_GetFrameUrl(ITargetContainer
*iface
, LPWSTR
*ppszFrameSrc
)
1368 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1369 FIXME("(%p)->(%p)\n", This
, ppszFrameSrc
);
1373 static HRESULT WINAPI
TargetContainer_GetFramesContainer(ITargetContainer
*iface
, IOleContainer
**ppContainer
)
1375 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1377 TRACE("(%p)->(%p)\n", This
, ppContainer
);
1379 /* NOTE: we should return wrapped interface here */
1380 IOleContainer_AddRef(&This
->basedoc
.IOleContainer_iface
);
1381 *ppContainer
= &This
->basedoc
.IOleContainer_iface
;
1385 static const ITargetContainerVtbl TargetContainerVtbl
= {
1386 TargetContainer_QueryInterface
,
1387 TargetContainer_AddRef
,
1388 TargetContainer_Release
,
1389 TargetContainer_GetFrameUrl
,
1390 TargetContainer_GetFramesContainer
1393 void TargetContainer_Init(HTMLDocumentObj
*This
)
1395 This
->ITargetContainer_iface
.lpVtbl
= &TargetContainerVtbl
;
1398 /**********************************************************
1399 * IObjectSafety implementation
1402 static inline HTMLDocument
*impl_from_IObjectSafety(IObjectSafety
*iface
)
1404 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectSafety_iface
);
1407 static HRESULT WINAPI
ObjectSafety_QueryInterface(IObjectSafety
*iface
, REFIID riid
, void **ppv
)
1409 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1410 return htmldoc_query_interface(This
, riid
, ppv
);
1413 static ULONG WINAPI
ObjectSafety_AddRef(IObjectSafety
*iface
)
1415 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1416 return htmldoc_addref(This
);
1419 static ULONG WINAPI
ObjectSafety_Release(IObjectSafety
*iface
)
1421 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1422 return htmldoc_release(This
);
1425 static HRESULT WINAPI
ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety
*iface
,
1426 REFIID riid
, DWORD
*pdwSupportedOptions
, DWORD
*pdwEnabledOptions
)
1428 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1429 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_guid(riid
), pdwSupportedOptions
, pdwEnabledOptions
);
1433 static HRESULT WINAPI
ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety
*iface
,
1434 REFIID riid
, DWORD dwOptionSetMask
, DWORD dwEnabledOptions
)
1436 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1437 FIXME("(%p)->(%s %x %x)\n", This
, debugstr_guid(riid
), dwOptionSetMask
, dwEnabledOptions
);
1439 if(IsEqualGUID(&IID_IPersistMoniker
, riid
) &&
1440 dwOptionSetMask
==INTERFACESAFE_FOR_UNTRUSTED_DATA
&&
1441 dwEnabledOptions
==INTERFACESAFE_FOR_UNTRUSTED_DATA
)
1447 static const IObjectSafetyVtbl ObjectSafetyVtbl
= {
1448 ObjectSafety_QueryInterface
,
1449 ObjectSafety_AddRef
,
1450 ObjectSafety_Release
,
1451 ObjectSafety_GetInterfaceSafetyOptions
,
1452 ObjectSafety_SetInterfaceSafetyOptions
1455 void HTMLDocument_LockContainer(HTMLDocumentObj
*This
, BOOL fLock
)
1457 IOleContainer
*container
;
1460 if(!This
->client
|| This
->container_locked
== fLock
)
1463 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
1464 if(SUCCEEDED(hres
)) {
1465 IOleContainer_LockContainer(container
, fLock
);
1466 This
->container_locked
= fLock
;
1467 IOleContainer_Release(container
);
1471 void HTMLDocument_OleObj_Init(HTMLDocument
*This
)
1473 This
->IOleObject_iface
.lpVtbl
= &OleObjectVtbl
;
1474 This
->IOleDocument_iface
.lpVtbl
= &OleDocumentVtbl
;
1475 This
->IOleControl_iface
.lpVtbl
= &OleControlVtbl
;
1476 This
->IOleInPlaceActiveObject_iface
.lpVtbl
= &OleInPlaceActiveObjectVtbl
;
1477 This
->IOleInPlaceObjectWindowless_iface
.lpVtbl
= &OleInPlaceObjectWindowlessVtbl
;
1478 This
->IObjectWithSite_iface
.lpVtbl
= &ObjectWithSiteVtbl
;
1479 This
->IOleContainer_iface
.lpVtbl
= &OleContainerVtbl
;
1480 This
->IObjectSafety_iface
.lpVtbl
= &ObjectSafetyVtbl
;
1481 This
->doc_obj
->extent
.cx
= 1;
1482 This
->doc_obj
->extent
.cy
= 1;