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
));
66 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
69 static void create_shell_embedding_hwnd(WebBrowser
*This
)
71 IOleInPlaceSite
*inplace
;
75 static const WCHAR wszShellEmbedding
[] =
76 {'S','h','e','l','l',' ','E','m','b','e','d','d','i','n','g',0};
78 if(!shell_embedding_atom
) {
79 static WNDCLASSEXW wndclass
= {
83 0, 0 /* native uses 8 */, NULL
, NULL
, NULL
,
84 (HBRUSH
)COLOR_WINDOWFRAME
, NULL
,
88 wndclass
.hInstance
= shdocvw_hinstance
;
90 RegisterClassExW(&wndclass
);
93 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleInPlaceSite
, (void**)&inplace
);
95 IOleInPlaceSite_GetWindow(inplace
, &parent
);
96 IOleInPlaceSite_Release(inplace
);
99 This
->doc_host
.frame_hwnd
= This
->shell_embedding_hwnd
= CreateWindowExW(
101 wszShellEmbedding
, wszShellEmbedding
,
102 WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
103 | (parent
? WS_CHILD
| WS_TABSTOP
: WS_POPUP
| WS_MAXIMIZEBOX
),
105 NULL
, shdocvw_hinstance
, This
);
107 TRACE("parent=%p hwnd=%p\n", parent
, This
->shell_embedding_hwnd
);
110 static HRESULT
activate_inplace(WebBrowser
*This
, IOleClientSite
*active_site
)
121 hres
= IOleClientSite_QueryInterface(active_site
, &IID_IOleInPlaceSite
,
122 (void**)&This
->inplace
);
124 WARN("Could not get IOleInPlaceSite\n");
128 hres
= IOleInPlaceSite_CanInPlaceActivate(This
->inplace
);
130 WARN("CanInPlaceActivate returned: %08x\n", hres
);
131 IOleInPlaceSite_Release(This
->inplace
);
135 hres
= IOleInPlaceSite_GetWindow(This
->inplace
, &parent_hwnd
);
137 SHSetParentHwnd(This
->shell_embedding_hwnd
, parent_hwnd
);
139 IOleInPlaceSite_OnInPlaceActivate(This
->inplace
);
141 IOleInPlaceSite_GetWindowContext(This
->inplace
, &This
->frame
, &This
->uiwindow
,
142 &This
->pos_rect
, &This
->clip_rect
,
145 SetWindowPos(This
->shell_embedding_hwnd
, NULL
,
146 This
->pos_rect
.left
, This
->pos_rect
.top
,
147 This
->pos_rect
.right
-This
->pos_rect
.left
,
148 This
->pos_rect
.bottom
-This
->pos_rect
.top
,
149 SWP_NOZORDER
| SWP_SHOWWINDOW
);
152 IOleClientSite_ShowObject(This
->client
);
153 IOleClientSite_GetContainer(This
->client
, &This
->container
);
157 IOleInPlaceFrame_GetWindow(This
->frame
, &This
->frame_hwnd
);
162 static HRESULT
activate_ui(WebBrowser
*This
, IOleClientSite
*active_site
)
166 static const WCHAR wszitem
[] = {'i','t','e','m',0};
171 hres
= activate_inplace(This
, active_site
);
175 IOleInPlaceSite_OnUIActivate(This
->inplace
);
178 IOleInPlaceFrame_SetActiveObject(This
->frame
, ACTIVEOBJ(This
), wszitem
);
180 IOleInPlaceUIWindow_SetActiveObject(This
->uiwindow
, ACTIVEOBJ(This
), wszitem
);
183 IOleInPlaceFrame_SetMenu(This
->frame
, NULL
, NULL
, This
->shell_embedding_hwnd
);
185 SetFocus(This
->shell_embedding_hwnd
);
190 static HRESULT
get_client_disp_property(IOleClientSite
*client
, DISPID dispid
, VARIANT
*res
)
192 IDispatch
*disp
= NULL
;
193 DISPPARAMS dispparams
= {NULL
, 0};
201 hres
= IOleClientSite_QueryInterface(client
, &IID_IDispatch
, (void**)&disp
);
203 TRACE("Could not get IDispatch\n");
207 hres
= IDispatch_Invoke(disp
, dispid
, &IID_NULL
, LOCALE_SYSTEM_DEFAULT
,
208 DISPATCH_PROPERTYGET
, &dispparams
, res
, NULL
, NULL
);
210 IDispatch_Release(disp
);
215 static HRESULT
on_offlineconnected_change(WebBrowser
*This
)
219 get_client_disp_property(This
->client
, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
, &offline
);
221 if(V_VT(&offline
) == VT_BOOL
)
222 IWebBrowser2_put_Offline(WEBBROWSER2(This
), V_BOOL(&offline
));
223 else if(V_VT(&offline
) != VT_EMPTY
)
224 WARN("wrong V_VT(silent) %d\n", V_VT(&offline
));
229 static HRESULT
on_silent_change(WebBrowser
*This
)
233 get_client_disp_property(This
->client
, DISPID_AMBIENT_SILENT
, &silent
);
235 if(V_VT(&silent
) == VT_BOOL
)
236 IWebBrowser2_put_Silent(WEBBROWSER2(This
), V_BOOL(&silent
));
237 else if(V_VT(&silent
) != VT_EMPTY
)
238 WARN("wrong V_VT(silent) %d\n", V_VT(&silent
));
243 /**********************************************************************
244 * Implement the IOleObject interface for the WebBrowser control
247 #define OLEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
249 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
251 WebBrowser
*This
= OLEOBJ_THIS(iface
);
252 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppv
);
255 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
257 WebBrowser
*This
= OLEOBJ_THIS(iface
);
258 return IWebBrowser_AddRef(WEBBROWSER(This
));
261 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
263 WebBrowser
*This
= OLEOBJ_THIS(iface
);
264 return IWebBrowser_Release(WEBBROWSER(This
));
267 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, LPOLECLIENTSITE pClientSite
)
269 WebBrowser
*This
= OLEOBJ_THIS(iface
);
270 IOleContainer
*container
;
273 TRACE("(%p)->(%p)\n", This
, pClientSite
);
275 if(This
->client
== pClientSite
)
278 if(This
->doc_host
.hwnd
) {
279 DestroyWindow(This
->doc_host
.hwnd
);
280 This
->doc_host
.hwnd
= NULL
;
282 if(This
->shell_embedding_hwnd
) {
283 DestroyWindow(This
->shell_embedding_hwnd
);
284 This
->shell_embedding_hwnd
= NULL
;
288 IOleInPlaceSite_Release(This
->inplace
);
289 This
->inplace
= NULL
;
292 if(This
->doc_host
.hostui
)
293 IDocHostUIHandler_Release(This
->doc_host
.hostui
);
295 IOleClientSite_Release(This
->client
);
298 if(This
->doc_host
.document
)
299 deactivate_document(&This
->doc_host
);
304 This
->client
= pClientSite
;
305 IOleClientSite_AddRef(pClientSite
);
307 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IDocHostUIHandler
,
308 (void**)&This
->doc_host
.hostui
);
310 This
->doc_host
.hostui
= NULL
;
312 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
313 if(SUCCEEDED(hres
)) {
314 ITargetContainer
*target_container
;
316 hres
= IOleContainer_QueryInterface(container
, &IID_ITargetContainer
,
317 (void**)&target_container
);
318 if(SUCCEEDED(hres
)) {
319 FIXME("Unsupported ITargetContainer\n");
320 ITargetContainer_Release(target_container
);
323 IOleContainer_Release(container
);
326 create_shell_embedding_hwnd(This
);
328 on_offlineconnected_change(This
);
329 on_silent_change(This
);
334 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, LPOLECLIENTSITE
*ppClientSite
)
336 WebBrowser
*This
= OLEOBJ_THIS(iface
);
338 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
344 IOleClientSite_AddRef(This
->client
);
345 *ppClientSite
= This
->client
;
350 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
,
351 LPCOLESTR szContainerObj
)
353 WebBrowser
*This
= OLEOBJ_THIS(iface
);
354 FIXME("(%p)->(%s, %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
358 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
360 WebBrowser
*This
= OLEOBJ_THIS(iface
);
361 FIXME("(%p)->(%d)\n", This
, dwSaveOption
);
365 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
* pmk
)
367 WebBrowser
*This
= OLEOBJ_THIS(iface
);
368 FIXME("(%p)->(%d, %p)\n", This
, dwWhichMoniker
, pmk
);
372 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
,
373 DWORD dwWhichMoniker
, LPMONIKER
*ppmk
)
375 WebBrowser
*This
= OLEOBJ_THIS(iface
);
376 FIXME("(%p)->(%d, %d, %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
380 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, LPDATAOBJECT pDataObject
,
381 BOOL fCreation
, DWORD dwReserved
)
383 WebBrowser
*This
= OLEOBJ_THIS(iface
);
384 FIXME("(%p)->(%p, %d, %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
388 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
,
389 LPDATAOBJECT
*ppDataObject
)
391 WebBrowser
*This
= OLEOBJ_THIS(iface
);
392 FIXME("(%p)->(%d, %p)\n", This
, dwReserved
, ppDataObject
);
396 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, struct tagMSG
* lpmsg
,
397 LPOLECLIENTSITE pActiveSite
, LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
399 WebBrowser
*This
= OLEOBJ_THIS(iface
);
401 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
,
407 TRACE("OLEIVERB_SHOW\n");
408 return activate_ui(This
, pActiveSite
);
409 case OLEIVERB_UIACTIVATE
:
410 TRACE("OLEIVERB_UIACTIVATE\n");
411 return activate_ui(This
, pActiveSite
);
412 case OLEIVERB_INPLACEACTIVATE
:
413 TRACE("OLEIVERB_INPLACEACTIVATE\n");
414 return activate_inplace(This
, pActiveSite
);
416 FIXME("stub for %d\n", iVerb
);
423 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
425 WebBrowser
*This
= OLEOBJ_THIS(iface
);
426 TRACE("(%p)->(%p)\n", This
, ppEnumOleVerb
);
427 return OleRegEnumVerbs(&CLSID_WebBrowser
, ppEnumOleVerb
);
430 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
432 WebBrowser
*This
= OLEOBJ_THIS(iface
);
433 FIXME("(%p)\n", This
);
437 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
439 WebBrowser
*This
= OLEOBJ_THIS(iface
);
440 FIXME("(%p)\n", This
);
444 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
* pClsid
)
446 WebBrowser
*This
= OLEOBJ_THIS(iface
);
447 FIXME("(%p)->(%p)\n", This
, pClsid
);
451 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
,
452 LPOLESTR
* pszUserType
)
454 WebBrowser
*This
= OLEOBJ_THIS(iface
);
455 TRACE("(%p, %d, %p)\n", This
, dwFormOfType
, pszUserType
);
456 return OleRegGetUserType(&CLSID_WebBrowser
, dwFormOfType
, pszUserType
);
459 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
461 WebBrowser
*This
= OLEOBJ_THIS(iface
);
463 TRACE("(%p)->(%x %p)\n", This
, dwDrawAspect
, psizel
);
465 /* Tests show that dwDrawAspect is ignored */
466 memcpy(&This
->extent
, psizel
, sizeof(SIZEL
));
470 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
472 WebBrowser
*This
= OLEOBJ_THIS(iface
);
474 TRACE("(%p)->(%x, %p)\n", This
, dwDrawAspect
, psizel
);
476 /* Tests show that dwDrawAspect is ignored */
477 memcpy(psizel
, &This
->extent
, sizeof(SIZEL
));
481 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
,
482 DWORD
* pdwConnection
)
484 WebBrowser
*This
= OLEOBJ_THIS(iface
);
485 FIXME("(%p)->(%p, %p)\n", This
, pAdvSink
, pdwConnection
);
489 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
491 WebBrowser
*This
= OLEOBJ_THIS(iface
);
492 FIXME("(%p)->(%d)\n", This
, dwConnection
);
496 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
498 WebBrowser
*This
= OLEOBJ_THIS(iface
);
499 FIXME("(%p)->(%p)\n", This
, ppenumAdvise
);
503 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
505 WebBrowser
*This
= OLEOBJ_THIS(iface
);
507 TRACE("(%p)->(%x, %p)\n", This
, dwAspect
, pdwStatus
);
509 *pdwStatus
= OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
510 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
;
515 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
* pLogpal
)
517 WebBrowser
*This
= OLEOBJ_THIS(iface
);
518 FIXME("(%p)->(%p)\n", This
, pLogpal
);
524 static const IOleObjectVtbl OleObjectVtbl
=
526 OleObject_QueryInterface
,
529 OleObject_SetClientSite
,
530 OleObject_GetClientSite
,
531 OleObject_SetHostNames
,
533 OleObject_SetMoniker
,
534 OleObject_GetMoniker
,
535 OleObject_InitFromData
,
536 OleObject_GetClipboardData
,
540 OleObject_IsUpToDate
,
541 OleObject_GetUserClassID
,
542 OleObject_GetUserType
,
547 OleObject_EnumAdvise
,
548 OleObject_GetMiscStatus
,
549 OleObject_SetColorScheme
552 /**********************************************************************
553 * Implement the IOleInPlaceObject interface
556 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
558 static HRESULT WINAPI
OleInPlaceObject_QueryInterface(IOleInPlaceObject
*iface
,
559 REFIID riid
, LPVOID
*ppobj
)
561 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
562 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
565 static ULONG WINAPI
OleInPlaceObject_AddRef(IOleInPlaceObject
*iface
)
567 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
568 return IWebBrowser_AddRef(WEBBROWSER(This
));
571 static ULONG WINAPI
OleInPlaceObject_Release(IOleInPlaceObject
*iface
)
573 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
574 return IWebBrowser_Release(WEBBROWSER(This
));
577 static HRESULT WINAPI
OleInPlaceObject_GetWindow(IOleInPlaceObject
*iface
, HWND
* phwnd
)
579 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
581 TRACE("(%p)->(%p)\n", This
, phwnd
);
583 *phwnd
= This
->shell_embedding_hwnd
;
587 static HRESULT WINAPI
OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject
*iface
,
590 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
591 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
595 static HRESULT WINAPI
OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject
*iface
)
597 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
598 FIXME("(%p)\n", This
);
602 static HRESULT WINAPI
OleInPlaceObject_UIDeactivate(IOleInPlaceObject
*iface
)
604 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
605 FIXME("(%p)\n", This
);
609 static HRESULT WINAPI
OleInPlaceObject_SetObjectRects(IOleInPlaceObject
*iface
,
610 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
612 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
614 TRACE("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
616 memcpy(&This
->pos_rect
, lprcPosRect
, sizeof(RECT
));
619 memcpy(&This
->clip_rect
, lprcClipRect
, sizeof(RECT
));
621 if(This
->shell_embedding_hwnd
) {
622 SetWindowPos(This
->shell_embedding_hwnd
, NULL
,
623 lprcPosRect
->left
, lprcPosRect
->top
,
624 lprcPosRect
->right
-lprcPosRect
->left
,
625 lprcPosRect
->bottom
-lprcPosRect
->top
,
626 SWP_NOZORDER
| SWP_NOACTIVATE
);
632 static HRESULT WINAPI
OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject
*iface
)
634 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
635 FIXME("(%p)\n", This
);
639 #undef INPLACEOBJ_THIS
641 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl
=
643 OleInPlaceObject_QueryInterface
,
644 OleInPlaceObject_AddRef
,
645 OleInPlaceObject_Release
,
646 OleInPlaceObject_GetWindow
,
647 OleInPlaceObject_ContextSensitiveHelp
,
648 OleInPlaceObject_InPlaceDeactivate
,
649 OleInPlaceObject_UIDeactivate
,
650 OleInPlaceObject_SetObjectRects
,
651 OleInPlaceObject_ReactivateAndUndo
654 /**********************************************************************
655 * Implement the IOleControl interface
658 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
660 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
,
661 REFIID riid
, LPVOID
*ppobj
)
663 WebBrowser
*This
= CONTROL_THIS(iface
);
664 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
667 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
669 WebBrowser
*This
= CONTROL_THIS(iface
);
670 return IWebBrowser_AddRef(WEBBROWSER(This
));
673 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
675 WebBrowser
*This
= CONTROL_THIS(iface
);
676 return IWebBrowser_Release(WEBBROWSER(This
));
679 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, LPCONTROLINFO pCI
)
681 WebBrowser
*This
= CONTROL_THIS(iface
);
683 TRACE("(%p)->(%p)\n", This
, pCI
);
685 /* Tests show that this function should be not implemented */
689 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, struct tagMSG
*pMsg
)
691 WebBrowser
*This
= CONTROL_THIS(iface
);
692 FIXME("(%p)->(%p)\n", This
, pMsg
);
696 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
698 WebBrowser
*This
= CONTROL_THIS(iface
);
700 TRACE("(%p)->(%d)\n", This
, dispID
);
703 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
704 return on_offlineconnected_change(This
);
705 case DISPID_AMBIENT_SILENT
:
706 return on_silent_change(This
);
709 FIXME("Unknown dispID %d\n", dispID
);
713 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
715 WebBrowser
*This
= CONTROL_THIS(iface
);
716 FIXME("(%p)->(%x)\n", This
, bFreeze
);
722 static const IOleControlVtbl OleControlVtbl
=
724 OleControl_QueryInterface
,
727 OleControl_GetControlInfo
,
728 OleControl_OnMnemonic
,
729 OleControl_OnAmbientPropertyChange
,
730 OleControl_FreezeEvents
733 #define ACTIVEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceActiveObject, iface)
735 static HRESULT WINAPI
InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
*iface
,
736 REFIID riid
, void **ppv
)
738 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
739 return IWebBrowser2_QueryInterface(WEBBROWSER2(This
), riid
, ppv
);
742 static ULONG WINAPI
InPlaceActiveObject_AddRef(IOleInPlaceActiveObject
*iface
)
744 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
745 return IWebBrowser2_AddRef(WEBBROWSER2(This
));
748 static ULONG WINAPI
InPlaceActiveObject_Release(IOleInPlaceActiveObject
*iface
)
750 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
751 return IWebBrowser2_Release(WEBBROWSER2(This
));
754 static HRESULT WINAPI
InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject
*iface
,
757 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
758 return IOleInPlaceObject_GetWindow(INPLACEOBJ(This
), phwnd
);
761 static HRESULT WINAPI
InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
,
764 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
765 return IOleInPlaceObject_ContextSensitiveHelp(INPLACEOBJ(This
), fEnterMode
);
768 static HRESULT WINAPI
InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
,
771 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
772 FIXME("(%p)->(%p)\n", This
, lpmsg
);
776 static HRESULT WINAPI
InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
779 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
780 FIXME("(%p)->(%x)\n", This
, fActivate
);
784 static HRESULT WINAPI
InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
,
787 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
788 FIXME("(%p)->(%x)\n", This
, fActivate
);
792 static HRESULT WINAPI
InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
,
793 LPCRECT lprcBorder
, IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
795 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
796 FIXME("(%p)->(%p %p %x)\n", This
, lprcBorder
, pUIWindow
, fFrameWindow
);
800 static HRESULT WINAPI
InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
,
803 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
804 FIXME("(%p)->(%x)\n", This
, fEnable
);
808 #undef ACTIVEOBJ_THIS
810 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
811 InPlaceActiveObject_QueryInterface
,
812 InPlaceActiveObject_AddRef
,
813 InPlaceActiveObject_Release
,
814 InPlaceActiveObject_GetWindow
,
815 InPlaceActiveObject_ContextSensitiveHelp
,
816 InPlaceActiveObject_TranslateAccelerator
,
817 InPlaceActiveObject_OnFrameWindowActivate
,
818 InPlaceActiveObject_OnDocWindowActivate
,
819 InPlaceActiveObject_ResizeBorder
,
820 InPlaceActiveObject_EnableModeless
823 #define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, OleCommandTarget, iface)
825 static HRESULT WINAPI
WBOleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
826 REFIID riid
, void **ppv
)
828 WebBrowser
*This
= OLECMD_THIS(iface
);
829 return IWebBrowser2_QueryInterface(WEBBROWSER(This
), riid
, ppv
);
832 static ULONG WINAPI
WBOleCommandTarget_AddRef(IOleCommandTarget
*iface
)
834 WebBrowser
*This
= OLECMD_THIS(iface
);
835 return IWebBrowser2_AddRef(WEBBROWSER(This
));
838 static ULONG WINAPI
WBOleCommandTarget_Release(IOleCommandTarget
*iface
)
840 WebBrowser
*This
= OLECMD_THIS(iface
);
841 return IWebBrowser2_Release(WEBBROWSER(This
));
844 static HRESULT WINAPI
WBOleCommandTarget_QueryStatus(IOleCommandTarget
*iface
,
845 const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
847 WebBrowser
*This
= OLECMD_THIS(iface
);
848 FIXME("(%p)->(%s %u %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
,
853 static HRESULT WINAPI
WBOleCommandTarget_Exec(IOleCommandTarget
*iface
,
854 const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
,
857 WebBrowser
*This
= OLECMD_THIS(iface
);
858 FIXME("(%p)->(%s %d %d %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), nCmdID
,
859 nCmdexecopt
, pvaIn
, pvaOut
);
865 static const IOleCommandTargetVtbl OleCommandTargetVtbl
= {
866 WBOleCommandTarget_QueryInterface
,
867 WBOleCommandTarget_AddRef
,
868 WBOleCommandTarget_Release
,
869 WBOleCommandTarget_QueryStatus
,
870 WBOleCommandTarget_Exec
873 void WebBrowser_OleObject_Init(WebBrowser
*This
)
875 This
->lpOleObjectVtbl
= &OleObjectVtbl
;
876 This
->lpOleInPlaceObjectVtbl
= &OleInPlaceObjectVtbl
;
877 This
->lpOleControlVtbl
= &OleControlVtbl
;
878 This
->lpOleInPlaceActiveObjectVtbl
= &OleInPlaceActiveObjectVtbl
;
879 This
->lpOleCommandTargetVtbl
= &OleCommandTargetVtbl
;
882 This
->inplace
= NULL
;
883 This
->container
= NULL
;
884 This
->frame_hwnd
= NULL
;
886 This
->uiwindow
= NULL
;
887 This
->shell_embedding_hwnd
= NULL
;
889 memset(&This
->pos_rect
, 0, sizeof(RECT
));
890 memset(&This
->clip_rect
, 0, sizeof(RECT
));
891 memset(&This
->frameinfo
, 0, sizeof(OLEINPLACEFRAMEINFO
));
893 This
->extent
.cx
= 1323;
894 This
->extent
.cy
= 529;
897 void WebBrowser_OleObject_Destroy(WebBrowser
*This
)
900 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
902 IOleContainer_Release(This
->container
);
904 IOleInPlaceFrame_Release(This
->frame
);
906 IOleInPlaceUIWindow_Release(This
->uiwindow
);