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
19 #define WIN32_NO_STATUS
31 //#include "winuser.h"
34 #include <shdeprecated.h>
38 #include <wine/debug.h>
40 #include "mshtml_private.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
44 #define DOCHOST_DOCCANNAVIGATE 0
47 IEnumUnknown IEnumUnknown_iface
;
51 static inline EnumUnknown
*impl_from_IEnumUnknown(IEnumUnknown
*iface
)
53 return CONTAINING_RECORD(iface
, EnumUnknown
, IEnumUnknown_iface
);
56 static HRESULT WINAPI
EnumUnknown_QueryInterface(IEnumUnknown
*iface
, REFIID riid
, void **ppv
)
58 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
60 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
61 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
62 *ppv
= &This
->IEnumUnknown_iface
;
63 }else if(IsEqualGUID(&IID_IEnumUnknown
, riid
)) {
64 TRACE("(%p)->(IID_IEnumUnknown %p)\n", This
, ppv
);
65 *ppv
= &This
->IEnumUnknown_iface
;
67 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
72 IUnknown_AddRef((IUnknown
*)*ppv
);
76 static ULONG WINAPI
EnumUnknown_AddRef(IEnumUnknown
*iface
)
78 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
79 LONG ref
= InterlockedIncrement(&This
->ref
);
81 TRACE("(%p) ref=%d\n", This
, ref
);
86 static ULONG WINAPI
EnumUnknown_Release(IEnumUnknown
*iface
)
88 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
89 LONG ref
= InterlockedDecrement(&This
->ref
);
91 TRACE("(%p) ref=%d\n", This
, ref
);
99 static HRESULT WINAPI
EnumUnknown_Next(IEnumUnknown
*iface
, ULONG celt
, IUnknown
**rgelt
, ULONG
*pceltFetched
)
101 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
103 TRACE("(%p)->(%u %p %p)\n", This
, celt
, rgelt
, pceltFetched
);
105 /* FIXME: It's not clear if we should ever return something here */
111 static HRESULT WINAPI
EnumUnknown_Skip(IEnumUnknown
*iface
, ULONG celt
)
113 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
114 FIXME("(%p)->(%u)\n", This
, celt
);
118 static HRESULT WINAPI
EnumUnknown_Reset(IEnumUnknown
*iface
)
120 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
121 FIXME("(%p)\n", This
);
125 static HRESULT WINAPI
EnumUnknown_Clone(IEnumUnknown
*iface
, IEnumUnknown
**ppenum
)
127 EnumUnknown
*This
= impl_from_IEnumUnknown(iface
);
128 FIXME("(%p)->(%p)\n", This
, ppenum
);
132 static const IEnumUnknownVtbl EnumUnknownVtbl
= {
133 EnumUnknown_QueryInterface
,
142 /**********************************************************
143 * IOleObject implementation
146 static inline HTMLDocument
*impl_from_IOleObject(IOleObject
*iface
)
148 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleObject_iface
);
151 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
153 HTMLDocument
*This
= impl_from_IOleObject(iface
);
154 return htmldoc_query_interface(This
, riid
, ppv
);
157 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
159 HTMLDocument
*This
= impl_from_IOleObject(iface
);
160 return htmldoc_addref(This
);
163 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
165 HTMLDocument
*This
= impl_from_IOleObject(iface
);
166 return htmldoc_release(This
);
169 static void update_hostinfo(HTMLDocumentObj
*This
, DOCHOSTUIINFO
*hostinfo
)
171 nsIScrollable
*scrollable
;
174 if(!This
->nscontainer
)
177 nsres
= nsIWebBrowser_QueryInterface(This
->nscontainer
->webbrowser
, &IID_nsIScrollable
, (void**)&scrollable
);
178 if(NS_SUCCEEDED(nsres
)) {
179 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_Y
,
180 (hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
) ? Scrollbar_Never
: Scrollbar_Always
);
182 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres
);
184 nsres
= nsIScrollable_SetDefaultScrollbarPreferences(scrollable
, ScrollOrientation_X
,
185 hostinfo
->dwFlags
& DOCHOSTUIFLAG_SCROLL_NO
? Scrollbar_Never
: Scrollbar_Auto
);
187 ERR("Could not set default X scrollbar prefs: %08x\n", nsres
);
189 nsIScrollable_Release(scrollable
);
191 ERR("Could not get nsIScrollable: %08x\n", nsres
);
195 /* Calls undocumented 84 cmd of CGID_ShellDocView */
196 void call_docview_84(HTMLDocumentObj
*doc
)
198 IOleCommandTarget
*olecmd
;
205 hres
= IOleClientSite_QueryInterface(doc
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
210 hres
= IOleCommandTarget_Exec(olecmd
, &CGID_ShellDocView
, 84, 0, NULL
, &var
);
211 IOleCommandTarget_Release(olecmd
);
212 if(SUCCEEDED(hres
) && V_VT(&var
) != VT_NULL
)
213 FIXME("handle result\n");
216 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, IOleClientSite
*pClientSite
)
218 HTMLDocument
*This
= impl_from_IOleObject(iface
);
219 IOleCommandTarget
*cmdtrg
= NULL
;
220 IOleWindow
*ole_window
;
221 IBrowserService
*browser_service
;
227 TRACE("(%p)->(%p)\n", This
, pClientSite
);
229 if(pClientSite
== This
->doc_obj
->client
)
232 if(This
->doc_obj
->client
) {
233 IOleClientSite_Release(This
->doc_obj
->client
);
234 This
->doc_obj
->client
= NULL
;
235 This
->doc_obj
->usermode
= UNKNOWN_USERMODE
;
238 if(This
->doc_obj
->client_cmdtrg
) {
239 IOleCommandTarget_Release(This
->doc_obj
->client_cmdtrg
);
240 This
->doc_obj
->client_cmdtrg
= NULL
;
243 if(This
->doc_obj
->hostui
&& !This
->doc_obj
->custom_hostui
) {
244 IDocHostUIHandler_Release(This
->doc_obj
->hostui
);
245 This
->doc_obj
->hostui
= NULL
;
248 if(This
->doc_obj
->doc_object_service
) {
249 IDocObjectService_Release(This
->doc_obj
->doc_object_service
);
250 This
->doc_obj
->doc_object_service
= NULL
;
253 if(This
->doc_obj
->webbrowser
) {
254 IUnknown_Release(This
->doc_obj
->webbrowser
);
255 This
->doc_obj
->webbrowser
= NULL
;
258 if(This
->doc_obj
->browser_service
) {
259 IUnknown_Release(This
->doc_obj
->browser_service
);
260 This
->doc_obj
->browser_service
= NULL
;
263 if(This
->doc_obj
->travel_log
) {
264 ITravelLog_Release(This
->doc_obj
->travel_log
);
265 This
->doc_obj
->travel_log
= NULL
;
268 memset(&This
->doc_obj
->hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
273 IOleClientSite_AddRef(pClientSite
);
274 This
->doc_obj
->client
= pClientSite
;
276 hostui_setup
= This
->doc_obj
->hostui_setup
;
278 if(!This
->doc_obj
->hostui
) {
279 IDocHostUIHandler
*uihandler
;
281 This
->doc_obj
->custom_hostui
= FALSE
;
283 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IDocHostUIHandler
, (void**)&uihandler
);
285 This
->doc_obj
->hostui
= uihandler
;
288 if(This
->doc_obj
->hostui
) {
289 DOCHOSTUIINFO hostinfo
;
290 LPOLESTR key_path
= NULL
, override_key_path
= NULL
;
291 IDocHostUIHandler2
*uihandler2
;
293 memset(&hostinfo
, 0, sizeof(DOCHOSTUIINFO
));
294 hostinfo
.cbSize
= sizeof(DOCHOSTUIINFO
);
295 hres
= IDocHostUIHandler_GetHostInfo(This
->doc_obj
->hostui
, &hostinfo
);
296 if(SUCCEEDED(hres
)) {
297 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
298 hostinfo
.cbSize
, hostinfo
.dwFlags
, hostinfo
.dwDoubleClick
,
299 debugstr_w(hostinfo
.pchHostCss
), debugstr_w(hostinfo
.pchHostNS
));
300 update_hostinfo(This
->doc_obj
, &hostinfo
);
301 This
->doc_obj
->hostinfo
= hostinfo
;
305 hres
= IDocHostUIHandler_GetOptionKeyPath(This
->doc_obj
->hostui
, &key_path
, 0);
306 if(hres
== S_OK
&& key_path
) {
308 /* FIXME: use key_path */
309 TRACE("key_path = %s\n", debugstr_w(key_path
));
311 CoTaskMemFree(key_path
);
314 hres
= IDocHostUIHandler_QueryInterface(This
->doc_obj
->hostui
, &IID_IDocHostUIHandler2
,
315 (void**)&uihandler2
);
316 if(SUCCEEDED(hres
)) {
317 hres
= IDocHostUIHandler2_GetOverrideKeyPath(uihandler2
, &override_key_path
, 0);
318 if(hres
== S_OK
&& override_key_path
&& override_key_path
[0]) {
319 if(override_key_path
[0]) {
320 /*FIXME: use override_key_path */
321 TRACE("override_key_path = %s\n", debugstr_w(override_key_path
));
323 CoTaskMemFree(override_key_path
);
325 IDocHostUIHandler2_Release(uihandler2
);
328 This
->doc_obj
->hostui_setup
= TRUE
;
332 /* Native calls here GetWindow. What is it for?
333 * We don't have anything to do with it here (yet). */
334 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleWindow
, (void**)&ole_window
);
335 if(SUCCEEDED(hres
)) {
336 IOleWindow_GetWindow(ole_window
, &hwnd
);
337 IOleWindow_Release(ole_window
);
340 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IShellBrowser
,
341 &IID_IBrowserService
, (void**)&browser_service
);
342 if(SUCCEEDED(hres
)) {
343 ITravelLog
*travel_log
;
345 This
->doc_obj
->browser_service
= (IUnknown
*)browser_service
;
347 hres
= IBrowserService_GetTravelLog(browser_service
, &travel_log
);
349 This
->doc_obj
->travel_log
= travel_log
;
351 browser_service
= NULL
;
354 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
355 if(SUCCEEDED(hres
)) {
357 OLECMD cmd
= {OLECMDID_SETPROGRESSTEXT
, 0};
359 This
->doc_obj
->client_cmdtrg
= cmdtrg
;
362 IDocObjectService
*doc_object_service
;
365 V_VT(&var
) = VT_UNKNOWN
;
366 V_UNKNOWN(&var
) = (IUnknown
*)&This
->window
->base
.IHTMLWindow2_iface
;
367 IOleCommandTarget_Exec(cmdtrg
, &CGID_DocHostCmdPriv
, DOCHOST_DOCCANNAVIGATE
, 0, &var
, NULL
);
369 if(browser_service
) {
370 hres
= IBrowserService_QueryInterface(browser_service
,
371 &IID_IDocObjectService
, (void**)&doc_object_service
);
372 if(SUCCEEDED(hres
)) {
373 This
->doc_obj
->doc_object_service
= doc_object_service
;
376 * Some embedding routines, esp. in regards to use of IDocObjectService, differ if
377 * embedder supports IWebBrowserApp.
379 hres
= do_query_service((IUnknown
*)pClientSite
, &IID_IWebBrowserApp
, &IID_IWebBrowser2
, (void**)&wb
);
381 This
->doc_obj
->webbrowser
= (IUnknown
*)wb
;
386 call_docview_84(This
->doc_obj
);
388 IOleCommandTarget_QueryStatus(cmdtrg
, NULL
, 1, &cmd
, NULL
);
392 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
393 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
394 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
395 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
398 if(This
->doc_obj
->usermode
== UNKNOWN_USERMODE
)
399 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERMODE
);
401 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
,
402 DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
);
404 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_SILENT
, &silent
);
405 if(SUCCEEDED(hres
)) {
406 if(V_VT(&silent
) != VT_BOOL
)
407 WARN("silent = %s\n", debugstr_variant(&silent
));
408 else if(V_BOOL(&silent
))
409 FIXME("silent == true\n");
412 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_USERAGENT
);
413 IOleControl_OnAmbientPropertyChange(&This
->IOleControl_iface
, DISPID_AMBIENT_PALETTE
);
418 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
420 HTMLDocument
*This
= impl_from_IOleObject(iface
);
422 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
427 if(This
->doc_obj
->client
)
428 IOleClientSite_AddRef(This
->doc_obj
->client
);
429 *ppClientSite
= This
->doc_obj
->client
;
434 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
436 HTMLDocument
*This
= impl_from_IOleObject(iface
);
437 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
441 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
443 HTMLDocument
*This
= impl_from_IOleObject(iface
);
445 TRACE("(%p)->(%08x)\n", This
, dwSaveOption
);
447 if(dwSaveOption
== OLECLOSE_PROMPTSAVE
)
448 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
450 if(This
->doc_obj
->in_place_active
)
451 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
453 HTMLDocument_LockContainer(This
->doc_obj
, FALSE
);
455 if(This
->advise_holder
)
456 IOleAdviseHolder_SendOnClose(This
->advise_holder
);
461 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
463 HTMLDocument
*This
= impl_from_IOleObject(iface
);
464 FIXME("(%p %d %p)->()\n", This
, dwWhichMoniker
, pmk
);
468 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
470 HTMLDocument
*This
= impl_from_IOleObject(iface
);
471 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
475 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
478 HTMLDocument
*This
= impl_from_IOleObject(iface
);
479 FIXME("(%p)->(%p %x %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
483 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
485 HTMLDocument
*This
= impl_from_IOleObject(iface
);
486 FIXME("(%p)->(%d %p)\n", This
, dwReserved
, ppDataObject
);
490 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
491 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
493 HTMLDocument
*This
= impl_from_IOleObject(iface
);
494 IOleDocumentSite
*pDocSite
;
497 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
, lprcPosRect
);
499 if(iVerb
!= OLEIVERB_SHOW
&& iVerb
!= OLEIVERB_UIACTIVATE
&& iVerb
!= OLEIVERB_INPLACEACTIVATE
) {
500 FIXME("iVerb = %d not supported\n", iVerb
);
505 pActiveSite
= This
->doc_obj
->client
;
507 hres
= IOleClientSite_QueryInterface(pActiveSite
, &IID_IOleDocumentSite
, (void**)&pDocSite
);
508 if(SUCCEEDED(hres
)) {
509 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
511 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
512 hres
= IOleDocumentSite_ActivateMe(pDocSite
, &This
->IOleDocumentView_iface
);
513 IOleDocumentSite_Release(pDocSite
);
515 hres
= IOleDocumentView_UIActivate(&This
->IOleDocumentView_iface
, TRUE
);
516 if(SUCCEEDED(hres
)) {
518 RECT rect
; /* We need to pass rect as not const pointer */
520 IOleDocumentView_SetRect(&This
->IOleDocumentView_iface
, &rect
);
522 IOleDocumentView_Show(&This
->IOleDocumentView_iface
, TRUE
);
529 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
531 HTMLDocument
*This
= impl_from_IOleObject(iface
);
532 FIXME("(%p)->(%p)\n", This
, ppEnumOleVerb
);
536 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
538 HTMLDocument
*This
= impl_from_IOleObject(iface
);
539 FIXME("(%p)\n", This
);
543 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
545 HTMLDocument
*This
= impl_from_IOleObject(iface
);
546 FIXME("(%p)\n", This
);
550 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
552 HTMLDocument
*This
= impl_from_IOleObject(iface
);
554 TRACE("(%p)->(%p)\n", This
, pClsid
);
559 *pClsid
= CLSID_HTMLDocument
;
563 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
565 HTMLDocument
*This
= impl_from_IOleObject(iface
);
566 FIXME("(%p)->(%d %p)\n", This
, dwFormOfType
, pszUserType
);
570 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
572 HTMLDocument
*This
= impl_from_IOleObject(iface
);
573 FIXME("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
577 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
579 HTMLDocument
*This
= impl_from_IOleObject(iface
);
580 FIXME("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
584 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
586 HTMLDocument
*This
= impl_from_IOleObject(iface
);
587 TRACE("(%p)->(%p %p)\n", This
, pAdvSink
, pdwConnection
);
597 if(!This
->advise_holder
) {
598 CreateOleAdviseHolder(&This
->advise_holder
);
599 if(!This
->advise_holder
)
600 return E_OUTOFMEMORY
;
603 return IOleAdviseHolder_Advise(This
->advise_holder
, pAdvSink
, pdwConnection
);
606 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
608 HTMLDocument
*This
= impl_from_IOleObject(iface
);
609 TRACE("(%p)->(%d)\n", This
, dwConnection
);
611 if(!This
->advise_holder
)
612 return OLE_E_NOCONNECTION
;
614 return IOleAdviseHolder_Unadvise(This
->advise_holder
, dwConnection
);
617 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
619 HTMLDocument
*This
= impl_from_IOleObject(iface
);
621 if(!This
->advise_holder
) {
622 *ppenumAdvise
= NULL
;
626 return IOleAdviseHolder_EnumAdvise(This
->advise_holder
, ppenumAdvise
);
629 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
631 HTMLDocument
*This
= impl_from_IOleObject(iface
);
632 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pdwStatus
);
636 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
638 HTMLDocument
*This
= impl_from_IOleObject(iface
);
639 FIXME("(%p)->(%p)\n", This
, pLogpal
);
643 static const IOleObjectVtbl OleObjectVtbl
= {
644 OleObject_QueryInterface
,
647 OleObject_SetClientSite
,
648 OleObject_GetClientSite
,
649 OleObject_SetHostNames
,
651 OleObject_SetMoniker
,
652 OleObject_GetMoniker
,
653 OleObject_InitFromData
,
654 OleObject_GetClipboardData
,
658 OleObject_IsUpToDate
,
659 OleObject_GetUserClassID
,
660 OleObject_GetUserType
,
665 OleObject_EnumAdvise
,
666 OleObject_GetMiscStatus
,
667 OleObject_SetColorScheme
670 /**********************************************************
671 * IOleDocument implementation
674 static inline HTMLDocument
*impl_from_IOleDocument(IOleDocument
*iface
)
676 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleDocument_iface
);
679 static HRESULT WINAPI
OleDocument_QueryInterface(IOleDocument
*iface
, REFIID riid
, void **ppv
)
681 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
682 return htmldoc_query_interface(This
, riid
, ppv
);
685 static ULONG WINAPI
OleDocument_AddRef(IOleDocument
*iface
)
687 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
688 return htmldoc_addref(This
);
691 static ULONG WINAPI
OleDocument_Release(IOleDocument
*iface
)
693 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
694 return htmldoc_release(This
);
697 static HRESULT WINAPI
OleDocument_CreateView(IOleDocument
*iface
, IOleInPlaceSite
*pIPSite
, IStream
*pstm
,
698 DWORD dwReserved
, IOleDocumentView
**ppView
)
700 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
703 TRACE("(%p)->(%p %p %d %p)\n", This
, pIPSite
, pstm
, dwReserved
, ppView
);
709 * Windows implementation creates new IOleDocumentView when function is called for the
710 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
711 * if the application uses returned interfaces, passed to ActivateMe or returned by
712 * QueryInterface, so there is no reason to create new interface. This needs more testing.
716 hres
= IOleDocumentView_SetInPlaceSite(&This
->IOleDocumentView_iface
, pIPSite
);
722 FIXME("pstm is not supported\n");
724 IOleDocumentView_AddRef(&This
->IOleDocumentView_iface
);
725 *ppView
= &This
->IOleDocumentView_iface
;
729 static HRESULT WINAPI
OleDocument_GetDocMiscStatus(IOleDocument
*iface
, DWORD
*pdwStatus
)
731 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
732 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
736 static HRESULT WINAPI
OleDocument_EnumViews(IOleDocument
*iface
, IEnumOleDocumentViews
**ppEnum
,
737 IOleDocumentView
**ppView
)
739 HTMLDocument
*This
= impl_from_IOleDocument(iface
);
740 FIXME("(%p)->(%p %p)\n", This
, ppEnum
, ppView
);
744 static const IOleDocumentVtbl OleDocumentVtbl
= {
745 OleDocument_QueryInterface
,
748 OleDocument_CreateView
,
749 OleDocument_GetDocMiscStatus
,
750 OleDocument_EnumViews
753 /**********************************************************
754 * IOleControl implementation
757 static inline HTMLDocument
*impl_from_IOleControl(IOleControl
*iface
)
759 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleControl_iface
);
762 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
764 HTMLDocument
*This
= impl_from_IOleControl(iface
);
765 return htmldoc_query_interface(This
, riid
, ppv
);
768 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
770 HTMLDocument
*This
= impl_from_IOleControl(iface
);
771 return htmldoc_addref(This
);
774 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
776 HTMLDocument
*This
= impl_from_IOleControl(iface
);
777 return htmldoc_release(This
);
780 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
782 HTMLDocument
*This
= impl_from_IOleControl(iface
);
783 FIXME("(%p)->(%p)\n", This
, pCI
);
787 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*pMsg
)
789 HTMLDocument
*This
= impl_from_IOleControl(iface
);
790 FIXME("(%p)->(%p)\n", This
, pMsg
);
794 HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
796 IDispatch
*disp
= NULL
;
797 DISPPARAMS dispparams
= {NULL
, 0};
801 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
803 TRACE("Could not get IDispatch\n");
809 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
810 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, &err
);
812 IDispatch_Release(disp
);
817 static HRESULT
on_change_dlcontrol(HTMLDocument
*This
)
822 hres
= get_client_disp_property(This
->doc_obj
->client
, DISPID_AMBIENT_DLCONTROL
, &res
);
824 FIXME("unsupported dlcontrol %08x\n", V_I4(&res
));
829 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
831 HTMLDocument
*This
= impl_from_IOleControl(iface
);
832 IOleClientSite
*client
;
836 client
= This
->doc_obj
->client
;
838 TRACE("client = NULL\n");
843 case DISPID_AMBIENT_USERMODE
:
844 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This
);
845 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERMODE
, &res
);
849 if(V_VT(&res
) == VT_BOOL
) {
851 This
->doc_obj
->usermode
= BROWSEMODE
;
853 FIXME("edit mode is not supported\n");
854 This
->doc_obj
->usermode
= EDITMODE
;
857 FIXME("usermode=%s\n", debugstr_variant(&res
));
860 case DISPID_AMBIENT_DLCONTROL
:
861 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This
);
862 return on_change_dlcontrol(This
);
863 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
864 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This
);
865 on_change_dlcontrol(This
);
866 hres
= get_client_disp_property(client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &res
);
870 if(V_VT(&res
) == VT_BOOL
) {
872 FIXME("offline connection is not supported\n");
876 FIXME("offlineconnected=%s\n", debugstr_variant(&res
));
879 case DISPID_AMBIENT_SILENT
:
880 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This
);
881 on_change_dlcontrol(This
);
882 hres
= get_client_disp_property(client
, DISPID_AMBIENT_SILENT
, &res
);
886 if(V_VT(&res
) == VT_BOOL
) {
888 FIXME("silent mode is not supported\n");
892 FIXME("silent=%s\n", debugstr_variant(&res
));
895 case DISPID_AMBIENT_USERAGENT
:
896 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This
);
897 hres
= get_client_disp_property(client
, DISPID_AMBIENT_USERAGENT
, &res
);
901 FIXME("not supported AMBIENT_USERAGENT\n");
904 case DISPID_AMBIENT_PALETTE
:
905 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This
);
906 hres
= get_client_disp_property(client
, DISPID_AMBIENT_PALETTE
, &res
);
910 FIXME("not supported AMBIENT_PALETTE\n");
915 FIXME("(%p) unsupported dispID=%d\n", This
, dispID
);
919 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
921 HTMLDocument
*This
= impl_from_IOleControl(iface
);
922 FIXME("(%p)->(%x)\n", This
, bFreeze
);
926 static const IOleControlVtbl OleControlVtbl
= {
927 OleControl_QueryInterface
,
930 OleControl_GetControlInfo
,
931 OleControl_OnMnemonic
,
932 OleControl_OnAmbientPropertyChange
,
933 OleControl_FreezeEvents
936 /**********************************************************
937 * IObjectWithSite implementation
940 static inline HTMLDocument
*impl_from_IObjectWithSite(IObjectWithSite
*iface
)
942 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectWithSite_iface
);
945 static HRESULT WINAPI
ObjectWithSite_QueryInterface(IObjectWithSite
*iface
, REFIID riid
, void **ppv
)
947 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
948 return htmldoc_query_interface(This
, riid
, ppv
);
951 static ULONG WINAPI
ObjectWithSite_AddRef(IObjectWithSite
*iface
)
953 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
954 return htmldoc_addref(This
);
957 static ULONG WINAPI
ObjectWithSite_Release(IObjectWithSite
*iface
)
959 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
960 return htmldoc_release(This
);
963 static HRESULT WINAPI
ObjectWithSite_SetSite(IObjectWithSite
*iface
, IUnknown
*pUnkSite
)
965 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
966 FIXME("(%p)->(%p)\n", This
, pUnkSite
);
970 static HRESULT WINAPI
ObjectWithSite_GetSite(IObjectWithSite
* iface
, REFIID riid
, PVOID
*ppvSite
)
972 HTMLDocument
*This
= impl_from_IObjectWithSite(iface
);
973 FIXME("(%p)->(%p)\n", This
, ppvSite
);
977 static const IObjectWithSiteVtbl ObjectWithSiteVtbl
= {
978 ObjectWithSite_QueryInterface
,
979 ObjectWithSite_AddRef
,
980 ObjectWithSite_Release
,
981 ObjectWithSite_SetSite
,
982 ObjectWithSite_GetSite
985 /**********************************************************
986 * IOleContainer implementation
989 static inline HTMLDocument
*impl_from_IOleContainer(IOleContainer
*iface
)
991 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleContainer_iface
);
994 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
996 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
997 return htmldoc_query_interface(This
, riid
, ppv
);
1000 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
1002 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1003 return htmldoc_addref(This
);
1006 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
1008 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1009 return htmldoc_release(This
);
1012 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
, LPOLESTR pszDisplayName
,
1013 ULONG
*pchEaten
, IMoniker
**ppmkOut
)
1015 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1016 FIXME("(%p)->(%p %s %p %p)\n", This
, pbc
, debugstr_w(pszDisplayName
), pchEaten
, ppmkOut
);
1020 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
, IEnumUnknown
**ppenum
)
1022 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1025 TRACE("(%p)->(%x %p)\n", This
, grfFlags
, ppenum
);
1027 ret
= heap_alloc(sizeof(*ret
));
1029 return E_OUTOFMEMORY
;
1031 ret
->IEnumUnknown_iface
.lpVtbl
= &EnumUnknownVtbl
;
1034 *ppenum
= &ret
->IEnumUnknown_iface
;
1038 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
1040 HTMLDocument
*This
= impl_from_IOleContainer(iface
);
1041 FIXME("(%p)->(%x)\n", This
, fLock
);
1045 static const IOleContainerVtbl OleContainerVtbl
= {
1046 OleContainer_QueryInterface
,
1047 OleContainer_AddRef
,
1048 OleContainer_Release
,
1049 OleContainer_ParseDisplayName
,
1050 OleContainer_EnumObjects
,
1051 OleContainer_LockContainer
1054 static inline HTMLDocumentObj
*impl_from_ITargetContainer(ITargetContainer
*iface
)
1056 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, ITargetContainer_iface
);
1059 static HRESULT WINAPI
TargetContainer_QueryInterface(ITargetContainer
*iface
, REFIID riid
, void **ppv
)
1061 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1062 return ICustomDoc_QueryInterface(&This
->ICustomDoc_iface
, riid
, ppv
);
1065 static ULONG WINAPI
TargetContainer_AddRef(ITargetContainer
*iface
)
1067 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1068 return ICustomDoc_AddRef(&This
->ICustomDoc_iface
);
1071 static ULONG WINAPI
TargetContainer_Release(ITargetContainer
*iface
)
1073 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1074 return ICustomDoc_Release(&This
->ICustomDoc_iface
);
1077 static HRESULT WINAPI
TargetContainer_GetFrameUrl(ITargetContainer
*iface
, LPWSTR
*ppszFrameSrc
)
1079 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1080 FIXME("(%p)->(%p)\n", This
, ppszFrameSrc
);
1084 static HRESULT WINAPI
TargetContainer_GetFramesContainer(ITargetContainer
*iface
, IOleContainer
**ppContainer
)
1086 HTMLDocumentObj
*This
= impl_from_ITargetContainer(iface
);
1088 TRACE("(%p)->(%p)\n", This
, ppContainer
);
1090 /* NOTE: we should return wrapped interface here */
1091 IOleContainer_AddRef(&This
->basedoc
.IOleContainer_iface
);
1092 *ppContainer
= &This
->basedoc
.IOleContainer_iface
;
1096 static const ITargetContainerVtbl TargetContainerVtbl
= {
1097 TargetContainer_QueryInterface
,
1098 TargetContainer_AddRef
,
1099 TargetContainer_Release
,
1100 TargetContainer_GetFrameUrl
,
1101 TargetContainer_GetFramesContainer
1104 void TargetContainer_Init(HTMLDocumentObj
*This
)
1106 This
->ITargetContainer_iface
.lpVtbl
= &TargetContainerVtbl
;
1109 /**********************************************************
1110 * IObjectSafety implementation
1113 static inline HTMLDocument
*impl_from_IObjectSafety(IObjectSafety
*iface
)
1115 return CONTAINING_RECORD(iface
, HTMLDocument
, IObjectSafety_iface
);
1118 static HRESULT WINAPI
ObjectSafety_QueryInterface(IObjectSafety
*iface
, REFIID riid
, void **ppv
)
1120 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1121 return htmldoc_query_interface(This
, riid
, ppv
);
1124 static ULONG WINAPI
ObjectSafety_AddRef(IObjectSafety
*iface
)
1126 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1127 return htmldoc_addref(This
);
1130 static ULONG WINAPI
ObjectSafety_Release(IObjectSafety
*iface
)
1132 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1133 return htmldoc_release(This
);
1136 static HRESULT WINAPI
ObjectSafety_GetInterfaceSafetyOptions(IObjectSafety
*iface
,
1137 REFIID riid
, DWORD
*pdwSupportedOptions
, DWORD
*pdwEnabledOptions
)
1139 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1140 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_guid(riid
), pdwSupportedOptions
, pdwEnabledOptions
);
1144 static HRESULT WINAPI
ObjectSafety_SetInterfaceSafetyOptions(IObjectSafety
*iface
,
1145 REFIID riid
, DWORD dwOptionSetMask
, DWORD dwEnabledOptions
)
1147 HTMLDocument
*This
= impl_from_IObjectSafety(iface
);
1148 FIXME("(%p)->(%s %x %x)\n", This
, debugstr_guid(riid
), dwOptionSetMask
, dwEnabledOptions
);
1150 if(IsEqualGUID(&IID_IPersistMoniker
, riid
) &&
1151 dwOptionSetMask
==INTERFACESAFE_FOR_UNTRUSTED_DATA
&&
1152 dwEnabledOptions
==INTERFACESAFE_FOR_UNTRUSTED_DATA
)
1158 static const IObjectSafetyVtbl ObjectSafetyVtbl
= {
1159 ObjectSafety_QueryInterface
,
1160 ObjectSafety_AddRef
,
1161 ObjectSafety_Release
,
1162 ObjectSafety_GetInterfaceSafetyOptions
,
1163 ObjectSafety_SetInterfaceSafetyOptions
1166 void HTMLDocument_LockContainer(HTMLDocumentObj
*This
, BOOL fLock
)
1168 IOleContainer
*container
;
1171 if(!This
->client
|| This
->container_locked
== fLock
)
1174 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
1175 if(SUCCEEDED(hres
)) {
1176 IOleContainer_LockContainer(container
, fLock
);
1177 This
->container_locked
= fLock
;
1178 IOleContainer_Release(container
);
1182 void HTMLDocument_OleObj_Init(HTMLDocument
*This
)
1184 This
->IOleObject_iface
.lpVtbl
= &OleObjectVtbl
;
1185 This
->IOleDocument_iface
.lpVtbl
= &OleDocumentVtbl
;
1186 This
->IOleControl_iface
.lpVtbl
= &OleControlVtbl
;
1187 This
->IObjectWithSite_iface
.lpVtbl
= &ObjectWithSiteVtbl
;
1188 This
->IOleContainer_iface
.lpVtbl
= &OleContainerVtbl
;
1189 This
->IObjectSafety_iface
.lpVtbl
= &ObjectSafetyVtbl
;