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);
358 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
362 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
364 WebBrowser *This = OLEOBJ_THIS(iface);
365 FIXME("(%p)->(%d)\n", This, dwSaveOption);
369 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
371 WebBrowser *This = OLEOBJ_THIS(iface);
372 FIXME("(%p)->(%d, %p)\n", This, dwWhichMoniker, pmk);
376 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign,
377 DWORD dwWhichMoniker, LPMONIKER *ppmk)
379 WebBrowser *This = OLEOBJ_THIS(iface);
380 FIXME("(%p)->(%d, %d, %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
384 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, LPDATAOBJECT pDataObject,
385 BOOL fCreation, DWORD dwReserved)
387 WebBrowser *This = OLEOBJ_THIS(iface);
388 FIXME("(%p)->(%p, %d, %d)\n", This, pDataObject, fCreation, dwReserved);
392 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved,
393 LPDATAOBJECT *ppDataObject)
395 WebBrowser *This = OLEOBJ_THIS(iface);
396 FIXME("(%p)->(%d, %p)\n", This, dwReserved, ppDataObject);
400 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tagMSG* lpmsg,
401 LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
403 WebBrowser *This = OLEOBJ_THIS(iface);
405 TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
411 TRACE("OLEIVERB_SHOW\n");
412 return activate_ui(This, pActiveSite);
413 case OLEIVERB_UIACTIVATE:
414 TRACE("OLEIVERB_UIACTIVATE\n");
415 return activate_ui(This, pActiveSite);
416 case OLEIVERB_INPLACEACTIVATE:
417 TRACE("OLEIVERB_INPLACEACTIVATE\n");
418 return activate_inplace(This, pActiveSite);
420 FIXME("stub for %d\n", iVerb);
427 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
429 WebBrowser *This = OLEOBJ_THIS(iface);
430 TRACE("(%p)->(%p)\n", This, ppEnumOleVerb);
431 return OleRegEnumVerbs(&CLSID_WebBrowser, ppEnumOleVerb);
434 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
436 WebBrowser *This = OLEOBJ_THIS(iface);
437 FIXME("(%p)\n", This);
441 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
443 WebBrowser *This = OLEOBJ_THIS(iface);
444 FIXME("(%p)\n", This);
448 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID* pClsid)
450 WebBrowser *This = OLEOBJ_THIS(iface);
451 FIXME("(%p)->(%p)\n", This, pClsid);
455 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType,
456 LPOLESTR* pszUserType)
458 WebBrowser *This = OLEOBJ_THIS(iface);
459 TRACE("(%p, %d, %p)\n", This, dwFormOfType, pszUserType);
460 return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
463 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
465 WebBrowser *This = OLEOBJ_THIS(iface);
467 TRACE("(%p)->(%x %p)\n", This, dwDrawAspect, psizel);
469 /* Tests show that dwDrawAspect is ignored */
470 memcpy(&This->extent, psizel, sizeof(SIZEL));
474 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
476 WebBrowser *This = OLEOBJ_THIS(iface);
478 TRACE("(%p)->(%x, %p)\n", This, dwDrawAspect, psizel);
480 /* Tests show that dwDrawAspect is ignored */
481 memcpy(psizel, &This->extent, sizeof(SIZEL));
485 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
486 DWORD* pdwConnection)
488 WebBrowser *This = OLEOBJ_THIS(iface);
489 FIXME("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
493 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
495 WebBrowser *This = OLEOBJ_THIS(iface);
496 FIXME("(%p)->(%d)\n", This, dwConnection);
500 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
502 WebBrowser *This = OLEOBJ_THIS(iface);
503 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
507 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
509 WebBrowser *This = OLEOBJ_THIS(iface);
511 TRACE("(%p)->(%x, %p)\n", This, dwAspect, pdwStatus);
513 *pdwStatus = OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
514 |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE;
519 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE* pLogpal)
521 WebBrowser *This = OLEOBJ_THIS(iface);
522 FIXME("(%p)->(%p)\n", This, pLogpal);
528 static const IOleObjectVtbl OleObjectVtbl =
530 OleObject_QueryInterface,
533 OleObject_SetClientSite,
534 OleObject_GetClientSite,
535 OleObject_SetHostNames,
537 OleObject_SetMoniker,
538 OleObject_GetMoniker,
539 OleObject_InitFromData,
540 OleObject_GetClipboardData,
544 OleObject_IsUpToDate,
545 OleObject_GetUserClassID,
546 OleObject_GetUserType,
551 OleObject_EnumAdvise,
552 OleObject_GetMiscStatus,
553 OleObject_SetColorScheme
556 /**********************************************************************
557 * Implement the IOleInPlaceObject interface
560 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
562 static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface,
563 REFIID riid, LPVOID *ppobj)
565 WebBrowser *This = INPLACEOBJ_THIS(iface);
566 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
569 static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface)
571 WebBrowser *This = INPLACEOBJ_THIS(iface);
572 return IWebBrowser_AddRef(WEBBROWSER(This));
575 static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface)
577 WebBrowser *This = INPLACEOBJ_THIS(iface);
578 return IWebBrowser_Release(WEBBROWSER(This));
581 static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd)
583 WebBrowser *This = INPLACEOBJ_THIS(iface);
585 TRACE("(%p)->(%p)\n", This, phwnd);
587 *phwnd = This->shell_embedding_hwnd;
591 static HRESULT WINAPI OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject *iface,
594 WebBrowser *This = INPLACEOBJ_THIS(iface);
595 FIXME("(%p)->(%x)\n", This, fEnterMode);
599 static HRESULT WINAPI OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject *iface)
601 WebBrowser *This = INPLACEOBJ_THIS(iface);
602 FIXME("(%p)\n", This);
606 static HRESULT WINAPI OleInPlaceObject_UIDeactivate(IOleInPlaceObject *iface)
608 WebBrowser *This = INPLACEOBJ_THIS(iface);
609 FIXME("(%p)\n", This);
613 static HRESULT WINAPI OleInPlaceObject_SetObjectRects(IOleInPlaceObject *iface,
614 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
616 WebBrowser *This = INPLACEOBJ_THIS(iface);
618 TRACE("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
620 memcpy(&This->pos_rect, lprcPosRect, sizeof(RECT));
623 memcpy(&This->clip_rect, lprcClipRect, sizeof(RECT));
625 if(This->shell_embedding_hwnd) {
626 SetWindowPos(This->shell_embedding_hwnd, NULL,
627 lprcPosRect->left, lprcPosRect->top,
628 lprcPosRect->right-lprcPosRect->left,
629 lprcPosRect->bottom-lprcPosRect->top,
630 SWP_NOZORDER | SWP_NOACTIVATE);
636 static HRESULT WINAPI OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject *iface)
638 WebBrowser *This = INPLACEOBJ_THIS(iface);
639 FIXME("(%p)\n", This);
643 #undef INPLACEOBJ_THIS
645 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl =
647 OleInPlaceObject_QueryInterface,
648 OleInPlaceObject_AddRef,
649 OleInPlaceObject_Release,
650 OleInPlaceObject_GetWindow,
651 OleInPlaceObject_ContextSensitiveHelp,
652 OleInPlaceObject_InPlaceDeactivate,
653 OleInPlaceObject_UIDeactivate,
654 OleInPlaceObject_SetObjectRects,
655 OleInPlaceObject_ReactivateAndUndo
658 /**********************************************************************
659 * Implement the IOleControl interface
662 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
664 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface,
665 REFIID riid, LPVOID *ppobj)
667 WebBrowser *This = CONTROL_THIS(iface);
668 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
671 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
673 WebBrowser *This = CONTROL_THIS(iface);
674 return IWebBrowser_AddRef(WEBBROWSER(This));
677 static ULONG WINAPI OleControl_Release(IOleControl *iface)
679 WebBrowser *This = CONTROL_THIS(iface);
680 return IWebBrowser_Release(WEBBROWSER(This));
683 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
685 WebBrowser *This = CONTROL_THIS(iface);
687 TRACE("(%p)->(%p)\n", This, pCI);
689 /* Tests show that this function should be not implemented */
693 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, struct tagMSG *pMsg)
695 WebBrowser *This = CONTROL_THIS(iface);
696 FIXME("(%p)->(%p)\n", This, pMsg);
700 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
702 WebBrowser *This = CONTROL_THIS(iface);
704 TRACE("(%p)->(%d)\n", This, dispID);
707 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
708 return on_offlineconnected_change(This);
709 case DISPID_AMBIENT_SILENT:
710 return on_silent_change(This);
713 FIXME("Unknown dispID %d\n", dispID);
717 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
719 WebBrowser *This = CONTROL_THIS(iface);
720 FIXME("(%p)->(%x)\n", This, bFreeze);
726 static const IOleControlVtbl OleControlVtbl =
728 OleControl_QueryInterface,
731 OleControl_GetControlInfo,
732 OleControl_OnMnemonic,
733 OleControl_OnAmbientPropertyChange,
734 OleControl_FreezeEvents
737 #define ACTIVEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceActiveObject, iface)
739 static HRESULT WINAPI InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface,
740 REFIID riid, void **ppv)
742 WebBrowser *This = ACTIVEOBJ_THIS(iface);
743 return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
746 static ULONG WINAPI InPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
748 WebBrowser *This = ACTIVEOBJ_THIS(iface);
749 return IWebBrowser2_AddRef(WEBBROWSER2(This));
752 static ULONG WINAPI InPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
754 WebBrowser *This = ACTIVEOBJ_THIS(iface);
755 return IWebBrowser2_Release(WEBBROWSER2(This));
758 static HRESULT WINAPI InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface,
761 WebBrowser *This = ACTIVEOBJ_THIS(iface);
762 return IOleInPlaceObject_GetWindow(INPLACEOBJ(This), phwnd);
765 static HRESULT WINAPI InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface,
768 WebBrowser *This = ACTIVEOBJ_THIS(iface);
769 return IOleInPlaceObject_ContextSensitiveHelp(INPLACEOBJ(This), fEnterMode);
772 static HRESULT WINAPI InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface,
775 WebBrowser *This = ACTIVEOBJ_THIS(iface);
776 FIXME("(%p)->(%p)\n", This, lpmsg);
780 static HRESULT WINAPI InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
783 WebBrowser *This = ACTIVEOBJ_THIS(iface);
784 FIXME("(%p)->(%x)\n", This, fActivate);
788 static HRESULT WINAPI InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface,
791 WebBrowser *This = ACTIVEOBJ_THIS(iface);
792 FIXME("(%p)->(%x)\n", This, fActivate);
796 static HRESULT WINAPI InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface,
797 LPCRECT lprcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
799 WebBrowser *This = ACTIVEOBJ_THIS(iface);
800 FIXME("(%p)->(%p %p %x)\n", This, lprcBorder, pUIWindow, fFrameWindow);
804 static HRESULT WINAPI InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface,
807 WebBrowser *This = ACTIVEOBJ_THIS(iface);
808 FIXME("(%p)->(%x)\n", This, fEnable);
812 #undef ACTIVEOBJ_THIS
814 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
815 InPlaceActiveObject_QueryInterface,
816 InPlaceActiveObject_AddRef,
817 InPlaceActiveObject_Release,
818 InPlaceActiveObject_GetWindow,
819 InPlaceActiveObject_ContextSensitiveHelp,
820 InPlaceActiveObject_TranslateAccelerator,
821 InPlaceActiveObject_OnFrameWindowActivate,
822 InPlaceActiveObject_OnDocWindowActivate,
823 InPlaceActiveObject_ResizeBorder,
824 InPlaceActiveObject_EnableModeless
827 #define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, OleCommandTarget, iface)
829 static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
830 REFIID riid, void **ppv)
832 WebBrowser *This = OLECMD_THIS(iface);
833 return IWebBrowser2_QueryInterface(WEBBROWSER(This), riid, ppv);
836 static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface)
838 WebBrowser *This = OLECMD_THIS(iface);
839 return IWebBrowser2_AddRef(WEBBROWSER(This));
842 static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface)
844 WebBrowser *This = OLECMD_THIS(iface);
845 return IWebBrowser2_Release(WEBBROWSER(This));
848 static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
849 const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
851 WebBrowser *This = OLECMD_THIS(iface);
852 FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
857 static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,
858 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
861 WebBrowser *This = OLECMD_THIS(iface);
862 FIXME("(%p)->(%s %d %d %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
863 nCmdexecopt, pvaIn, pvaOut);
869 static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
870 WBOleCommandTarget_QueryInterface,
871 WBOleCommandTarget_AddRef,
872 WBOleCommandTarget_Release,
873 WBOleCommandTarget_QueryStatus,
874 WBOleCommandTarget_Exec
877 void WebBrowser_OleObject_Init(WebBrowser *This)
879 This->lpOleObjectVtbl = &OleObjectVtbl;
880 This->lpOleInPlaceObjectVtbl = &OleInPlaceObjectVtbl;
881 This->lpOleControlVtbl = &OleControlVtbl;
882 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
883 This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
886 This->inplace = NULL;
887 This->container = NULL;
888 This->frame_hwnd = NULL;
889 This->uiwindow = NULL;
890 This->shell_embedding_hwnd = NULL;
892 memset(&This->pos_rect, 0, sizeof(RECT));
893 memset(&This->clip_rect, 0, sizeof(RECT));
894 memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
896 This->extent.cx = 1323;
897 This->extent.cy = 529;
900 void WebBrowser_OleObject_Destroy(WebBrowser *This)
903 IOleObject_SetClientSite(OLEOBJ(This), NULL);
905 IOleContainer_Release(This->container);
907 IOleInPlaceUIWindow_Release(This->uiwindow);