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
29 #include "shdeprecated.h"
33 #include "wine/debug.h"
35 #include "mshtml_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
39 #define DOCHOST_DOCCANNAVIGATE 0
42 IEnumUnknown IEnumUnknown_iface
;
46 static inline EnumUnknown
*impl_from_IEnumUnknown(IEnumUnknown
*iface
)
48 return CONTAINING_RECORD(iface
, EnumUnknown
, IEnumUnknown_iface
);
51 static HRESULT WINAPI
EnumUnknown_QueryInterface(IEnumUnknown
*iface
, REFIID riid
, void **ppv
)
53 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
55 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
56 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
57 *ppv
= &This
->IEnumUnknown_iface
;
58 }else if(IsEqualGUID(&IID_IEnumUnknown
, riid
)) {
59 TRACE("(%p)->(IID_IEnumUnknown %p)\n", This
, ppv
);
60 *ppv
= &This
->IEnumUnknown_iface
;
62 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
67 IUnknown_AddRef((IUnknown
*)*ppv
);
71 static ULONG WINAPI
EnumUnknown_AddRef(IEnumUnknown
*iface
)
73 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
74 LONG ref
= InterlockedIncrement(&This
->ref
);
76 TRACE("(%p) ref=%d\n", This
, ref
);
81 static ULONG WINAPI
EnumUnknown_Release(IEnumUnknown
*iface
)
83 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
84 LONG ref
= InterlockedDecrement(&This
->ref
);
86 TRACE("(%p) ref=%d\n", This
, ref
);
94 static HRESULT WINAPI
EnumUnknown_Next(IEnumUnknown
*iface
, ULONG celt
, IUnknown
**rgelt
, ULONG
*pceltFetched
)
96 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
98 TRACE("(%p)->(%u %p %p)\n", This
, celt
, rgelt
, pceltFetched
);
100 /* FIXME: It's not clear if we should ever return something here */
106 static HRESULT WINAPI
EnumUnknown_Skip(IEnumUnknown
*iface
, ULONG celt
)
108 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
109 FIXME("(%p)->(%u)\n", This
, celt
);
113 static HRESULT WINAPI
EnumUnknown_Reset(IEnumUnknown
*iface
)
115 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
116 FIXME("(%p)\n", This
);
120 static HRESULT WINAPI
EnumUnknown_Clone(IEnumUnknown
*iface
, IEnumUnknown
**ppenum
)
122 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
123 FIXME("(%p)->(%p)\n", This
, ppenum
);
127 static const IEnumUnknownVtbl EnumUnknownVtbl
= {
128 EnumUnknown_QueryInterface
,
137 /**********************************************************
138 * IOleObject implementation
141 static inline HTMLDocument
*impl_from_IOleObject(IOleObject
*iface
)
143 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleObject_iface
);
146 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
148 HTMLDocument
*This
= impl_from_IOleObject(iface
);
149 return htmldoc_query_interface(This
, riid
, ppv
);
152 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
154 HTMLDocument
*This
= impl_from_IOleObject(iface
);
155 return htmldoc_addref(This
);
158 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
160 HTMLDocument
*This
= impl_from_IOleObject(iface
);
161 return htmldoc_release(This
);
164 static void update_hostinfo(HTMLDocumentObj
*This
, DOCHOSTUIINFO
*hostinfo
)
166 nsIScrollable
*scrollable
;
169 if(!This
->nscontainer
)
172 nsres
= nsIWebBrowser_QueryInterface(This
->nscontainer
->webbrowser
, &IID_nsIScrollable
, (void**)&scrollable
);
173 if(NS_SUCCEEDED(nsres
)) {
174 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_Y
,
175 (hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
) ? Scrollbar_Never
: Scrollbar_Always
);
177 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres
);
179 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_X
,
180 hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
? Scrollbar_Never
: Scrollbar_Auto
);
182 ERR("Could not set default X scrollbar prefs: %08x\n", nsres
);
184 nsIScrollable_Release(scrollable
);
186 ERR("Could not get nsIScrollable: %08x\n", nsres
);
190 /* Calls undocumented 84 cmd of CGID_ShellDocView */
191 void call_docview_84(HTMLDocumentObj
*doc
)
193 IOleCommandTarget
*olecmd
;
200 hres
= IOleClientSite_QueryInterface(doc
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
205 hres
= IOleCommandTarget_Exec(olecmd
, &CGID_ShellDocView
, 84, 0, NULL
, &var
);
206 IOleCommandTarget_Release(olecmd
);
207 if(SUCCEEDED(hres
) && V_VT(&var
) != VT_NULL
)
208 FIXME("handle result\n");
211 void set_document_navigation(HTMLDocumentObj
*doc
, BOOL doc_can_navigate
)
215 if(!doc
->client_cmdtrg
)
218 if(doc_can_navigate
) {
219 V_VT(&var
) = VT_UNKNOWN
;
220 V_UNKNOWN(&var
) = (IUnknown
*)&doc
->basedoc
.window
->base
.IHTMLWindow2_iface
;
223 IOleCommandTarget_Exec(doc
->client_cmdtrg
, &CGID_DocHostCmdPriv
, DOCHOST_DOCCANNAVIGATE
, 0,
224 doc_can_navigate
? &var
: NULL
, NULL
);
227 static void load_settings(HTMLDocumentObj
*doc
)
233 res
= RegOpenKeyW(HKEY_CURRENT_USER
, L
"SOFTWARE\\Microsoft\\Internet Explorer", &settings_key
);
234 if(res
!= ERROR_SUCCESS
)
238 res
= RegGetValueW(settings_key
, L
"Zoom", L
"ZoomFactor", RRF_RT_REG_DWORD
, NULL
, &val
, &size
);
239 RegCloseKey(settings_key
);
240 if(res
== ERROR_SUCCESS
)
241 set_viewer_zoom(doc
->nscontainer
, (float)val
/100000);
244 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, IOleClientSite
*pClientSite
)
246 HTMLDocument
*This
= impl_from_IOleObject(iface
);
247 IOleCommandTarget
*cmdtrg
= NULL
;
248 IOleWindow
*ole_window
;
249 IBrowserService
*browser_service
;
255 TRACE("(%p)->(%p)\n", This
, pClientSite
);
257 if(pClientSite
== This
->doc_obj
->client
)
260 if(This
->doc_obj
->client
) {
261 IOleClientSite_Release(This
->doc_obj
->client
);
262 This
->doc_obj
->client
= NULL
;
263 This
->doc_obj
->nscontainer
->usermode
= UNKNOWN_USERMODE
;
266 if(This
->doc_obj
->client_cmdtrg
) {
267 IOleCommandTarget_Release(This
->doc_obj
->client_cmdtrg
);
268 This
->doc_obj
->client_cmdtrg
= NULL
;
271 if(This
->doc_obj
->hostui
&& !This
->doc_obj
->custom_hostui
) {
272 IDocHostUIHandler_Release(This
->doc_obj
->hostui
);
273 This
->doc_obj
->hostui
= NULL
;
276 if(This
->doc_obj
->doc_object_service
) {
277 IDocObjectService_Release(This
->doc_obj
->doc_object_service
);
278 This
->doc_obj
->doc_object_service
= NULL
;
281 if(This
->doc_obj
->webbrowser
) {
282 IUnknown_Release(This
->doc_obj
->webbrowser
);
283 This
->doc_obj
->webbrowser
= NULL
;
286 if(This
->doc_obj
->browser_service
) {
287 IUnknown_Release(This
->doc_obj
->browser_service
);
288 This
->doc_obj
->browser_service
= NULL
;
291 if(This
->doc_obj
->travel_log
) {
292 ITravelLog_Release(This
->doc_obj
->travel_log
);
293 This
->doc_obj
->travel_log
= NULL
;
296 memset(&This
->doc_obj
->hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
301 IOleClientSite_AddRef(pClientSite
);
302 This
->doc_obj
->client
= pClientSite
;
304 hostui_setup
= This
->doc_obj
->hostui_setup
;
306 if(!This
->doc_obj
->hostui
) {
307 IDocHostUIHandler
*uihandler
;
309 This
->doc_obj
->custom_hostui
= FALSE
;
311 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IDocHostUIHandler
, (void**)&uihandler
);
313 This
->doc_obj
->hostui
= uihandler
;
316 if(This
->doc_obj
->hostui
) {
317 DOCHOSTUIINFO hostinfo
;
318 LPOLESTR key_path
= NULL
, override_key_path
= NULL
;
319 IDocHostUIHandler2
*uihandler2
;
321 memset(&hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
322 hostinfo
.cbSize
= sizeof(DOCHOSTUIINFO
);
323 hres
= IDocHostUIHandler_GetHostInfo(This
->doc_obj
->hostui
, &hostinfo
);
324 if(SUCCEEDED(hres
)) {
325 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
326 hostinfo
.cbSize
, hostinfo
.dwFlags
, hostinfo
.dwDoubleClick
,
327 debugstr_w(hostinfo
.pchHostCss
), debugstr_w(hostinfo
.pchHostNS
));
328 update_hostinfo(This
->doc_obj
, &hostinfo
);
329 This
->doc_obj
->hostinfo
= hostinfo
;
333 hres
= IDocHostUIHandler_GetOptionKeyPath(This
->doc_obj
->hostui
, &key_path
, 0);
334 if(hres
== S_OK
&& key_path
) {
336 /* FIXME: use key_path */
337 FIXME("key_path = %s\n", debugstr_w(key_path
));
339 CoTaskMemFree(key_path
);
342 hres
= IDocHostUIHandler_QueryInterface(This
->doc_obj
->hostui
, &IID_IDocHostUIHandler2
,
343 (void**)&uihandler2
);
344 if(SUCCEEDED(hres
)) {
345 hres
= IDocHostUIHandler2_GetOverrideKeyPath(uihandler2
, &override_key_path
, 0);
346 if(hres
== S_OK
&& override_key_path
) {
347 if(override_key_path
[0]) {
348 /*FIXME: use override_key_path */
349 FIXME("override_key_path = %s\n", debugstr_w(override_key_path
));
351 CoTaskMemFree(override_key_path
);
353 IDocHostUIHandler2_Release(uihandler2
);
356 This
->doc_obj
->hostui_setup
= TRUE
;
360 load_settings(This
->doc_obj
);
362 /* Native calls here GetWindow. What is it for?
363 * We don't have anything to do with it here (yet). */
364 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleWindow
, (void**)&ole_window
);
365 if(SUCCEEDED(hres
)) {
366 IOleWindow_GetWindow(ole_window
, &hwnd
);
367 IOleWindow_Release(ole_window
);
370 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IShellBrowser
,
371 &IID_IBrowserService
, (void**)&browser_service
);
372 if(SUCCEEDED(hres
)) {
373 ITravelLog
*travel_log
;
375 This
->doc_obj
->browser_service
= (IUnknown
*)browser_service
;
377 hres
= IBrowserService_GetTravelLog(browser_service
, &travel_log
);
379 This
->doc_obj
->travel_log
= travel_log
;
381 browser_service
= NULL
;
384 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
385 if(SUCCEEDED(hres
)) {
387 OLECMD cmd
= {OLECMDID_SETPROGRESSTEXT
, 0};
389 This
->doc_obj
->client_cmdtrg
= cmdtrg
;
392 IDocObjectService
*doc_object_service
;
395 set_document_navigation(This
->doc_obj
, TRUE
);
397 if(browser_service
) {
398 hres
= IBrowserService_QueryInterface(browser_service
,
399 &IID_IDocObjectService
, (void**)&doc_object_service
);
400 if(SUCCEEDED(hres
)) {
401 This
->doc_obj
->doc_object_service
= doc_object_service
;
404 * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
405 * embedder supports IWebBrowserApp.
407 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IWebBrowserApp
, &IID_IWebBrowser2
, (void**)&wb
);
409 This
->doc_obj
->webbrowser
= (IUnknown
*)wb
;
414 call_docview_84(This
->doc_obj
);
416 IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 1, &cmd
, NULL
);
420 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
421 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
422 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
423 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
426 if(This
->doc_obj
->nscontainer
->usermode
== UNKNOWN_USERMODE
)
427 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERMODE
);
429 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
,
430 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
432 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_SILENT
, &silent
);
433 if(SUCCEEDED(hres
)) {
434 if(V_VT(&silent
) != VT_BOOL
)
435 WARN("silent = %s\n", debugstr_variant(&silent
));
436 else if(V_BOOL(&silent
))
437 FIXME("silent == true\n");
440 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERAGENT
);
441 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_PALETTE
);
446 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
448 HTMLDocument
*This
= impl_from_IOleObject(iface
);
450 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
455 if(This
->doc_obj
->client
)
456 IOleClientSite_AddRef(This
->doc_obj
->client
);
457 *ppClientSite
= This
->doc_obj
->client
;
462 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
464 HTMLDocument
*This
= impl_from_IOleObject(iface
);
465 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
469 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
471 HTMLDocument
*This
= impl_from_IOleObject(iface
);
473 TRACE("(%p)->(%08x)\n", This
, dwSaveOption
);
475 if(dwSaveOption
== OLECLOSE_PROMPTSAVE
)
476 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
478 if(This
->doc_obj
->in_place_active
)
479 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
481 HTMLDocument_LockContainer(This
->doc_obj
, FALSE
);
483 if(This
->doc_obj
->advise_holder
)
484 IOleAdviseHolder_SendOnClose(This
->doc_obj
->advise_holder
);
489 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
491 HTMLDocument
*This
= impl_from_IOleObject(iface
);
492 FIXME("(%p %d %p)->()\n", This
, dwWhichMoniker
, pmk
);
496 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
498 HTMLDocument
*This
= impl_from_IOleObject(iface
);
499 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
503 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
506 HTMLDocument
*This
= impl_from_IOleObject(iface
);
507 FIXME("(%p)->(%p %x %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
511 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
513 HTMLDocument
*This
= impl_from_IOleObject(iface
);
514 FIXME("(%p)->(%d %p)\n", This
, dwReserved
, ppDataObject
);
518 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
519 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
521 HTMLDocument
*This
= impl_from_IOleObject(iface
);
522 IOleDocumentSite
*pDocSite
;
525 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
, lprcPosRect
);
527 if(iVerb
!= OLEIVERB_SHOW
&& iVerb
!= OLEIVERB_UIACTIVATE
&& iVerb
!= OLEIVERB_INPLACEACTIVATE
) {
528 FIXME("iVerb = %d not supported\n", iVerb
);
533 pActiveSite
= This
->doc_obj
->client
;
535 hres
= IOleClientSite_QueryInterface(pActiveSite
, &IID_IOleDocumentSite
, (void**)&pDocSite
);
536 if(SUCCEEDED(hres
)) {
537 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
539 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
540 hres
= IOleDocumentSite_ActivateMe(pDocSite
, &This
->doc_obj
->IOleDocumentView_iface
);
541 IOleDocumentSite_Release(pDocSite
);
543 hres
= IOleDocumentView_UIActivate(&This
->doc_obj
->IOleDocumentView_iface
, TRUE
);
544 if(SUCCEEDED(hres
)) {
546 RECT rect
; /* We need to pass rect as not const pointer */
548 IOleDocumentView_SetRect(&This
->doc_obj
->IOleDocumentView_iface
, &rect
);
550 IOleDocumentView_Show(&This
->doc_obj
->IOleDocumentView_iface
, TRUE
);
557 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
559 HTMLDocument
*This
= impl_from_IOleObject(iface
);
560 FIXME("(%p)->(%p)\n", This
, ppEnumOleVerb
);
564 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
566 HTMLDocument
*This
= impl_from_IOleObject(iface
);
567 FIXME("(%p)\n", This
);
571 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
573 HTMLDocument
*This
= impl_from_IOleObject(iface
);
574 FIXME("(%p)\n", This
);
578 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
580 HTMLDocument
*This
= impl_from_IOleObject(iface
);
582 TRACE("(%p)->(%p)\n", This
, pClsid
);
587 *pClsid
= CLSID_HTMLDocument
;
591 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
593 HTMLDocument
*This
= impl_from_IOleObject(iface
);
594 FIXME("(%p)->(%d %p)\n", This
, dwFormOfType
, pszUserType
);
598 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
600 HTMLDocument
*This
= impl_from_IOleObject(iface
);
602 TRACE("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
604 if (dwDrawAspect
!= DVASPECT_CONTENT
)
607 This
->doc_obj
->extent
= *psizel
;
611 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
613 HTMLDocument
*This
= impl_from_IOleObject(iface
);
615 TRACE("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
617 if (dwDrawAspect
!= DVASPECT_CONTENT
)
620 *psizel
= This
->doc_obj
->extent
;
624 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
626 HTMLDocument
*This
= impl_from_IOleObject(iface
);
627 TRACE("(%p)->(%p %p)\n", This
, pAdvSink
, pdwConnection
);
637 if(!This
->doc_obj
->advise_holder
) {
638 CreateOleAdviseHolder(&This
->doc_obj
->advise_holder
);
639 if(!This
->doc_obj
->advise_holder
)
640 return E_OUTOFMEMORY
;
643 return IOleAdviseHolder_Advise(This
->doc_obj
->advise_holder
, pAdvSink
, pdwConnection
);
646 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
648 HTMLDocument
*This
= impl_from_IOleObject(iface
);
649 TRACE("(%p)->(%d)\n", This
, dwConnection
);
651 if(!This
->doc_obj
->advise_holder
)
652 return OLE_E_NOCONNECTION
;
654 return IOleAdviseHolder_Unadvise(This
->doc_obj
->advise_holder
, dwConnection
);
657 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
659 HTMLDocument
*This
= impl_from_IOleObject(iface
);
661 if(!This
->doc_obj
->advise_holder
) {
662 *ppenumAdvise
= NULL
;
666 return IOleAdviseHolder_EnumAdvise(This
->doc_obj
->advise_holder
, ppenumAdvise
);
669 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
671 HTMLDocument
*This
= impl_from_IOleObject(iface
);
672 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pdwStatus
);
676 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
678 HTMLDocument
*This
= impl_from_IOleObject(iface
);
679 FIXME("(%p)->(%p)\n", This
, pLogpal
);
683 static const IOleObjectVtbl OleObjectVtbl
= {
684 OleObject_QueryInterface
,
687 OleObject_SetClientSite
,
688 OleObject_GetClientSite
,
689 OleObject_SetHostNames
,
691 OleObject_SetMoniker
,
692 OleObject_GetMoniker
,
693 OleObject_InitFromData
,
694 OleObject_GetClipboardData
,
698 OleObject_IsUpToDate
,
699 OleObject_GetUserClassID
,
700 OleObject_GetUserType
,
705 OleObject_EnumAdvise
,
706 OleObject_GetMiscStatus
,
707 OleObject_SetColorScheme
710 /**********************************************************
711 * IOleDocument implementation
714 static inline HTMLDocument
*impl_from_IOleDocument(IOleDocument
*iface
)
716 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleDocument_iface
);
719 static HRESULT WINAPI
OleDocument_QueryInterface(IOleDocument
*iface
, REFIID riid
, void **ppv
)
721 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
722 return htmldoc_query_interface(This
, riid
, ppv
);
725 static ULONG WINAPI
OleDocument_AddRef(IOleDocument
*iface
)
727 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
728 return htmldoc_addref(This
);
731 static ULONG WINAPI
OleDocument_Release(IOleDocument
*iface
)
733 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
734 return htmldoc_release(This
);
737 static HRESULT WINAPI
OleDocument_CreateView(IOleDocument
*iface
, IOleInPlaceSite
*pIPSite
, IStream
*pstm
,
738 DWORD dwReserved
, IOleDocumentView
**ppView
)
740 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
743 TRACE("(%p)->(%p %p %d %p)\n", This
, pIPSite
, pstm
, dwReserved
, ppView
);
749 * Windows implementation creates new IOleDocumentView when function is called for the
750 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
751 * if the application uses returned interfaces, passed to ActivateMe or returned by
752 * QueryInterface, so there is no reason to create new interface. This needs more testing.
756 hres
= IOleDocumentView_SetInPlaceSite(&This
->doc_obj
->IOleDocumentView_iface
, pIPSite
);
762 FIXME("pstm is not supported\n");
764 IOleDocumentView_AddRef(&This
->doc_obj
->IOleDocumentView_iface
);
765 *ppView
= &This
->doc_obj
->IOleDocumentView_iface
;
769 static HRESULT WINAPI
OleDocument_GetDocMiscStatus(IOleDocument
*iface
, DWORD
*pdwStatus
)
771 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
772 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
776 static HRESULT WINAPI
OleDocument_EnumViews(IOleDocument
*iface
, IEnumOleDocumentViews
**ppEnum
,
777 IOleDocumentView
**ppView
)
779 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
780 FIXME("(%p)->(%p %p)\n", This
, ppEnum
, ppView
);
784 static const IOleDocumentVtbl OleDocumentVtbl
= {
785 OleDocument_QueryInterface
,
788 OleDocument_CreateView
,
789 OleDocument_GetDocMiscStatus
,
790 OleDocument_EnumViews
793 /**********************************************************
794 * IOleControl implementation
797 static inline HTMLDocument
*impl_from_IOleControl(IOleControl
*iface
)
799 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleControl_iface
);
802 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
804 HTMLDocument
*This
= impl_from_IOleControl(iface
);
805 return htmldoc_query_interface(This
, riid
, ppv
);
808 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
810 HTMLDocument
*This
= impl_from_IOleControl(iface
);
811 return htmldoc_addref(This
);
814 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
816 HTMLDocument
*This
= impl_from_IOleControl(iface
);
817 return htmldoc_release(This
);
820 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
822 HTMLDocument
*This
= impl_from_IOleControl(iface
);
823 FIXME("(%p)->(%p)\n", This
, pCI
);
827 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*pMsg
)
829 HTMLDocument
*This
= impl_from_IOleControl(iface
);
830 FIXME("(%p)->(%p)\n", This
, pMsg
);
834 HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
836 IDispatch
*disp
= NULL
;
837 DISPPARAMS dispparams
= {NULL
, 0};
841 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
843 TRACE("Could not get IDispatch\n");
849 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
850 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, &err
);
852 IDispatch_Release(disp
);
857 static HRESULT
on_change_dlcontrol(HTMLDocument
*This
)
862 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_DLCONTROL
, &res
);
864 FIXME("unsupported dlcontrol %08x\n", V_I4(&res
));
869 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
871 HTMLDocument
*This
= impl_from_IOleControl(iface
);
872 IOleClientSite
*client
;
876 client
= This
->doc_obj
->client
;
878 TRACE("client = NULL\n");
883 case DISPID_AMBIENT_USERMODE
:
884 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This
);
885 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERMODE
, &res
);
889 if(V_VT(&res
) == VT_BOOL
) {
891 This
->doc_obj
->nscontainer
->usermode
= BROWSEMODE
;
893 FIXME("edit mode is not supported\n");
894 This
->doc_obj
->nscontainer
->usermode
= EDITMODE
;
897 FIXME("usermode=%s\n", debugstr_variant(&res
));
900 case DISPID_AMBIENT_DLCONTROL
:
901 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This
);
902 return on_change_dlcontrol(This
);
903 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
904 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This
);
905 on_change_dlcontrol(This
);
906 hres
= get_client_disp_property(client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &res
);
910 if(V_VT(&res
) == VT_BOOL
) {
912 FIXME("offline connection is not supported\n");
916 FIXME("offlineconnected=%s\n", debugstr_variant(&res
));
919 case DISPID_AMBIENT_SILENT
:
920 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This
);
921 on_change_dlcontrol(This
);
922 hres
= get_client_disp_property(client
, DISPID_AMBIENT_SILENT
, &res
);
926 if(V_VT(&res
) == VT_BOOL
) {
928 FIXME("silent mode is not supported\n");
931 FIXME("silent=%s\n", debugstr_variant(&res
));
934 case DISPID_AMBIENT_USERAGENT
:
935 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This
);
936 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERAGENT
, &res
);
940 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");
952 FIXME("(%p) unsupported dispID=%d\n", This
, dispID
);
956 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
958 HTMLDocument
*This
= impl_from_IOleControl(iface
);
959 FIXME("(%p)->(%x)\n", This
, bFreeze
);
963 static const IOleControlVtbl OleControlVtbl
= {
964 OleControl_QueryInterface
,
967 OleControl_GetControlInfo
,
968 OleControl_OnMnemonic
,
969 OleControl_OnAmbientPropertyChange
,
970 OleControl_FreezeEvents
973 /**********************************************************
974 * IOleInPlaceActiveObject implementation
977 static inline HTMLDocument
*impl_from_IOleInPlaceActiveObject(IOleInPlaceActiveObject
*iface
)
979 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleInPlaceActiveObject_iface
);
982 static HRESULT WINAPI
OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
*iface
, REFIID riid
, void **ppv
)
984 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
985 return htmldoc_query_interface(This
, riid
, ppv
);
988 static ULONG WINAPI
OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject
*iface
)
990 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
991 return htmldoc_addref(This
);
994 static ULONG WINAPI
OleInPlaceActiveObject_Release(IOleInPlaceActiveObject
*iface
)
996 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
997 return htmldoc_release(This
);
1000 static HRESULT WINAPI
OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject
*iface
, HWND
*phwnd
)
1002 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1004 TRACE("(%p)->(%p)\n", This
, phwnd
);
1007 return E_INVALIDARG
;
1009 if(!This
->doc_obj
->in_place_active
) {
1014 *phwnd
= This
->doc_obj
->hwnd
;
1018 static HRESULT WINAPI
OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
, BOOL fEnterMode
)
1020 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1021 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
1025 static HRESULT WINAPI
OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
, LPMSG lpmsg
)
1027 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1028 FIXME("(%p)->(%p)\n", This
, lpmsg
);
1032 static HRESULT WINAPI
OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
1035 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1037 TRACE("(%p)->(%x)\n", This
, fActivate
);
1039 if(This
->doc_obj
->hostui
)
1040 IDocHostUIHandler_OnFrameWindowActivate(This
->doc_obj
->hostui
, fActivate
);
1045 static HRESULT WINAPI
OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
, BOOL fActivate
)
1047 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1048 FIXME("(%p)->(%x)\n", This
, fActivate
);
1052 static HRESULT WINAPI
OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
, LPCRECT prcBorder
,
1053 IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
1055 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1056 FIXME("(%p)->(%p %p %x)\n", This
, prcBorder
, pUIWindow
, fFrameWindow
);
1060 static HRESULT WINAPI
OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
, BOOL fEnable
)
1062 HTMLDocument
*This
= impl_from_IOleInPlaceActiveObject(iface
);
1063 FIXME("(%p)->(%x)\n", This
, fEnable
);
1067 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
1068 OleInPlaceActiveObject_QueryInterface
,
1069 OleInPlaceActiveObject_AddRef
,
1070 OleInPlaceActiveObject_Release
,
1071 OleInPlaceActiveObject_GetWindow
,
1072 OleInPlaceActiveObject_ContextSensitiveHelp
,
1073 OleInPlaceActiveObject_TranslateAccelerator
,
1074 OleInPlaceActiveObject_OnFrameWindowActivate
,
1075 OleInPlaceActiveObject_OnDocWindowActivate
,
1076 OleInPlaceActiveObject_ResizeBorder
,
1077 OleInPlaceActiveObject_EnableModeless
1080 /**********************************************************
1081 * IOleInPlaceObjectWindowless implementation
1084 static inline HTMLDocument
*impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless
*iface
)
1086 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleInPlaceObjectWindowless_iface
);
1089 static HRESULT WINAPI
OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless
*iface
,
1090 REFIID riid
, void **ppv
)
1092 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1093 return htmldoc_query_interface(This
, riid
, ppv
);
1096 static ULONG WINAPI
OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless
*iface
)
1098 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1099 return htmldoc_addref(This
);
1102 static ULONG WINAPI
OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless
*iface
)
1104 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1105 return htmldoc_release(This
);
1108 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless
*iface
,
1111 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1112 return IOleInPlaceActiveObject_GetWindow(&This
->IOleInPlaceActiveObject_iface
, phwnd
);
1115 static HRESULT WINAPI
OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
1118 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1119 return IOleInPlaceActiveObject_ContextSensitiveHelp(&This
->IOleInPlaceActiveObject_iface
, fEnterMode
);
1122 static HRESULT WINAPI
OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless
*iface
)
1124 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1126 TRACE("(%p)\n", This
);
1128 if(This
->doc_obj
->ui_active
)
1129 IOleDocumentView_UIActivate(&This
->doc_obj
->IOleDocumentView_iface
, FALSE
);
1130 This
->doc_obj
->window_active
= FALSE
;
1132 if(!This
->doc_obj
->in_place_active
)
1135 if(This
->doc_obj
->frame
) {
1136 IOleInPlaceFrame_Release(This
->doc_obj
->frame
);
1137 This
->doc_obj
->frame
= NULL
;
1140 if(This
->doc_obj
->hwnd
) {
1141 ShowWindow(This
->doc_obj
->hwnd
, SW_HIDE
);
1142 SetWindowPos(This
->doc_obj
->hwnd
, HWND_TOPMOST
, 0, 0, 0, 0, SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
);
1145 This
->doc_obj
->focus
= FALSE
;
1146 notif_focus(This
->doc_obj
);
1148 This
->doc_obj
->in_place_active
= FALSE
;
1149 if(This
->doc_obj
->ipsite
) {
1150 IOleInPlaceSiteEx
*ipsiteex
;
1153 hres
= IOleInPlaceSite_QueryInterface(This
->doc_obj
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
1154 if(SUCCEEDED(hres
)) {
1155 IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex
, TRUE
);
1156 IOleInPlaceSiteEx_Release(ipsiteex
);
1158 IOleInPlaceSite_OnInPlaceDeactivate(This
->doc_obj
->ipsite
);
1165 static HRESULT WINAPI
OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
1167 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1168 FIXME("(%p)\n", This
);
1172 static HRESULT WINAPI
OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless
*iface
,
1173 const RECT
*pos
, const RECT
*clip
)
1175 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1178 TRACE("(%p)->(%s %s)\n", This
, wine_dbgstr_rect(pos
), wine_dbgstr_rect(clip
));
1180 if(clip
&& !EqualRect(clip
, pos
))
1181 FIXME("Ignoring clip rect %s\n", wine_dbgstr_rect(clip
));
1184 return IOleDocumentView_SetRect(&This
->doc_obj
->IOleDocumentView_iface
, &r
);
1187 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
1189 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1190 FIXME("(%p)\n", This
);
1194 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
1195 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
1197 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1198 FIXME("(%p)->(%u %lu %lu %p)\n", This
, msg
, wParam
, lParam
, lpResult
);
1202 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
1203 IDropTarget
**ppDropTarget
)
1205 HTMLDocument
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
1206 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
1210 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
1211 OleInPlaceObjectWindowless_QueryInterface
,
1212 OleInPlaceObjectWindowless_AddRef
,
1213 OleInPlaceObjectWindowless_Release
,
1214 OleInPlaceObjectWindowless_GetWindow
,
1215 OleInPlaceObjectWindowless_ContextSensitiveHelp
,
1216 OleInPlaceObjectWindowless_InPlaceDeactivate
,
1217 OleInPlaceObjectWindowless_UIDeactivate
,
1218 OleInPlaceObjectWindowless_SetObjectRects
,
1219 OleInPlaceObjectWindowless_ReactivateAndUndo
,
1220 OleInPlaceObjectWindowless_OnWindowMessage
,
1221 OleInPlaceObjectWindowless_GetDropTarget
1224 /**********************************************************
1225 * IObjectWithSite implementation
1228 static inline HTMLDocument
*impl_from_IObjectWithSite(IObjectWithSite
*iface
)
1230 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectWithSite_iface
);
1233 static HRESULT WINAPI
ObjectWithSite_QueryInterface(IObjectWithSite
*iface
, REFIID riid
, void **ppv
)
1235 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1236 return htmldoc_query_interface(This
, riid
, ppv
);
1239 static ULONG WINAPI
ObjectWithSite_AddRef(IObjectWithSite
*iface
)
1241 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1242 return htmldoc_addref(This
);
1245 static ULONG WINAPI
ObjectWithSite_Release(IObjectWithSite
*iface
)
1247 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1248 return htmldoc_release(This
);
1251 static HRESULT WINAPI
ObjectWithSite_SetSite(IObjectWithSite
*iface
, IUnknown
*pUnkSite
)
1253 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1254 FIXME("(%p)->(%p)\n", This
, pUnkSite
);
1258 static HRESULT WINAPI
ObjectWithSite_GetSite(IObjectWithSite
* iface
, REFIID riid
, PVOID
*ppvSite
)
1260 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
1261 FIXME("(%p)->(%p)\n", This
, ppvSite
);
1265 static const IObjectWithSiteVtbl ObjectWithSiteVtbl
= {
1266 ObjectWithSite_QueryInterface
,
1267 ObjectWithSite_AddRef
,
1268 ObjectWithSite_Release
,
1269 ObjectWithSite_SetSite
,
1270 ObjectWithSite_GetSite
1273 /**********************************************************
1274 * IOleContainer implementation
1277 static inline HTMLDocument
*impl_from_IOleContainer(IOleContainer
*iface
)
1279 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleContainer_iface
);
1282 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
1284 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1285 return htmldoc_query_interface(This
, riid
, ppv
);
1288 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1290 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1291 return htmldoc_addref(This
);
1294 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1296 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1297 return htmldoc_release(This
);
1300 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
, LPOLESTR pszDisplayName
,
1301 ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1303 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1304 FIXME("(%p)->(%p %s %p %p)\n", This
, pbc
, debugstr_w(pszDisplayName
), pchEaten
, ppmkOut
);
1308 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
, IEnumUnknown
**ppenum
)
1310 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1313 TRACE("(%p)->(%x %p)\n", This
, grfFlags
, ppenum
);
1315 ret
= heap_alloc(sizeof(*ret
));
1317 return E_OUTOFMEMORY
;
1319 ret
->IEnumUnknown_iface
.lpVtbl
= &EnumUnknownVtbl
;
1322 *ppenum
= &ret
->IEnumUnknown_iface
;
1326 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1328 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1329 FIXME("(%p)->(%x)\n", This
, fLock
);
1333 static const IOleContainerVtbl OleContainerVtbl
= {
1334 OleContainer_QueryInterface
,
1335 OleContainer_AddRef
,
1336 OleContainer_Release
,
1337 OleContainer_ParseDisplayName
,
1338 OleContainer_EnumObjects
,
1339 OleContainer_LockContainer
1342 static inline HTMLDocumentObj
*impl_from_ITargetContainer(ITargetContainer
*iface
)
1344 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ITargetContainer_iface
);
1347 static HRESULT WINAPI
TargetContainer_QueryInterface(ITargetContainer
*iface
, REFIID riid
, void **ppv
)
1349 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1350 return ICustomDoc_QueryInterface(&This
->ICustomDoc_iface
, riid
, ppv
);
1353 static ULONG WINAPI
TargetContainer_AddRef(ITargetContainer
*iface
)
1355 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1356 return ICustomDoc_AddRef(&This
->ICustomDoc_iface
);
1359 static ULONG WINAPI
TargetContainer_Release(ITargetContainer
*iface
)
1361 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1362 return ICustomDoc_Release(&This
->ICustomDoc_iface
);
1365 static HRESULT WINAPI
TargetContainer_GetFrameUrl(ITargetContainer
*iface
, LPWSTR
*ppszFrameSrc
)
1367 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1368 FIXME("(%p)->(%p)\n", This
, ppszFrameSrc
);
1372 static HRESULT WINAPI
TargetContainer_GetFramesContainer(ITargetContainer
*iface
, IOleContainer
**ppContainer
)
1374 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1376 TRACE("(%p)->(%p)\n", This
, ppContainer
);
1378 /* NOTE: we should return wrapped interface here */
1379 IOleContainer_AddRef(&This
->basedoc
.IOleContainer_iface
);
1380 *ppContainer
= &This
->basedoc
.IOleContainer_iface
;
1384 static const ITargetContainerVtbl TargetContainerVtbl
= {
1385 TargetContainer_QueryInterface
,
1386 TargetContainer_AddRef
,
1387 TargetContainer_Release
,
1388 TargetContainer_GetFrameUrl
,
1389 TargetContainer_GetFramesContainer
1392 void TargetContainer_Init(HTMLDocumentObj
*This
)
1394 This
->ITargetContainer_iface
.lpVtbl
= &TargetContainerVtbl
;
1397 /**********************************************************
1398 * IObjectSafety implementation
1401 static inline HTMLDocument
*impl_from_IObjectSafety(IObjectSafety
*iface
)
1403 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectSafety_iface
);
1406 static HRESULT WINAPI
ObjectSafety_QueryInterface(IObjectSafety
*iface
, REFIID riid
, void **ppv
)
1408 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1409 return htmldoc_query_interface(This
, riid
, ppv
);
1412 static ULONG WINAPI
ObjectSafety_AddRef(IObjectSafety
*iface
)
1414 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1415 return htmldoc_addref(This
);
1418 static ULONG WINAPI
ObjectSafety_Release(IObjectSafety
*iface
)
1420 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1421 return htmldoc_release(This
);
1424 static HRESULT WINAPI
ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety
*iface
,
1425 REFIID riid
, DWORD
*pdwSupportedOptions
, DWORD
*pdwEnabledOptions
)
1427 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1428 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_guid(riid
), pdwSupportedOptions
, pdwEnabledOptions
);
1432 static HRESULT WINAPI
ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety
*iface
,
1433 REFIID riid
, DWORD dwOptionSetMask
, DWORD dwEnabledOptions
)
1435 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1436 FIXME("(%p)->(%s %x %x)\n", This
, debugstr_guid(riid
), dwOptionSetMask
, dwEnabledOptions
);
1438 if(IsEqualGUID(&IID_IPersistMoniker
, riid
) &&
1439 dwOptionSetMask
==INTERFACESAFE_FOR_UNTRUSTED_DATA
&&
1440 dwEnabledOptions
==INTERFACESAFE_FOR_UNTRUSTED_DATA
)
1446 static const IObjectSafetyVtbl ObjectSafetyVtbl
= {
1447 ObjectSafety_QueryInterface
,
1448 ObjectSafety_AddRef
,
1449 ObjectSafety_Release
,
1450 ObjectSafety_GetInterfaceSafetyOptions
,
1451 ObjectSafety_SetInterfaceSafetyOptions
1454 void HTMLDocument_LockContainer(HTMLDocumentObj
*This
, BOOL fLock
)
1456 IOleContainer
*container
;
1459 if(!This
->client
|| This
->container_locked
== fLock
)
1462 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
1463 if(SUCCEEDED(hres
)) {
1464 IOleContainer_LockContainer(container
, fLock
);
1465 This
->container_locked
= fLock
;
1466 IOleContainer_Release(container
);
1470 void HTMLDocument_OleObj_Init(HTMLDocument
*This
)
1472 This
->IOleObject_iface
.lpVtbl
= &OleObjectVtbl
;
1473 This
->IOleDocument_iface
.lpVtbl
= &OleDocumentVtbl
;
1474 This
->IOleControl_iface
.lpVtbl
= &OleControlVtbl
;
1475 This
->IOleInPlaceActiveObject_iface
.lpVtbl
= &OleInPlaceActiveObjectVtbl
;
1476 This
->IOleInPlaceObjectWindowless_iface
.lpVtbl
= &OleInPlaceObjectWindowlessVtbl
;
1477 This
->IObjectWithSite_iface
.lpVtbl
= &ObjectWithSiteVtbl
;
1478 This
->IOleContainer_iface
.lpVtbl
= &OleContainerVtbl
;
1479 This
->IObjectSafety_iface
.lpVtbl
= &ObjectSafetyVtbl
;
1480 This
->doc_obj
->extent
.cx
= 1;
1481 This
->doc_obj
->extent
.cy
= 1;