2 * Implementation of IOleObject interfaces for WebBrowser control
8 * Copyright 2001 John R. Sheets (for CodeWeavers)
9 * Copyright 2005 Jacek Caban
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw
);
35 HWND WINAPI
SHSetParentHwnd(HWND hWnd
, HWND hWndParent
);
37 static ATOM shell_embedding_atom
= 0;
39 static LRESULT
resize_window(WebBrowser
*This
, LONG width
, LONG height
)
41 if(This
->doc_host
.hwnd
)
42 SetWindowPos(This
->doc_host
.hwnd
, NULL
, 0, 0, width
, height
,
43 SWP_NOZORDER
| SWP_NOACTIVATE
);
48 static LRESULT WINAPI
shell_embedding_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
52 static const WCHAR wszTHIS
[] = {'T','H','I','S',0};
54 if(msg
== WM_CREATE
) {
55 This
= *(WebBrowser
**)lParam
;
56 SetPropW(hwnd
, wszTHIS
, This
);
58 This
= GetPropW(hwnd
, wszTHIS
);
63 return resize_window(This
, LOWORD(lParam
), HIWORD(lParam
));
65 return process_dochost_task(&This
->doc_host
, lParam
);
68 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
71 static void create_shell_embedding_hwnd(WebBrowser
*This
)
73 IOleInPlaceSite
*inplace
;
77 static const WCHAR wszShellEmbedding
[] =
78 {'S','h','e','l','l',' ','E','m','b','e','d','d','i','n','g',0};
80 if(!shell_embedding_atom
) {
81 static WNDCLASSEXW wndclass
= {
85 0, 0 /* native uses 8 */, NULL
, NULL
, NULL
,
86 (HBRUSH
)COLOR_WINDOWFRAME
, NULL
,
90 wndclass
.hInstance
= shdocvw_hinstance
;
92 RegisterClassExW(&wndclass
);
95 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleInPlaceSite
, (void**)&inplace
);
97 IOleInPlaceSite_GetWindow(inplace
, &parent
);
98 IOleInPlaceSite_Release(inplace
);
101 This
->doc_host
.frame_hwnd
= This
->shell_embedding_hwnd
= CreateWindowExW(
103 wszShellEmbedding
, wszShellEmbedding
,
104 WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
105 | (parent
? WS_CHILD
| WS_TABSTOP
: WS_POPUP
| WS_MAXIMIZEBOX
),
107 NULL
, shdocvw_hinstance
, This
);
109 TRACE("parent=%p hwnd=%p\n", parent
, This
->shell_embedding_hwnd
);
112 static HRESULT
activate_inplace(WebBrowser
*This
, IOleClientSite
*active_site
)
123 hres
= IOleClientSite_QueryInterface(active_site
, &IID_IOleInPlaceSite
,
124 (void**)&This
->inplace
);
126 WARN("Could not get IOleInPlaceSite\n");
130 hres
= IOleInPlaceSite_CanInPlaceActivate(This
->inplace
);
132 WARN("CanInPlaceActivate returned: %08x\n", hres
);
133 IOleInPlaceSite_Release(This
->inplace
);
137 hres
= IOleInPlaceSite_GetWindow(This
->inplace
, &parent_hwnd
);
139 SHSetParentHwnd(This
->shell_embedding_hwnd
, parent_hwnd
);
141 IOleInPlaceSite_OnInPlaceActivate(This
->inplace
);
143 IOleInPlaceSite_GetWindowContext(This
->inplace
, &This
->doc_host
.frame
, &This
->uiwindow
,
144 &This
->pos_rect
, &This
->clip_rect
,
147 SetWindowPos(This
->shell_embedding_hwnd
, NULL
,
148 This
->pos_rect
.left
, This
->pos_rect
.top
,
149 This
->pos_rect
.right
-This
->pos_rect
.left
,
150 This
->pos_rect
.bottom
-This
->pos_rect
.top
,
151 SWP_NOZORDER
| SWP_SHOWWINDOW
);
154 IOleClientSite_ShowObject(This
->client
);
155 IOleClientSite_GetContainer(This
->client
, &This
->container
);
158 if(This
->doc_host
.frame
)
159 IOleInPlaceFrame_GetWindow(This
->doc_host
.frame
, &This
->frame_hwnd
);
164 static HRESULT
activate_ui(WebBrowser
*This
, IOleClientSite
*active_site
)
168 static const WCHAR wszitem
[] = {'i','t','e','m',0};
172 if(This
->shell_embedding_hwnd
)
173 ShowWindow(This
->shell_embedding_hwnd
, SW_SHOW
);
177 hres
= activate_inplace(This
, active_site
);
181 IOleInPlaceSite_OnUIActivate(This
->inplace
);
183 if(This
->doc_host
.frame
)
184 IOleInPlaceFrame_SetActiveObject(This
->doc_host
.frame
, ACTIVEOBJ(This
), wszitem
);
186 IOleInPlaceUIWindow_SetActiveObject(This
->uiwindow
, ACTIVEOBJ(This
), wszitem
);
188 if(This
->doc_host
.frame
)
189 IOleInPlaceFrame_SetMenu(This
->doc_host
.frame
, NULL
, NULL
, This
->shell_embedding_hwnd
);
191 SetFocus(This
->shell_embedding_hwnd
);
196 static HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
198 IDispatch
*disp
= NULL
;
199 DISPPARAMS dispparams
= {NULL
, 0};
207 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
209 TRACE("Could not get IDispatch\n");
213 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
214 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, NULL
);
216 IDispatch_Release(disp
);
221 static HRESULT
on_offlineconnected_change(WebBrowser
*This
)
225 get_client_disp_property(This
->client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &offline
);
227 if(V_VT(&offline
) == VT_BOOL
)
228 IWebBrowser2_put_Offline(WEBBROWSER2(This
), V_BOOL(&offline
));
229 else if(V_VT(&offline
) != VT_EMPTY
)
230 WARN("wrong V_VT(silent) %d\n", V_VT(&offline
));
235 static HRESULT
on_silent_change(WebBrowser
*This
)
239 get_client_disp_property(This
->client
, DISPID_AMBIENT_SILENT
, &silent
);
241 if(V_VT(&silent
) == VT_BOOL
)
242 IWebBrowser2_put_Silent(WEBBROWSER2(This
), V_BOOL(&silent
));
243 else if(V_VT(&silent
) != VT_EMPTY
)
244 WARN("wrong V_VT(silent) %d\n", V_VT(&silent
));
249 /**********************************************************************
250 * Implement the IOleObject interface for the WebBrowser control
253 #define OLEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
255 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
257 WebBrowser
*This
= OLEOBJ_THIS(iface
);
258 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppv
);
261 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
263 WebBrowser
*This
= OLEOBJ_THIS(iface
);
264 return IWebBrowser_AddRef(WEBBROWSER(This
));
267 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
269 WebBrowser
*This
= OLEOBJ_THIS(iface
);
270 return IWebBrowser_Release(WEBBROWSER(This
));
273 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, LPOLECLIENTSITE pClientSite
)
275 WebBrowser
*This
= OLEOBJ_THIS(iface
);
276 IOleContainer
*container
;
279 TRACE("(%p)->(%p)\n", This
, pClientSite
);
281 if(This
->client
== pClientSite
)
284 if(This
->doc_host
.hwnd
) {
285 DestroyWindow(This
->doc_host
.hwnd
);
286 This
->doc_host
.hwnd
= NULL
;
288 if(This
->shell_embedding_hwnd
) {
289 DestroyWindow(This
->shell_embedding_hwnd
);
290 This
->shell_embedding_hwnd
= NULL
;
294 IOleInPlaceSite_Release(This
->inplace
);
295 This
->inplace
= NULL
;
298 if(This
->doc_host
.hostui
) {
299 IDocHostUIHandler_Release(This
->doc_host
.hostui
);
300 This
->doc_host
.hostui
= NULL
;
304 IOleClientSite_Release(This
->client
);
306 This
->client
= pClientSite
;
309 if(This
->doc_host
.document
)
310 deactivate_document(&This
->doc_host
);
314 IOleClientSite_AddRef(pClientSite
);
316 IOleClientSite_QueryInterface(This
->client
, &IID_IDispatch
,
317 (void**)&This
->doc_host
.client_disp
);
319 IOleClientSite_QueryInterface(This
->client
, &IID_IDocHostUIHandler
,
320 (void**)&This
->doc_host
.hostui
);
322 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
323 if(SUCCEEDED(hres
)) {
324 ITargetContainer
*target_container
;
326 hres
= IOleContainer_QueryInterface(container
, &IID_ITargetContainer
,
327 (void**)&target_container
);
328 if(SUCCEEDED(hres
)) {
329 FIXME("Unsupported ITargetContainer\n");
330 ITargetContainer_Release(target_container
);
333 IOleContainer_Release(container
);
336 create_shell_embedding_hwnd(This
);
338 on_offlineconnected_change(This
);
339 on_silent_change(This
);
344 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, LPOLECLIENTSITE
*ppClientSite
)
346 WebBrowser
*This
= OLEOBJ_THIS(iface
);
348 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
354 IOleClientSite_AddRef(This
->client
);
355 *ppClientSite
= This
->client
;
360 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
,
361 LPCOLESTR szContainerObj
)
363 WebBrowser
*This
= OLEOBJ_THIS(iface
);
365 TRACE("(%p)->(%s, %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
367 /* We have nothing to do here. */
371 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
373 WebBrowser
*This
= OLEOBJ_THIS(iface
);
374 FIXME("(%p)->(%d)\n", This
, dwSaveOption
);
378 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
* pmk
)
380 WebBrowser
*This
= OLEOBJ_THIS(iface
);
381 FIXME("(%p)->(%d, %p)\n", This
, dwWhichMoniker
, pmk
);
385 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
,
386 DWORD dwWhichMoniker
, LPMONIKER
*ppmk
)
388 WebBrowser
*This
= OLEOBJ_THIS(iface
);
389 FIXME("(%p)->(%d, %d, %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
393 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, LPDATAOBJECT pDataObject
,
394 BOOL fCreation
, DWORD dwReserved
)
396 WebBrowser
*This
= OLEOBJ_THIS(iface
);
397 FIXME("(%p)->(%p, %d, %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
401 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
,
402 LPDATAOBJECT
*ppDataObject
)
404 WebBrowser
*This
= OLEOBJ_THIS(iface
);
405 FIXME("(%p)->(%d, %p)\n", This
, dwReserved
, ppDataObject
);
409 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, struct tagMSG
* lpmsg
,
410 LPOLECLIENTSITE pActiveSite
, LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
412 WebBrowser
*This
= OLEOBJ_THIS(iface
);
414 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
,
420 TRACE("OLEIVERB_SHOW\n");
421 return activate_ui(This
, pActiveSite
);
422 case OLEIVERB_UIACTIVATE
:
423 TRACE("OLEIVERB_UIACTIVATE\n");
424 return activate_ui(This
, pActiveSite
);
425 case OLEIVERB_INPLACEACTIVATE
:
426 TRACE("OLEIVERB_INPLACEACTIVATE\n");
427 return activate_inplace(This
, pActiveSite
);
429 TRACE("OLEIVERB_HIDE\n");
430 if(This
->shell_embedding_hwnd
)
431 ShowWindow(This
->shell_embedding_hwnd
, SW_HIDE
);
434 FIXME("stub for %d\n", iVerb
);
441 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
443 WebBrowser
*This
= OLEOBJ_THIS(iface
);
444 TRACE("(%p)->(%p)\n", This
, ppEnumOleVerb
);
445 return OleRegEnumVerbs(&CLSID_WebBrowser
, ppEnumOleVerb
);
448 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
450 WebBrowser
*This
= OLEOBJ_THIS(iface
);
451 FIXME("(%p)\n", This
);
455 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
457 WebBrowser
*This
= OLEOBJ_THIS(iface
);
458 FIXME("(%p)\n", This
);
462 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
* pClsid
)
464 WebBrowser
*This
= OLEOBJ_THIS(iface
);
465 FIXME("(%p)->(%p)\n", This
, pClsid
);
469 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
,
470 LPOLESTR
* pszUserType
)
472 WebBrowser
*This
= OLEOBJ_THIS(iface
);
473 TRACE("(%p, %d, %p)\n", This
, dwFormOfType
, pszUserType
);
474 return OleRegGetUserType(&CLSID_WebBrowser
, dwFormOfType
, pszUserType
);
477 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
479 WebBrowser
*This
= OLEOBJ_THIS(iface
);
481 TRACE("(%p)->(%x %p)\n", This
, dwDrawAspect
, psizel
);
483 /* Tests show that dwDrawAspect is ignored */
484 memcpy(&This
->extent
, psizel
, sizeof(SIZEL
));
488 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
490 WebBrowser
*This
= OLEOBJ_THIS(iface
);
492 TRACE("(%p)->(%x, %p)\n", This
, dwDrawAspect
, psizel
);
494 /* Tests show that dwDrawAspect is ignored */
495 memcpy(psizel
, &This
->extent
, sizeof(SIZEL
));
499 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
,
500 DWORD
* pdwConnection
)
502 WebBrowser
*This
= OLEOBJ_THIS(iface
);
503 FIXME("(%p)->(%p, %p)\n", This
, pAdvSink
, pdwConnection
);
507 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
509 WebBrowser
*This
= OLEOBJ_THIS(iface
);
510 FIXME("(%p)->(%d)\n", This
, dwConnection
);
514 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
516 WebBrowser
*This
= OLEOBJ_THIS(iface
);
517 FIXME("(%p)->(%p)\n", This
, ppenumAdvise
);
521 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
523 WebBrowser
*This
= OLEOBJ_THIS(iface
);
525 TRACE("(%p)->(%x, %p)\n", This
, dwAspect
, pdwStatus
);
527 *pdwStatus
= OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
528 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
;
533 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
* pLogpal
)
535 WebBrowser
*This
= OLEOBJ_THIS(iface
);
536 FIXME("(%p)->(%p)\n", This
, pLogpal
);
542 static const IOleObjectVtbl OleObjectVtbl
=
544 OleObject_QueryInterface
,
547 OleObject_SetClientSite
,
548 OleObject_GetClientSite
,
549 OleObject_SetHostNames
,
551 OleObject_SetMoniker
,
552 OleObject_GetMoniker
,
553 OleObject_InitFromData
,
554 OleObject_GetClipboardData
,
558 OleObject_IsUpToDate
,
559 OleObject_GetUserClassID
,
560 OleObject_GetUserType
,
565 OleObject_EnumAdvise
,
566 OleObject_GetMiscStatus
,
567 OleObject_SetColorScheme
570 /**********************************************************************
571 * Implement the IOleInPlaceObject interface
574 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
576 static HRESULT WINAPI
OleInPlaceObject_QueryInterface(IOleInPlaceObject
*iface
,
577 REFIID riid
, LPVOID
*ppobj
)
579 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
580 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
583 static ULONG WINAPI
OleInPlaceObject_AddRef(IOleInPlaceObject
*iface
)
585 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
586 return IWebBrowser_AddRef(WEBBROWSER(This
));
589 static ULONG WINAPI
OleInPlaceObject_Release(IOleInPlaceObject
*iface
)
591 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
592 return IWebBrowser_Release(WEBBROWSER(This
));
595 static HRESULT WINAPI
OleInPlaceObject_GetWindow(IOleInPlaceObject
*iface
, HWND
* phwnd
)
597 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
599 TRACE("(%p)->(%p)\n", This
, phwnd
);
601 *phwnd
= This
->shell_embedding_hwnd
;
605 static HRESULT WINAPI
OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject
*iface
,
608 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
609 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
613 static HRESULT WINAPI
OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject
*iface
)
615 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
616 FIXME("(%p)\n", This
);
620 static HRESULT WINAPI
OleInPlaceObject_UIDeactivate(IOleInPlaceObject
*iface
)
622 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
623 FIXME("(%p)\n", This
);
627 static HRESULT WINAPI
OleInPlaceObject_SetObjectRects(IOleInPlaceObject
*iface
,
628 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
630 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
632 TRACE("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
634 memcpy(&This
->pos_rect
, lprcPosRect
, sizeof(RECT
));
637 memcpy(&This
->clip_rect
, lprcClipRect
, sizeof(RECT
));
639 if(This
->shell_embedding_hwnd
) {
640 SetWindowPos(This
->shell_embedding_hwnd
, NULL
,
641 lprcPosRect
->left
, lprcPosRect
->top
,
642 lprcPosRect
->right
-lprcPosRect
->left
,
643 lprcPosRect
->bottom
-lprcPosRect
->top
,
644 SWP_NOZORDER
| SWP_NOACTIVATE
);
650 static HRESULT WINAPI
OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject
*iface
)
652 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
653 FIXME("(%p)\n", This
);
657 #undef INPLACEOBJ_THIS
659 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl
=
661 OleInPlaceObject_QueryInterface
,
662 OleInPlaceObject_AddRef
,
663 OleInPlaceObject_Release
,
664 OleInPlaceObject_GetWindow
,
665 OleInPlaceObject_ContextSensitiveHelp
,
666 OleInPlaceObject_InPlaceDeactivate
,
667 OleInPlaceObject_UIDeactivate
,
668 OleInPlaceObject_SetObjectRects
,
669 OleInPlaceObject_ReactivateAndUndo
672 /**********************************************************************
673 * Implement the IOleControl interface
676 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
678 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
,
679 REFIID riid
, LPVOID
*ppobj
)
681 WebBrowser
*This
= CONTROL_THIS(iface
);
682 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
685 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
687 WebBrowser
*This
= CONTROL_THIS(iface
);
688 return IWebBrowser_AddRef(WEBBROWSER(This
));
691 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
693 WebBrowser
*This
= CONTROL_THIS(iface
);
694 return IWebBrowser_Release(WEBBROWSER(This
));
697 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, LPCONTROLINFO pCI
)
699 WebBrowser
*This
= CONTROL_THIS(iface
);
701 TRACE("(%p)->(%p)\n", This
, pCI
);
703 /* Tests show that this function should be not implemented */
707 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, struct tagMSG
*pMsg
)
709 WebBrowser
*This
= CONTROL_THIS(iface
);
710 FIXME("(%p)->(%p)\n", This
, pMsg
);
714 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
716 WebBrowser
*This
= CONTROL_THIS(iface
);
718 TRACE("(%p)->(%d)\n", This
, dispID
);
721 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
722 return on_offlineconnected_change(This
);
723 case DISPID_AMBIENT_SILENT
:
724 return on_silent_change(This
);
727 FIXME("Unknown dispID %d\n", dispID
);
731 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
733 WebBrowser
*This
= CONTROL_THIS(iface
);
734 FIXME("(%p)->(%x)\n", This
, bFreeze
);
740 static const IOleControlVtbl OleControlVtbl
=
742 OleControl_QueryInterface
,
745 OleControl_GetControlInfo
,
746 OleControl_OnMnemonic
,
747 OleControl_OnAmbientPropertyChange
,
748 OleControl_FreezeEvents
751 #define ACTIVEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceActiveObject, iface)
753 static HRESULT WINAPI
InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
*iface
,
754 REFIID riid
, void **ppv
)
756 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
757 return IWebBrowser2_QueryInterface(WEBBROWSER2(This
), riid
, ppv
);
760 static ULONG WINAPI
InPlaceActiveObject_AddRef(IOleInPlaceActiveObject
*iface
)
762 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
763 return IWebBrowser2_AddRef(WEBBROWSER2(This
));
766 static ULONG WINAPI
InPlaceActiveObject_Release(IOleInPlaceActiveObject
*iface
)
768 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
769 return IWebBrowser2_Release(WEBBROWSER2(This
));
772 static HRESULT WINAPI
InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject
*iface
,
775 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
776 return IOleInPlaceObject_GetWindow(INPLACEOBJ(This
), phwnd
);
779 static HRESULT WINAPI
InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
,
782 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
783 return IOleInPlaceObject_ContextSensitiveHelp(INPLACEOBJ(This
), fEnterMode
);
786 static HRESULT WINAPI
InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
,
789 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
790 FIXME("(%p)->(%p)\n", This
, lpmsg
);
794 static HRESULT WINAPI
InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
797 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
798 FIXME("(%p)->(%x)\n", This
, fActivate
);
802 static HRESULT WINAPI
InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
,
805 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
806 FIXME("(%p)->(%x)\n", This
, fActivate
);
810 static HRESULT WINAPI
InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
,
811 LPCRECT lprcBorder
, IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
813 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
814 FIXME("(%p)->(%p %p %x)\n", This
, lprcBorder
, pUIWindow
, fFrameWindow
);
818 static HRESULT WINAPI
InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
,
821 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
822 FIXME("(%p)->(%x)\n", This
, fEnable
);
826 #undef ACTIVEOBJ_THIS
828 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
829 InPlaceActiveObject_QueryInterface
,
830 InPlaceActiveObject_AddRef
,
831 InPlaceActiveObject_Release
,
832 InPlaceActiveObject_GetWindow
,
833 InPlaceActiveObject_ContextSensitiveHelp
,
834 InPlaceActiveObject_TranslateAccelerator
,
835 InPlaceActiveObject_OnFrameWindowActivate
,
836 InPlaceActiveObject_OnDocWindowActivate
,
837 InPlaceActiveObject_ResizeBorder
,
838 InPlaceActiveObject_EnableModeless
841 #define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, OleCommandTarget, iface)
843 static HRESULT WINAPI
WBOleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
844 REFIID riid
, void **ppv
)
846 WebBrowser
*This
= OLECMD_THIS(iface
);
847 return IWebBrowser2_QueryInterface(WEBBROWSER(This
), riid
, ppv
);
850 static ULONG WINAPI
WBOleCommandTarget_AddRef(IOleCommandTarget
*iface
)
852 WebBrowser
*This
= OLECMD_THIS(iface
);
853 return IWebBrowser2_AddRef(WEBBROWSER(This
));
856 static ULONG WINAPI
WBOleCommandTarget_Release(IOleCommandTarget
*iface
)
858 WebBrowser
*This
= OLECMD_THIS(iface
);
859 return IWebBrowser2_Release(WEBBROWSER(This
));
862 static HRESULT WINAPI
WBOleCommandTarget_QueryStatus(IOleCommandTarget
*iface
,
863 const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
865 WebBrowser
*This
= OLECMD_THIS(iface
);
866 FIXME("(%p)->(%s %u %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
,
871 static HRESULT WINAPI
WBOleCommandTarget_Exec(IOleCommandTarget
*iface
,
872 const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
,
875 WebBrowser
*This
= OLECMD_THIS(iface
);
876 FIXME("(%p)->(%s %d %d %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), nCmdID
,
877 nCmdexecopt
, pvaIn
, pvaOut
);
883 static const IOleCommandTargetVtbl OleCommandTargetVtbl
= {
884 WBOleCommandTarget_QueryInterface
,
885 WBOleCommandTarget_AddRef
,
886 WBOleCommandTarget_Release
,
887 WBOleCommandTarget_QueryStatus
,
888 WBOleCommandTarget_Exec
891 void WebBrowser_OleObject_Init(WebBrowser
*This
)
893 This
->lpOleObjectVtbl
= &OleObjectVtbl
;
894 This
->lpOleInPlaceObjectVtbl
= &OleInPlaceObjectVtbl
;
895 This
->lpOleControlVtbl
= &OleControlVtbl
;
896 This
->lpOleInPlaceActiveObjectVtbl
= &OleInPlaceActiveObjectVtbl
;
897 This
->lpOleCommandTargetVtbl
= &OleCommandTargetVtbl
;
900 This
->inplace
= NULL
;
901 This
->container
= NULL
;
902 This
->frame_hwnd
= NULL
;
903 This
->uiwindow
= NULL
;
904 This
->shell_embedding_hwnd
= NULL
;
906 memset(&This
->pos_rect
, 0, sizeof(RECT
));
907 memset(&This
->clip_rect
, 0, sizeof(RECT
));
908 memset(&This
->frameinfo
, 0, sizeof(OLEINPLACEFRAMEINFO
));
910 This
->extent
.cx
= 1323;
911 This
->extent
.cy
= 529;
914 void WebBrowser_OleObject_Destroy(WebBrowser
*This
)
917 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
919 IOleContainer_Release(This
->container
);
921 IOleInPlaceUIWindow_Release(This
->uiwindow
);