2 * Copyright 2005-2006 Jacek Caban for CodeWeavers
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 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw
);
28 DEFINE_OLEGUID(CGID_DocHostCmdPriv
, 0x000214D4L
, 0, 0);
30 #define DOCHOST_DOCCANNAVIGATE 0
32 static ATOM doc_view_atom
= 0;
34 void push_dochost_task(DocHost
*This
, task_header_t
*task
, task_proc_t proc
, task_destr_t destr
, BOOL send
)
41 is_empty
= list_empty(&This
->task_queue
);
42 list_add_tail(&This
->task_queue
, &task
->entry
);
45 SendMessageW(This
->frame_hwnd
, WM_DOCHOSTTASK
, 0, 0);
47 PostMessageW(This
->frame_hwnd
, WM_DOCHOSTTASK
, 0, 0);
50 LRESULT
process_dochost_tasks(DocHost
*This
)
54 while(!list_empty(&This
->task_queue
)) {
55 task
= LIST_ENTRY(This
->task_queue
.next
, task_header_t
, entry
);
56 list_remove(&task
->entry
);
58 task
->proc(This
, task
);
65 void abort_dochost_tasks(DocHost
*This
, task_proc_t proc
)
67 task_header_t
*task
, *cursor
;
69 LIST_FOR_EACH_ENTRY_SAFE(task
, cursor
, &This
->task_queue
, task_header_t
, entry
) {
70 if(proc
&& proc
!= task
->proc
)
73 list_remove(&task
->entry
);
78 static void notif_complete(DocHost
*This
, DISPID dispid
)
80 DISPPARAMS dispparams
;
85 dispparams
.cNamedArgs
= 0;
86 dispparams
.rgdispidNamedArgs
= NULL
;
87 dispparams
.rgvarg
= params
;
89 V_VT(params
) = (VT_BYREF
|VT_VARIANT
);
90 V_BYREF(params
) = &url
;
92 V_VT(params
+1) = VT_DISPATCH
;
93 V_DISPATCH(params
+1) = This
->disp
;
96 V_BSTR(&url
) = SysAllocString(This
->url
);
98 TRACE("%d >>>\n", dispid
);
99 call_sink(This
->cps
.wbe2
, dispid
, &dispparams
);
100 TRACE("%d <<<\n", dispid
);
102 SysFreeString(V_BSTR(&url
));
103 This
->busy
= VARIANT_FALSE
;
106 static void object_available(DocHost
*This
)
111 TRACE("(%p)\n", This
);
113 if(!This
->document
) {
114 WARN("document == NULL\n");
118 hres
= IUnknown_QueryInterface(This
->document
, &IID_IHlinkTarget
, (void**)&hlink
);
120 FIXME("Could not get IHlinkTarget interface\n");
124 hres
= IHlinkTarget_Navigate(hlink
, 0, NULL
);
125 IHlinkTarget_Release(hlink
);
127 FIXME("Navigate failed\n");
130 static HRESULT
get_doc_ready_state(DocHost
*This
, READYSTATE
*ret
)
132 DISPPARAMS dp
= {NULL
,NULL
,0,0};
138 hres
= IUnknown_QueryInterface(This
->document
, &IID_IDispatch
, (void**)&disp
);
142 hres
= IDispatch_Invoke(disp
, DISPID_READYSTATE
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
, DISPATCH_PROPERTYGET
,
143 &dp
, &var
, &ei
, NULL
);
144 IDispatch_Release(disp
);
146 WARN("Invoke(DISPID_READYSTATE failed: %08x\n", hres
);
150 if(V_VT(&var
) != VT_I4
) {
151 WARN("V_VT(var) = %d\n", V_VT(&var
));
160 static void advise_prop_notif(DocHost
*This
, BOOL set
)
162 IConnectionPointContainer
*cp_container
;
163 IConnectionPoint
*cp
;
166 hres
= IUnknown_QueryInterface(This
->document
, &IID_IConnectionPointContainer
, (void**)&cp_container
);
170 hres
= IConnectionPointContainer_FindConnectionPoint(cp_container
, &IID_IPropertyNotifySink
, &cp
);
171 IConnectionPointContainer_Release(cp_container
);
176 hres
= IConnectionPoint_Advise(cp
, (IUnknown
*)&This
->IPropertyNotifySink_iface
, &This
->prop_notif_cookie
);
178 hres
= IConnectionPoint_Unadvise(cp
, This
->prop_notif_cookie
);
179 IConnectionPoint_Release(cp
);
182 This
->is_prop_notif
= set
;
185 void set_doc_state(DocHost
*This
, READYSTATE doc_state
)
187 This
->doc_state
= doc_state
;
188 if(doc_state
> This
->ready_state
)
189 This
->ready_state
= doc_state
;
192 static void update_ready_state(DocHost
*This
, READYSTATE ready_state
)
194 if(ready_state
> READYSTATE_LOADING
&& This
->doc_state
<= READYSTATE_LOADING
)
195 notif_complete(This
, DISPID_NAVIGATECOMPLETE2
);
197 if(ready_state
== READYSTATE_COMPLETE
&& This
->doc_state
< READYSTATE_COMPLETE
) {
198 set_doc_state(This
, READYSTATE_COMPLETE
);
199 notif_complete(This
, DISPID_DOCUMENTCOMPLETE
);
201 set_doc_state(This
, ready_state
);
206 task_header_t header
;
208 READYSTATE ready_state
;
209 } ready_state_task_t
;
211 static void ready_state_task_destr(task_header_t
*_task
)
213 ready_state_task_t
*task
= (ready_state_task_t
*)_task
;
215 IUnknown_Release(task
->doc
);
219 static void ready_state_proc(DocHost
*This
, task_header_t
*_task
)
221 ready_state_task_t
*task
= (ready_state_task_t
*)_task
;
223 if(task
->doc
== This
->document
)
224 update_ready_state(This
, task
->ready_state
);
227 static void push_ready_state_task(DocHost
*This
, READYSTATE ready_state
)
229 ready_state_task_t
*task
= heap_alloc(sizeof(ready_state_task_t
));
231 IUnknown_AddRef(This
->document
);
232 task
->doc
= This
->document
;
233 task
->ready_state
= ready_state
;
235 push_dochost_task(This
, &task
->header
, ready_state_proc
, ready_state_task_destr
, FALSE
);
238 static void object_available_task_destr(task_header_t
*task
)
243 static void object_available_proc(DocHost
*This
, task_header_t
*task
)
245 object_available(This
);
248 HRESULT
dochost_object_available(DocHost
*This
, IUnknown
*doc
)
250 READYSTATE ready_state
;
255 IUnknown_AddRef(doc
);
256 This
->document
= doc
;
258 hres
= IUnknown_QueryInterface(doc
, &IID_IOleObject
, (void**)&oleobj
);
259 if(SUCCEEDED(hres
)) {
262 hres
= IOleObject_GetUserClassID(oleobj
, &clsid
);
264 TRACE("Got clsid %s\n",
265 IsEqualGUID(&clsid
, &CLSID_HTMLDocument
) ? "CLSID_HTMLDocument" : debugstr_guid(&clsid
));
267 hres
= IOleObject_SetClientSite(oleobj
, &This
->IOleClientSite_iface
);
269 FIXME("SetClientSite failed: %08x\n", hres
);
271 IOleObject_Release(oleobj
);
273 FIXME("Could not get IOleObject iface: %08x\n", hres
);
276 /* FIXME: Call SetAdvise */
278 task
= heap_alloc(sizeof(*task
));
279 push_dochost_task(This
, task
, object_available_proc
, object_available_task_destr
, FALSE
);
281 hres
= get_doc_ready_state(This
, &ready_state
);
282 if(SUCCEEDED(hres
)) {
283 if(ready_state
== READYSTATE_COMPLETE
)
284 push_ready_state_task(This
, READYSTATE_COMPLETE
);
285 if(ready_state
!= READYSTATE_COMPLETE
|| This
->doc_navigate
)
286 advise_prop_notif(This
, TRUE
);
292 static LRESULT
resize_document(DocHost
*This
, LONG width
, LONG height
)
294 RECT rect
= {0, 0, width
, height
};
296 TRACE("(%p)->(%d %d)\n", This
, width
, height
);
299 IOleDocumentView_SetRect(This
->view
, &rect
);
304 static LRESULT WINAPI
doc_view_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
308 static const WCHAR wszTHIS
[] = {'T','H','I','S',0};
310 if(msg
== WM_CREATE
) {
311 This
= *(DocHost
**)lParam
;
312 SetPropW(hwnd
, wszTHIS
, This
);
314 This
= GetPropW(hwnd
, wszTHIS
);
319 return resize_document(This
, LOWORD(lParam
), HIWORD(lParam
));
322 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
325 void create_doc_view_hwnd(DocHost
*This
)
329 static const WCHAR wszShell_DocObject_View
[] =
330 {'S','h','e','l','l',' ','D','o','c','O','b','j','e','c','t',' ','V','i','e','w',0};
333 static WNDCLASSEXW wndclass
= {
337 0, 0 /* native uses 4*/, NULL
, NULL
, NULL
,
338 (HBRUSH
)(COLOR_WINDOW
+ 1), NULL
,
339 wszShell_DocObject_View
,
343 wndclass
.hInstance
= shdocvw_hinstance
;
345 doc_view_atom
= RegisterClassExW(&wndclass
);
348 This
->container_vtbl
->GetDocObjRect(This
, &rect
);
349 This
->hwnd
= CreateWindowExW(0, wszShell_DocObject_View
,
350 wszShell_DocObject_View
,
351 WS_CHILD
| WS_VISIBLE
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
| WS_TABSTOP
,
352 rect
.left
, rect
.top
, rect
.right
, rect
.bottom
, This
->frame_hwnd
,
353 NULL
, shdocvw_hinstance
, This
);
356 void deactivate_document(DocHost
*This
)
358 IOleInPlaceObjectWindowless
*winobj
;
359 IOleObject
*oleobj
= NULL
;
360 IHlinkTarget
*hlink
= NULL
;
363 if(!This
->document
) return;
365 if(This
->doc_navigate
) {
366 IUnknown_Release(This
->doc_navigate
);
367 This
->doc_navigate
= NULL
;
370 if(This
->is_prop_notif
)
371 advise_prop_notif(This
, FALSE
);
374 IOleDocumentView_UIActivate(This
->view
, FALSE
);
376 hres
= IUnknown_QueryInterface(This
->document
, &IID_IOleInPlaceObjectWindowless
,
378 if(SUCCEEDED(hres
)) {
379 IOleInPlaceObjectWindowless_InPlaceDeactivate(winobj
);
380 IOleInPlaceObjectWindowless_Release(winobj
);
384 IOleDocumentView_Show(This
->view
, FALSE
);
385 IOleDocumentView_CloseView(This
->view
, 0);
386 IOleDocumentView_SetInPlaceSite(This
->view
, NULL
);
387 IOleDocumentView_Release(This
->view
);
391 hres
= IUnknown_QueryInterface(This
->document
, &IID_IOleObject
, (void**)&oleobj
);
393 IOleObject_Close(oleobj
, OLECLOSE_NOSAVE
);
395 hres
= IUnknown_QueryInterface(This
->document
, &IID_IHlinkTarget
, (void**)&hlink
);
396 if(SUCCEEDED(hres
)) {
397 IHlinkTarget_SetBrowseContext(hlink
, NULL
);
398 IHlinkTarget_Release(hlink
);
402 IOleClientSite
*client_site
= NULL
;
404 IOleObject_GetClientSite(oleobj
, &client_site
);
406 if(client_site
== &This
->IOleClientSite_iface
)
407 IOleObject_SetClientSite(oleobj
, NULL
);
408 IOleClientSite_Release(client_site
);
411 IOleObject_Release(oleobj
);
414 IUnknown_Release(This
->document
);
415 This
->document
= NULL
;
418 void release_dochost_client(DocHost
*This
)
421 DestroyWindow(This
->hwnd
);
426 IDocHostUIHandler_Release(This
->hostui
);
430 if(This
->client_disp
) {
431 IDispatch_Release(This
->client_disp
);
432 This
->client_disp
= NULL
;
436 IOleInPlaceFrame_Release(This
->frame
);
441 static inline DocHost
*impl_from_IOleCommandTarget(IOleCommandTarget
*iface
)
443 return CONTAINING_RECORD(iface
, DocHost
, IOleCommandTarget_iface
);
446 static HRESULT WINAPI
ClOleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
447 REFIID riid
, void **ppv
)
449 DocHost
*This
= impl_from_IOleCommandTarget(iface
);
450 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
453 static ULONG WINAPI
ClOleCommandTarget_AddRef(IOleCommandTarget
*iface
)
455 DocHost
*This
= impl_from_IOleCommandTarget(iface
);
456 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
459 static ULONG WINAPI
ClOleCommandTarget_Release(IOleCommandTarget
*iface
)
461 DocHost
*This
= impl_from_IOleCommandTarget(iface
);
462 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
465 static HRESULT WINAPI
ClOleCommandTarget_QueryStatus(IOleCommandTarget
*iface
,
466 const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
468 DocHost
*This
= impl_from_IOleCommandTarget(iface
);
470 FIXME("(%p)->(%s %u %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
,
472 while (prgCmds
&& (cCmds
> i
)) {
473 FIXME("command_%u: %u, 0x%x\n", i
, prgCmds
[i
].cmdID
, prgCmds
[i
].cmdf
);
479 static HRESULT WINAPI
ClOleCommandTarget_Exec(IOleCommandTarget
*iface
,
480 const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
,
483 DocHost
*This
= impl_from_IOleCommandTarget(iface
);
485 TRACE("(%p)->(%s %d %d %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), nCmdID
,
486 nCmdexecopt
, debugstr_variant(pvaIn
), debugstr_variant(pvaOut
));
490 case OLECMDID_UPDATECOMMANDS
:
491 return This
->container_vtbl
->exec(This
, pguidCmdGroup
, nCmdID
, nCmdexecopt
, pvaIn
, pvaOut
);
493 FIXME("Unimplemented cmdid %d\n", nCmdID
);
499 if(IsEqualGUID(pguidCmdGroup
, &CGID_DocHostCmdPriv
)) {
501 case DOCHOST_DOCCANNAVIGATE
:
502 if(!pvaIn
|| V_VT(pvaIn
) != VT_UNKNOWN
)
505 if(This
->doc_navigate
)
506 IUnknown_Release(This
->doc_navigate
);
507 IUnknown_AddRef(V_UNKNOWN(pvaIn
));
508 This
->doc_navigate
= V_UNKNOWN(pvaIn
);
513 SAFEARRAY
*sa
= V_ARRAY(pvaIn
);
514 VARIANT status_code
, url
, htmlwindow
;
518 if(V_VT(pvaIn
) != VT_ARRAY
|| !sa
|| (SafeArrayGetDim(sa
) != 1))
522 hres
= SafeArrayGetElement(sa
, &ind
, &status_code
);
523 if(FAILED(hres
) || V_VT(&status_code
)!=VT_I4
)
527 hres
= SafeArrayGetElement(sa
, &ind
, &url
);
528 if(FAILED(hres
) || V_VT(&url
)!=VT_BSTR
)
532 hres
= SafeArrayGetElement(sa
, &ind
, &htmlwindow
);
533 if(FAILED(hres
) || V_VT(&htmlwindow
)!=VT_UNKNOWN
|| !V_UNKNOWN(&htmlwindow
))
536 hres
= IUnknown_QueryInterface(V_UNKNOWN(&htmlwindow
), &IID_IHTMLWindow2
, (void**)&win2
);
540 handle_navigation_error(This
, V_I4(&status_code
), V_BSTR(&url
), win2
);
541 IHTMLWindow2_Release(win2
);
546 FIXME("unsupported command %d of CGID_DocHostCmdPriv\n", nCmdID
);
551 FIXME("Unimplemented group %s\n", debugstr_guid(pguidCmdGroup
));
555 #undef impl_from_IOleCommandTarget
557 static const IOleCommandTargetVtbl OleCommandTargetVtbl
= {
558 ClOleCommandTarget_QueryInterface
,
559 ClOleCommandTarget_AddRef
,
560 ClOleCommandTarget_Release
,
561 ClOleCommandTarget_QueryStatus
,
562 ClOleCommandTarget_Exec
565 static inline DocHost
*impl_from_IDocHostUIHandler2(IDocHostUIHandler2
*iface
)
567 return CONTAINING_RECORD(iface
, DocHost
, IDocHostUIHandler2_iface
);
570 static HRESULT WINAPI
DocHostUIHandler_QueryInterface(IDocHostUIHandler2
*iface
,
571 REFIID riid
, void **ppv
)
573 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
574 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
577 static ULONG WINAPI
DocHostUIHandler_AddRef(IDocHostUIHandler2
*iface
)
579 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
580 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
583 static ULONG WINAPI
DocHostUIHandler_Release(IDocHostUIHandler2
*iface
)
585 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
586 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
589 static HRESULT WINAPI
DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2
*iface
,
590 DWORD dwID
, POINT
*ppt
, IUnknown
*pcmdtReserved
, IDispatch
*pdispReserved
)
592 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
595 TRACE("(%p)->(%d %p %p %p)\n", This
, dwID
, ppt
, pcmdtReserved
, pdispReserved
);
598 hres
= IDocHostUIHandler_ShowContextMenu(This
->hostui
, dwID
, ppt
, pcmdtReserved
,
604 FIXME("default action not implemented\n");
608 static HRESULT WINAPI
DocHostUIHandler_GetHostInfo(IDocHostUIHandler2
*iface
,
609 DOCHOSTUIINFO
*pInfo
)
611 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
614 TRACE("(%p)->(%p)\n", This
, pInfo
);
617 hres
= IDocHostUIHandler_GetHostInfo(This
->hostui
, pInfo
);
622 pInfo
->dwFlags
= DOCHOSTUIFLAG_DISABLE_HELP_MENU
| DOCHOSTUIFLAG_OPENNEWWIN
623 | DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8
| DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
624 | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION
;
628 static HRESULT WINAPI
DocHostUIHandler_ShowUI(IDocHostUIHandler2
*iface
, DWORD dwID
,
629 IOleInPlaceActiveObject
*pActiveObject
, IOleCommandTarget
*pCommandTarget
,
630 IOleInPlaceFrame
*pFrame
, IOleInPlaceUIWindow
*pDoc
)
632 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
633 FIXME("(%p)->(%d %p %p %p %p)\n", This
, dwID
, pActiveObject
, pCommandTarget
,
638 static HRESULT WINAPI
DocHostUIHandler_HideUI(IDocHostUIHandler2
*iface
)
640 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
641 FIXME("(%p)\n", This
);
645 static HRESULT WINAPI
DocHostUIHandler_UpdateUI(IDocHostUIHandler2
*iface
)
647 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
649 TRACE("(%p)\n", This
);
654 return IDocHostUIHandler_UpdateUI(This
->hostui
);
657 static HRESULT WINAPI
DocHostUIHandler_EnableModeless(IDocHostUIHandler2
*iface
,
660 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
661 FIXME("(%p)->(%x)\n", This
, fEnable
);
665 static HRESULT WINAPI
DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2
*iface
,
668 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
669 FIXME("(%p)->(%x)\n", This
, fActivate
);
673 static HRESULT WINAPI
DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2
*iface
,
676 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
677 FIXME("(%p)->(%x)\n", This
, fActivate
);
681 static HRESULT WINAPI
DocHostUIHandler_ResizeBorder(IDocHostUIHandler2
*iface
,
682 LPCRECT prcBorder
, IOleInPlaceUIWindow
*pUIWindow
, BOOL fRameWindow
)
684 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
685 FIXME("(%p)->(%p %p %X)\n", This
, prcBorder
, pUIWindow
, fRameWindow
);
689 static HRESULT WINAPI
DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2
*iface
,
690 LPMSG lpMsg
, const GUID
*pguidCmdGroup
, DWORD nCmdID
)
692 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
693 HRESULT hr
= S_FALSE
;
694 TRACE("(%p)->(%p %p %d)\n", This
, lpMsg
, pguidCmdGroup
, nCmdID
);
697 hr
= IDocHostUIHandler_TranslateAccelerator(This
->hostui
, lpMsg
, pguidCmdGroup
, nCmdID
);
702 static HRESULT WINAPI
DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2
*iface
,
703 LPOLESTR
*pchKey
, DWORD dw
)
705 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
707 TRACE("(%p)->(%p %d)\n", This
, pchKey
, dw
);
710 return IDocHostUIHandler_GetOptionKeyPath(This
->hostui
, pchKey
, dw
);
715 static HRESULT WINAPI
DocHostUIHandler_GetDropTarget(IDocHostUIHandler2
*iface
,
716 IDropTarget
*pDropTarget
, IDropTarget
**ppDropTarget
)
718 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
719 FIXME("(%p)\n", This
);
723 static HRESULT WINAPI
DocHostUIHandler_GetExternal(IDocHostUIHandler2
*iface
,
724 IDispatch
**ppDispatch
)
726 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
728 TRACE("(%p)->(%p)\n", This
, ppDispatch
);
731 return IDocHostUIHandler_GetExternal(This
->hostui
, ppDispatch
);
733 FIXME("default action not implemented\n");
737 static HRESULT WINAPI
DocHostUIHandler_TranslateUrl(IDocHostUIHandler2
*iface
,
738 DWORD dwTranslate
, OLECHAR
*pchURLIn
, OLECHAR
**ppchURLOut
)
740 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
742 TRACE("(%p)->(%d %s %p)\n", This
, dwTranslate
, debugstr_w(pchURLIn
), ppchURLOut
);
745 return IDocHostUIHandler_TranslateUrl(This
->hostui
, dwTranslate
,
746 pchURLIn
, ppchURLOut
);
751 static HRESULT WINAPI
DocHostUIHandler_FilterDataObject(IDocHostUIHandler2
*iface
,
752 IDataObject
*pDO
, IDataObject
**ppDORet
)
754 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
755 FIXME("(%p)->(%p %p)\n", This
, pDO
, ppDORet
);
759 static HRESULT WINAPI
DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2
*iface
,
760 LPOLESTR
*pchKey
, DWORD dw
)
762 DocHost
*This
= impl_from_IDocHostUIHandler2(iface
);
763 IDocHostUIHandler2
*handler
;
766 TRACE("(%p)->(%p %d)\n", This
, pchKey
, dw
);
771 hres
= IDocHostUIHandler_QueryInterface(This
->hostui
, &IID_IDocHostUIHandler2
,
773 if(SUCCEEDED(hres
)) {
774 hres
= IDocHostUIHandler2_GetOverrideKeyPath(handler
, pchKey
, dw
);
775 IDocHostUIHandler2_Release(handler
);
782 static const IDocHostUIHandler2Vtbl DocHostUIHandler2Vtbl
= {
783 DocHostUIHandler_QueryInterface
,
784 DocHostUIHandler_AddRef
,
785 DocHostUIHandler_Release
,
786 DocHostUIHandler_ShowContextMenu
,
787 DocHostUIHandler_GetHostInfo
,
788 DocHostUIHandler_ShowUI
,
789 DocHostUIHandler_HideUI
,
790 DocHostUIHandler_UpdateUI
,
791 DocHostUIHandler_EnableModeless
,
792 DocHostUIHandler_OnDocWindowActivate
,
793 DocHostUIHandler_OnFrameWindowActivate
,
794 DocHostUIHandler_ResizeBorder
,
795 DocHostUIHandler_TranslateAccelerator
,
796 DocHostUIHandler_GetOptionKeyPath
,
797 DocHostUIHandler_GetDropTarget
,
798 DocHostUIHandler_GetExternal
,
799 DocHostUIHandler_TranslateUrl
,
800 DocHostUIHandler_FilterDataObject
,
801 DocHostUIHandler_GetOverrideKeyPath
804 static inline DocHost
*impl_from_IPropertyNotifySink(IPropertyNotifySink
*iface
)
806 return CONTAINING_RECORD(iface
, DocHost
, IPropertyNotifySink_iface
);
809 static HRESULT WINAPI
PropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
,
810 REFIID riid
, void **ppv
)
812 DocHost
*This
= impl_from_IPropertyNotifySink(iface
);
813 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
816 static ULONG WINAPI
PropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
818 DocHost
*This
= impl_from_IPropertyNotifySink(iface
);
819 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
822 static ULONG WINAPI
PropertyNotifySink_Release(IPropertyNotifySink
*iface
)
824 DocHost
*This
= impl_from_IPropertyNotifySink(iface
);
825 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
828 static HRESULT WINAPI
PropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
830 DocHost
*This
= impl_from_IPropertyNotifySink(iface
);
832 TRACE("(%p)->(%d)\n", This
, dispID
);
835 case DISPID_READYSTATE
: {
836 READYSTATE ready_state
;
839 hres
= get_doc_ready_state(This
, &ready_state
);
843 if(ready_state
== READYSTATE_COMPLETE
&& !This
->doc_navigate
)
844 advise_prop_notif(This
, FALSE
);
846 push_ready_state_task(This
, ready_state
);
850 FIXME("unimplemented dispid %d\n", dispID
);
857 static HRESULT WINAPI
PropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
859 DocHost
*This
= impl_from_IPropertyNotifySink(iface
);
860 FIXME("(%p)->(%d)\n", This
, dispID
);
864 static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
865 PropertyNotifySink_QueryInterface
,
866 PropertyNotifySink_AddRef
,
867 PropertyNotifySink_Release
,
868 PropertyNotifySink_OnChanged
,
869 PropertyNotifySink_OnRequestEdit
872 void DocHost_Init(DocHost
*This
, IDispatch
*disp
, const IDocHostContainerVtbl
* container
)
874 This
->IDocHostUIHandler2_iface
.lpVtbl
= &DocHostUIHandler2Vtbl
;
875 This
->IOleCommandTarget_iface
.lpVtbl
= &OleCommandTargetVtbl
;
876 This
->IPropertyNotifySink_iface
.lpVtbl
= &PropertyNotifySinkVtbl
;
879 This
->container_vtbl
= container
;
881 This
->ready_state
= READYSTATE_UNINITIALIZED
;
882 list_init(&This
->task_queue
);
884 DocHost_ClientSite_Init(This
);
885 DocHost_Frame_Init(This
);
887 ConnectionPointContainer_Init(&This
->cps
, (IUnknown
*)disp
);
890 void DocHost_Release(DocHost
*This
)
892 abort_dochost_tasks(This
, NULL
);
893 release_dochost_client(This
);
894 DocHost_ClientSite_Release(This
);
896 ConnectionPointContainer_Destroy(&This
->cps
);
898 heap_free(This
->url
);