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
->doc_host
.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
);
156 if(This
->doc_host
.frame
)
157 IOleInPlaceFrame_GetWindow(This
->doc_host
.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
);
177 if(This
->doc_host
.frame
)
178 IOleInPlaceFrame_SetActiveObject(This
->doc_host
.frame
, ACTIVEOBJ(This
), wszitem
);
180 IOleInPlaceUIWindow_SetActiveObject(This
->uiwindow
, ACTIVEOBJ(This
), wszitem
);
182 if(This
->doc_host
.frame
)
183 IOleInPlaceFrame_SetMenu(This
->doc_host
.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
);
294 This
->doc_host
.hostui
= NULL
;
298 IOleClientSite_Release(This
->client
);
300 This
->client
= pClientSite
;
303 if(This
->doc_host
.document
)
304 deactivate_document(&This
->doc_host
);
308 IOleClientSite_AddRef(pClientSite
);
310 IOleClientSite_QueryInterface(This
->client
, &IID_IDispatch
,
311 (void**)&This
->doc_host
.client_disp
);
313 IOleClientSite_QueryInterface(This
->client
, &IID_IDocHostUIHandler
,
314 (void**)&This
->doc_host
.hostui
);
316 hres
= IOleClientSite_GetContainer(This
->client
, &container
);
317 if(SUCCEEDED(hres
)) {
318 ITargetContainer
*target_container
;
320 hres
= IOleContainer_QueryInterface(container
, &IID_ITargetContainer
,
321 (void**)&target_container
);
322 if(SUCCEEDED(hres
)) {
323 FIXME("Unsupported ITargetContainer\n");
324 ITargetContainer_Release(target_container
);
327 IOleContainer_Release(container
);
330 create_shell_embedding_hwnd(This
);
332 on_offlineconnected_change(This
);
333 on_silent_change(This
);
338 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, LPOLECLIENTSITE
*ppClientSite
)
340 WebBrowser
*This
= OLEOBJ_THIS(iface
);
342 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
348 IOleClientSite_AddRef(This
->client
);
349 *ppClientSite
= This
->client
;
354 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
,
355 LPCOLESTR szContainerObj
)
357 WebBrowser
*This
= OLEOBJ_THIS(iface
);
359 TRACE("(%p)->(%s, %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
361 /* We have nothing to do here. */
365 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
367 WebBrowser
*This
= OLEOBJ_THIS(iface
);
368 FIXME("(%p)->(%d)\n", This
, dwSaveOption
);
372 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
* pmk
)
374 WebBrowser
*This
= OLEOBJ_THIS(iface
);
375 FIXME("(%p)->(%d, %p)\n", This
, dwWhichMoniker
, pmk
);
379 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
,
380 DWORD dwWhichMoniker
, LPMONIKER
*ppmk
)
382 WebBrowser
*This
= OLEOBJ_THIS(iface
);
383 FIXME("(%p)->(%d, %d, %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
387 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, LPDATAOBJECT pDataObject
,
388 BOOL fCreation
, DWORD dwReserved
)
390 WebBrowser
*This
= OLEOBJ_THIS(iface
);
391 FIXME("(%p)->(%p, %d, %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
395 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
,
396 LPDATAOBJECT
*ppDataObject
)
398 WebBrowser
*This
= OLEOBJ_THIS(iface
);
399 FIXME("(%p)->(%d, %p)\n", This
, dwReserved
, ppDataObject
);
403 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, struct tagMSG
* lpmsg
,
404 LPOLECLIENTSITE pActiveSite
, LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
406 WebBrowser
*This
= OLEOBJ_THIS(iface
);
408 TRACE("(%p)->(%d %p %p %d %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
,
414 TRACE("OLEIVERB_SHOW\n");
415 return activate_ui(This
, pActiveSite
);
416 case OLEIVERB_UIACTIVATE
:
417 TRACE("OLEIVERB_UIACTIVATE\n");
418 return activate_ui(This
, pActiveSite
);
419 case OLEIVERB_INPLACEACTIVATE
:
420 TRACE("OLEIVERB_INPLACEACTIVATE\n");
421 return activate_inplace(This
, pActiveSite
);
423 TRACE("OLEIVERB_HIDE\n");
424 if(This
->doc_host
.hwnd
)
425 ShowWindow(This
->doc_host
.hwnd
, SW_HIDE
);
428 FIXME("stub for %d\n", iVerb
);
435 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
437 WebBrowser
*This
= OLEOBJ_THIS(iface
);
438 TRACE("(%p)->(%p)\n", This
, ppEnumOleVerb
);
439 return OleRegEnumVerbs(&CLSID_WebBrowser
, ppEnumOleVerb
);
442 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
444 WebBrowser
*This
= OLEOBJ_THIS(iface
);
445 FIXME("(%p)\n", This
);
449 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
451 WebBrowser
*This
= OLEOBJ_THIS(iface
);
452 FIXME("(%p)\n", This
);
456 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
* pClsid
)
458 WebBrowser
*This
= OLEOBJ_THIS(iface
);
459 FIXME("(%p)->(%p)\n", This
, pClsid
);
463 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
,
464 LPOLESTR
* pszUserType
)
466 WebBrowser
*This
= OLEOBJ_THIS(iface
);
467 TRACE("(%p, %d, %p)\n", This
, dwFormOfType
, pszUserType
);
468 return OleRegGetUserType(&CLSID_WebBrowser
, dwFormOfType
, pszUserType
);
471 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
473 WebBrowser
*This
= OLEOBJ_THIS(iface
);
475 TRACE("(%p)->(%x %p)\n", This
, dwDrawAspect
, psizel
);
477 /* Tests show that dwDrawAspect is ignored */
478 memcpy(&This
->extent
, psizel
, sizeof(SIZEL
));
482 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
484 WebBrowser
*This
= OLEOBJ_THIS(iface
);
486 TRACE("(%p)->(%x, %p)\n", This
, dwDrawAspect
, psizel
);
488 /* Tests show that dwDrawAspect is ignored */
489 memcpy(psizel
, &This
->extent
, sizeof(SIZEL
));
493 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
,
494 DWORD
* pdwConnection
)
496 WebBrowser
*This
= OLEOBJ_THIS(iface
);
497 FIXME("(%p)->(%p, %p)\n", This
, pAdvSink
, pdwConnection
);
501 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
503 WebBrowser
*This
= OLEOBJ_THIS(iface
);
504 FIXME("(%p)->(%d)\n", This
, dwConnection
);
508 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
510 WebBrowser
*This
= OLEOBJ_THIS(iface
);
511 FIXME("(%p)->(%p)\n", This
, ppenumAdvise
);
515 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
517 WebBrowser
*This
= OLEOBJ_THIS(iface
);
519 TRACE("(%p)->(%x, %p)\n", This
, dwAspect
, pdwStatus
);
521 *pdwStatus
= OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
522 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
;
527 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
* pLogpal
)
529 WebBrowser
*This
= OLEOBJ_THIS(iface
);
530 FIXME("(%p)->(%p)\n", This
, pLogpal
);
536 static const IOleObjectVtbl OleObjectVtbl
=
538 OleObject_QueryInterface
,
541 OleObject_SetClientSite
,
542 OleObject_GetClientSite
,
543 OleObject_SetHostNames
,
545 OleObject_SetMoniker
,
546 OleObject_GetMoniker
,
547 OleObject_InitFromData
,
548 OleObject_GetClipboardData
,
552 OleObject_IsUpToDate
,
553 OleObject_GetUserClassID
,
554 OleObject_GetUserType
,
559 OleObject_EnumAdvise
,
560 OleObject_GetMiscStatus
,
561 OleObject_SetColorScheme
564 /**********************************************************************
565 * Implement the IOleInPlaceObject interface
568 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
570 static HRESULT WINAPI
OleInPlaceObject_QueryInterface(IOleInPlaceObject
*iface
,
571 REFIID riid
, LPVOID
*ppobj
)
573 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
574 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
577 static ULONG WINAPI
OleInPlaceObject_AddRef(IOleInPlaceObject
*iface
)
579 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
580 return IWebBrowser_AddRef(WEBBROWSER(This
));
583 static ULONG WINAPI
OleInPlaceObject_Release(IOleInPlaceObject
*iface
)
585 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
586 return IWebBrowser_Release(WEBBROWSER(This
));
589 static HRESULT WINAPI
OleInPlaceObject_GetWindow(IOleInPlaceObject
*iface
, HWND
* phwnd
)
591 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
593 TRACE("(%p)->(%p)\n", This
, phwnd
);
595 *phwnd
= This
->shell_embedding_hwnd
;
599 static HRESULT WINAPI
OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject
*iface
,
602 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
603 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
607 static HRESULT WINAPI
OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject
*iface
)
609 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
610 FIXME("(%p)\n", This
);
614 static HRESULT WINAPI
OleInPlaceObject_UIDeactivate(IOleInPlaceObject
*iface
)
616 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
617 FIXME("(%p)\n", This
);
621 static HRESULT WINAPI
OleInPlaceObject_SetObjectRects(IOleInPlaceObject
*iface
,
622 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
624 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
626 TRACE("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
628 memcpy(&This
->pos_rect
, lprcPosRect
, sizeof(RECT
));
631 memcpy(&This
->clip_rect
, lprcClipRect
, sizeof(RECT
));
633 if(This
->shell_embedding_hwnd
) {
634 SetWindowPos(This
->shell_embedding_hwnd
, NULL
,
635 lprcPosRect
->left
, lprcPosRect
->top
,
636 lprcPosRect
->right
-lprcPosRect
->left
,
637 lprcPosRect
->bottom
-lprcPosRect
->top
,
638 SWP_NOZORDER
| SWP_NOACTIVATE
);
644 static HRESULT WINAPI
OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject
*iface
)
646 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
647 FIXME("(%p)\n", This
);
651 #undef INPLACEOBJ_THIS
653 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl
=
655 OleInPlaceObject_QueryInterface
,
656 OleInPlaceObject_AddRef
,
657 OleInPlaceObject_Release
,
658 OleInPlaceObject_GetWindow
,
659 OleInPlaceObject_ContextSensitiveHelp
,
660 OleInPlaceObject_InPlaceDeactivate
,
661 OleInPlaceObject_UIDeactivate
,
662 OleInPlaceObject_SetObjectRects
,
663 OleInPlaceObject_ReactivateAndUndo
666 /**********************************************************************
667 * Implement the IOleControl interface
670 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
672 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
,
673 REFIID riid
, LPVOID
*ppobj
)
675 WebBrowser
*This
= CONTROL_THIS(iface
);
676 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
679 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
681 WebBrowser
*This
= CONTROL_THIS(iface
);
682 return IWebBrowser_AddRef(WEBBROWSER(This
));
685 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
687 WebBrowser
*This
= CONTROL_THIS(iface
);
688 return IWebBrowser_Release(WEBBROWSER(This
));
691 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, LPCONTROLINFO pCI
)
693 WebBrowser
*This
= CONTROL_THIS(iface
);
695 TRACE("(%p)->(%p)\n", This
, pCI
);
697 /* Tests show that this function should be not implemented */
701 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, struct tagMSG
*pMsg
)
703 WebBrowser
*This
= CONTROL_THIS(iface
);
704 FIXME("(%p)->(%p)\n", This
, pMsg
);
708 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
710 WebBrowser
*This
= CONTROL_THIS(iface
);
712 TRACE("(%p)->(%d)\n", This
, dispID
);
715 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
:
716 return on_offlineconnected_change(This
);
717 case DISPID_AMBIENT_SILENT
:
718 return on_silent_change(This
);
721 FIXME("Unknown dispID %d\n", dispID
);
725 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
727 WebBrowser
*This
= CONTROL_THIS(iface
);
728 FIXME("(%p)->(%x)\n", This
, bFreeze
);
734 static const IOleControlVtbl OleControlVtbl
=
736 OleControl_QueryInterface
,
739 OleControl_GetControlInfo
,
740 OleControl_OnMnemonic
,
741 OleControl_OnAmbientPropertyChange
,
742 OleControl_FreezeEvents
745 #define ACTIVEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceActiveObject, iface)
747 static HRESULT WINAPI
InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject
*iface
,
748 REFIID riid
, void **ppv
)
750 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
751 return IWebBrowser2_QueryInterface(WEBBROWSER2(This
), riid
, ppv
);
754 static ULONG WINAPI
InPlaceActiveObject_AddRef(IOleInPlaceActiveObject
*iface
)
756 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
757 return IWebBrowser2_AddRef(WEBBROWSER2(This
));
760 static ULONG WINAPI
InPlaceActiveObject_Release(IOleInPlaceActiveObject
*iface
)
762 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
763 return IWebBrowser2_Release(WEBBROWSER2(This
));
766 static HRESULT WINAPI
InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject
*iface
,
769 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
770 return IOleInPlaceObject_GetWindow(INPLACEOBJ(This
), phwnd
);
773 static HRESULT WINAPI
InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject
*iface
,
776 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
777 return IOleInPlaceObject_ContextSensitiveHelp(INPLACEOBJ(This
), fEnterMode
);
780 static HRESULT WINAPI
InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject
*iface
,
783 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
784 FIXME("(%p)->(%p)\n", This
, lpmsg
);
788 static HRESULT WINAPI
InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject
*iface
,
791 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
792 FIXME("(%p)->(%x)\n", This
, fActivate
);
796 static HRESULT WINAPI
InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject
*iface
,
799 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
800 FIXME("(%p)->(%x)\n", This
, fActivate
);
804 static HRESULT WINAPI
InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject
*iface
,
805 LPCRECT lprcBorder
, IOleInPlaceUIWindow
*pUIWindow
, BOOL fFrameWindow
)
807 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
808 FIXME("(%p)->(%p %p %x)\n", This
, lprcBorder
, pUIWindow
, fFrameWindow
);
812 static HRESULT WINAPI
InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject
*iface
,
815 WebBrowser
*This
= ACTIVEOBJ_THIS(iface
);
816 FIXME("(%p)->(%x)\n", This
, fEnable
);
820 #undef ACTIVEOBJ_THIS
822 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl
= {
823 InPlaceActiveObject_QueryInterface
,
824 InPlaceActiveObject_AddRef
,
825 InPlaceActiveObject_Release
,
826 InPlaceActiveObject_GetWindow
,
827 InPlaceActiveObject_ContextSensitiveHelp
,
828 InPlaceActiveObject_TranslateAccelerator
,
829 InPlaceActiveObject_OnFrameWindowActivate
,
830 InPlaceActiveObject_OnDocWindowActivate
,
831 InPlaceActiveObject_ResizeBorder
,
832 InPlaceActiveObject_EnableModeless
835 #define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, OleCommandTarget, iface)
837 static HRESULT WINAPI
WBOleCommandTarget_QueryInterface(IOleCommandTarget
*iface
,
838 REFIID riid
, void **ppv
)
840 WebBrowser
*This
= OLECMD_THIS(iface
);
841 return IWebBrowser2_QueryInterface(WEBBROWSER(This
), riid
, ppv
);
844 static ULONG WINAPI
WBOleCommandTarget_AddRef(IOleCommandTarget
*iface
)
846 WebBrowser
*This
= OLECMD_THIS(iface
);
847 return IWebBrowser2_AddRef(WEBBROWSER(This
));
850 static ULONG WINAPI
WBOleCommandTarget_Release(IOleCommandTarget
*iface
)
852 WebBrowser
*This
= OLECMD_THIS(iface
);
853 return IWebBrowser2_Release(WEBBROWSER(This
));
856 static HRESULT WINAPI
WBOleCommandTarget_QueryStatus(IOleCommandTarget
*iface
,
857 const GUID
*pguidCmdGroup
, ULONG cCmds
, OLECMD prgCmds
[], OLECMDTEXT
*pCmdText
)
859 WebBrowser
*This
= OLECMD_THIS(iface
);
860 FIXME("(%p)->(%s %u %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), cCmds
, prgCmds
,
865 static HRESULT WINAPI
WBOleCommandTarget_Exec(IOleCommandTarget
*iface
,
866 const GUID
*pguidCmdGroup
, DWORD nCmdID
, DWORD nCmdexecopt
, VARIANT
*pvaIn
,
869 WebBrowser
*This
= OLECMD_THIS(iface
);
870 FIXME("(%p)->(%s %d %d %p %p)\n", This
, debugstr_guid(pguidCmdGroup
), nCmdID
,
871 nCmdexecopt
, pvaIn
, pvaOut
);
877 static const IOleCommandTargetVtbl OleCommandTargetVtbl
= {
878 WBOleCommandTarget_QueryInterface
,
879 WBOleCommandTarget_AddRef
,
880 WBOleCommandTarget_Release
,
881 WBOleCommandTarget_QueryStatus
,
882 WBOleCommandTarget_Exec
885 void WebBrowser_OleObject_Init(WebBrowser
*This
)
887 This
->lpOleObjectVtbl
= &OleObjectVtbl
;
888 This
->lpOleInPlaceObjectVtbl
= &OleInPlaceObjectVtbl
;
889 This
->lpOleControlVtbl
= &OleControlVtbl
;
890 This
->lpOleInPlaceActiveObjectVtbl
= &OleInPlaceActiveObjectVtbl
;
891 This
->lpOleCommandTargetVtbl
= &OleCommandTargetVtbl
;
894 This
->inplace
= NULL
;
895 This
->container
= NULL
;
896 This
->frame_hwnd
= NULL
;
897 This
->uiwindow
= NULL
;
898 This
->shell_embedding_hwnd
= NULL
;
900 memset(&This
->pos_rect
, 0, sizeof(RECT
));
901 memset(&This
->clip_rect
, 0, sizeof(RECT
));
902 memset(&This
->frameinfo
, 0, sizeof(OLEINPLACEFRAMEINFO
));
904 This
->extent
.cx
= 1323;
905 This
->extent
.cy
= 529;
908 void WebBrowser_OleObject_Destroy(WebBrowser
*This
)
911 IOleObject_SetClientSite(OLEOBJ(This
), NULL
);
913 IOleContainer_Release(This
->container
);
915 IOleInPlaceUIWindow_Release(This
->uiwindow
);