shdocvw: Move IOleDocumentSite to DocHost object.
[wine/multimedia.git] / dlls / shdocvw / oleobject.c
blob409217279d95373a5b3d633d7d64e36cb0b9c7f0
1 /*
2 * Implementation of IOleObject interfaces for WebBrowser control
4 * - IOleObject
5 * - IOleInPlaceObject
6 * - IOleControl
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <string.h>
27 #include "wine/debug.h"
28 #include "shdocvw.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
32 static ATOM shell_embedding_atom = 0;
34 static LRESULT resize_window(WebBrowser *This, LONG width, LONG height)
36 if(This->doc_host.hwnd)
37 SetWindowPos(This->doc_host.hwnd, NULL, 0, 0, width, height,
38 SWP_NOZORDER | SWP_NOACTIVATE);
40 return 0;
43 static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
45 WebBrowser *This;
47 static const WCHAR wszTHIS[] = {'T','H','I','S',0};
49 if(msg == WM_CREATE) {
50 This = *(WebBrowser**)lParam;
51 SetPropW(hwnd, wszTHIS, This);
52 }else {
53 This = GetPropW(hwnd, wszTHIS);
56 switch(msg) {
57 case WM_SIZE:
58 return resize_window(This, LOWORD(lParam), HIWORD(lParam));
61 return DefWindowProcW(hwnd, msg, wParam, lParam);
64 static void create_shell_embedding_hwnd(WebBrowser *This)
66 IOleInPlaceSite *inplace;
67 HWND parent = NULL;
68 HRESULT hres;
70 static const WCHAR wszShellEmbedding[] =
71 {'S','h','e','l','l',' ','E','m','b','e','d','d','i','n','g',0};
73 if(!shell_embedding_atom) {
74 static WNDCLASSEXW wndclass = {
75 sizeof(wndclass),
76 CS_DBLCLKS,
77 shell_embedding_proc,
78 0, 0 /* native uses 8 */, NULL, NULL, NULL,
79 (HBRUSH)COLOR_WINDOWFRAME, NULL,
80 wszShellEmbedding,
81 NULL
83 wndclass.hInstance = shdocvw_hinstance;
85 RegisterClassExW(&wndclass);
88 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleInPlaceSite, (void**)&inplace);
89 if(SUCCEEDED(hres)) {
90 IOleInPlaceSite_GetWindow(inplace, &parent);
91 IOleInPlaceSite_Release(inplace);
94 This->doc_host.frame_hwnd = This->shell_embedding_hwnd = CreateWindowExW(
95 WS_EX_WINDOWEDGE,
96 wszShellEmbedding, wszShellEmbedding,
97 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP,
98 0, 0, 0, 0, parent,
99 NULL, shdocvw_hinstance, This);
102 /**********************************************************************
103 * Implement the IOleObject interface for the WebBrowser control
106 #define OLEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
108 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
110 WebBrowser *This = OLEOBJ_THIS(iface);
111 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppv);
114 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
116 WebBrowser *This = OLEOBJ_THIS(iface);
117 return IWebBrowser_AddRef(WEBBROWSER(This));
120 static ULONG WINAPI OleObject_Release(IOleObject *iface)
122 WebBrowser *This = OLEOBJ_THIS(iface);
123 return IWebBrowser_Release(WEBBROWSER(This));
126 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
128 WebBrowser *This = OLEOBJ_THIS(iface);
129 HRESULT hres;
131 TRACE("(%p)->(%p)\n", This, pClientSite);
133 if(This->client == pClientSite)
134 return S_OK;
136 if(This->doc_host.hwnd) {
137 DestroyWindow(This->doc_host.hwnd);
138 This->doc_host.hwnd = NULL;
140 if(This->shell_embedding_hwnd) {
141 DestroyWindow(This->shell_embedding_hwnd);
142 This->shell_embedding_hwnd = NULL;
145 if(This->inplace) {
146 IOleInPlaceSite_Release(This->inplace);
147 This->inplace = NULL;
150 if(This->doc_host.hostui)
151 IDocHostUIHandler_Release(This->doc_host.hostui);
152 if(This->client)
153 IOleClientSite_Release(This->client);
155 if(!pClientSite) {
156 if(This->doc_host.document)
157 deactivate_document(This);
158 This->client = NULL;
159 return S_OK;
162 This->client = pClientSite;
163 IOleClientSite_AddRef(pClientSite);
165 hres = IOleClientSite_QueryInterface(This->client, &IID_IDocHostUIHandler,
166 (void**)&This->doc_host.hostui);
167 if(FAILED(hres))
168 This->doc_host.hostui = NULL;
170 create_shell_embedding_hwnd(This);
172 return S_OK;
175 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, LPOLECLIENTSITE *ppClientSite)
177 WebBrowser *This = OLEOBJ_THIS(iface);
179 TRACE("(%p)->(%p)\n", This, ppClientSite);
181 if(!ppClientSite)
182 return E_INVALIDARG;
184 if(This->client)
185 IOleClientSite_AddRef(This->client);
186 *ppClientSite = This->client;
188 return S_OK;
191 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp,
192 LPCOLESTR szContainerObj)
194 WebBrowser *This = OLEOBJ_THIS(iface);
195 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
196 return E_NOTIMPL;
199 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
201 WebBrowser *This = OLEOBJ_THIS(iface);
202 FIXME("(%p)->(%ld)\n", This, dwSaveOption);
203 return E_NOTIMPL;
206 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
208 WebBrowser *This = OLEOBJ_THIS(iface);
209 FIXME("(%p)->(%ld, %p)\n", This, dwWhichMoniker, pmk);
210 return E_NOTIMPL;
213 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign,
214 DWORD dwWhichMoniker, LPMONIKER *ppmk)
216 WebBrowser *This = OLEOBJ_THIS(iface);
217 FIXME("(%p)->(%ld, %ld, %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
218 return E_NOTIMPL;
221 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, LPDATAOBJECT pDataObject,
222 BOOL fCreation, DWORD dwReserved)
224 WebBrowser *This = OLEOBJ_THIS(iface);
225 FIXME("(%p)->(%p, %d, %ld)\n", This, pDataObject, fCreation, dwReserved);
226 return E_NOTIMPL;
229 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved,
230 LPDATAOBJECT *ppDataObject)
232 WebBrowser *This = OLEOBJ_THIS(iface);
233 FIXME("(%p)->(%ld, %p)\n", This, dwReserved, ppDataObject);
234 return E_NOTIMPL;
237 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tagMSG* lpmsg,
238 LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
240 WebBrowser *This = OLEOBJ_THIS(iface);
241 HRESULT hres;
243 static const WCHAR wszitem[] = {'i','t','e','m',0};
245 TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
246 lprcPosRect);
248 switch (iVerb)
250 case OLEIVERB_SHOW:
251 case OLEIVERB_INPLACEACTIVATE:
252 TRACE("OLEIVERB_INPLACEACTIVATE\n");
254 if(!pActiveSite)
255 return E_INVALIDARG;
257 if(This->inplace) {
258 IOleInPlaceSite_Release(This->inplace);
259 This->inplace = NULL;
262 hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleInPlaceSite, (void**)&This->inplace);
263 if(FAILED(hres)) {
264 WARN("Could not get IOleInPlaceSite\n");
265 return hres;
268 hres = IOleInPlaceSite_CanInPlaceActivate(This->inplace);
269 if(hres != S_OK) {
270 WARN("CanInPlaceActivate returned: %08lx\n", hres);
271 IOleInPlaceSite_Release(This->inplace);
272 return E_FAIL;
275 hres = IOleInPlaceSite_GetWindow(This->inplace, &This->iphwnd);
276 if(FAILED(hres))
277 This->iphwnd = hwndParent;
279 IOleInPlaceSite_OnInPlaceActivate(This->inplace);
281 IOleInPlaceSite_GetWindowContext(This->inplace, &This->frame, &This->uiwindow,
282 &This->pos_rect, &This->clip_rect,
283 &This->frameinfo);
286 if(iVerb == OLEIVERB_INPLACEACTIVATE)
287 IOleInPlaceSite_Release(This->inplace);
289 SetWindowPos(This->shell_embedding_hwnd, NULL,
290 This->pos_rect.left, This->pos_rect.top,
291 This->pos_rect.right-This->pos_rect.left,
292 This->pos_rect.bottom-This->pos_rect.top,
293 SWP_NOZORDER | SWP_SHOWWINDOW);
295 if(This->client) {
296 IOleClientSite_ShowObject(This->client);
297 IOleClientSite_GetContainer(This->client, &This->container);
300 if(This->frame)
301 IOleInPlaceFrame_GetWindow(This->frame, &This->frame_hwnd);
303 if(iVerb == OLEIVERB_INPLACEACTIVATE)
304 return S_OK;
306 TRACE("OLEIVERB_SHOW\n");
308 IOleInPlaceSite_OnUIActivate(This->inplace);
309 IOleInPlaceSite_Release(This->inplace);
311 if(This->frame)
312 IOleInPlaceFrame_SetActiveObject(This->frame, ACTIVEOBJ(This), wszitem);
313 if(This->uiwindow)
314 IOleInPlaceUIWindow_SetActiveObject(This->uiwindow, ACTIVEOBJ(This), wszitem);
316 /* TODO:
317 * IOleInPlaceFrmae_SetMenu
320 return S_OK;
321 default:
322 FIXME("stub for %ld\n", iVerb);
323 break;
326 return E_NOTIMPL;
329 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
331 WebBrowser *This = OLEOBJ_THIS(iface);
332 TRACE("(%p)->(%p)\n", This, ppEnumOleVerb);
333 return OleRegEnumVerbs(&CLSID_WebBrowser, ppEnumOleVerb);
336 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
338 WebBrowser *This = OLEOBJ_THIS(iface);
339 FIXME("(%p)\n", This);
340 return E_NOTIMPL;
343 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
345 WebBrowser *This = OLEOBJ_THIS(iface);
346 FIXME("(%p)\n", This);
347 return E_NOTIMPL;
350 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID* pClsid)
352 WebBrowser *This = OLEOBJ_THIS(iface);
353 FIXME("(%p)->(%p)\n", This, pClsid);
354 return E_NOTIMPL;
357 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType,
358 LPOLESTR* pszUserType)
360 WebBrowser *This = OLEOBJ_THIS(iface);
361 TRACE("(%p, %ld, %p)\n", This, dwFormOfType, pszUserType);
362 return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
365 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
367 WebBrowser *This = OLEOBJ_THIS(iface);
368 FIXME("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
369 return E_NOTIMPL;
372 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
374 WebBrowser *This = OLEOBJ_THIS(iface);
375 FIXME("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
376 return E_NOTIMPL;
379 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
380 DWORD* pdwConnection)
382 WebBrowser *This = OLEOBJ_THIS(iface);
383 FIXME("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
384 return E_NOTIMPL;
387 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
389 WebBrowser *This = OLEOBJ_THIS(iface);
390 FIXME("(%p)->(%ld)\n", This, dwConnection);
391 return E_NOTIMPL;
394 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
396 WebBrowser *This = OLEOBJ_THIS(iface);
397 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
398 return S_OK;
401 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
403 WebBrowser *This = OLEOBJ_THIS(iface);
404 HRESULT hres;
406 TRACE("(%p)->(%lx, %p)\n", This, dwAspect, pdwStatus);
408 hres = OleRegGetMiscStatus(&CLSID_WebBrowser, dwAspect, pdwStatus);
410 if (FAILED(hres))
411 *pdwStatus = 0;
413 return S_OK;
416 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE* pLogpal)
418 WebBrowser *This = OLEOBJ_THIS(iface);
419 FIXME("(%p)->(%p)\n", This, pLogpal);
420 return E_NOTIMPL;
423 #undef OLEOBJ_THIS
425 static const IOleObjectVtbl OleObjectVtbl =
427 OleObject_QueryInterface,
428 OleObject_AddRef,
429 OleObject_Release,
430 OleObject_SetClientSite,
431 OleObject_GetClientSite,
432 OleObject_SetHostNames,
433 OleObject_Close,
434 OleObject_SetMoniker,
435 OleObject_GetMoniker,
436 OleObject_InitFromData,
437 OleObject_GetClipboardData,
438 OleObject_DoVerb,
439 OleObject_EnumVerbs,
440 OleObject_Update,
441 OleObject_IsUpToDate,
442 OleObject_GetUserClassID,
443 OleObject_GetUserType,
444 OleObject_SetExtent,
445 OleObject_GetExtent,
446 OleObject_Advise,
447 OleObject_Unadvise,
448 OleObject_EnumAdvise,
449 OleObject_GetMiscStatus,
450 OleObject_SetColorScheme
453 /**********************************************************************
454 * Implement the IOleInPlaceObject interface
457 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
459 static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface,
460 REFIID riid, LPVOID *ppobj)
462 WebBrowser *This = INPLACEOBJ_THIS(iface);
463 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
466 static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface)
468 WebBrowser *This = INPLACEOBJ_THIS(iface);
469 return IWebBrowser_AddRef(WEBBROWSER(This));
472 static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface)
474 WebBrowser *This = INPLACEOBJ_THIS(iface);
475 return IWebBrowser_Release(WEBBROWSER(This));
478 static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd)
480 WebBrowser *This = INPLACEOBJ_THIS(iface);
482 TRACE("(%p)->(%p)\n", This, phwnd);
484 *phwnd = This->shell_embedding_hwnd;
485 return S_OK;
488 static HRESULT WINAPI OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject *iface,
489 BOOL fEnterMode)
491 WebBrowser *This = INPLACEOBJ_THIS(iface);
492 FIXME("(%p)->(%x)\n", This, fEnterMode);
493 return E_NOTIMPL;
496 static HRESULT WINAPI OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject *iface)
498 WebBrowser *This = INPLACEOBJ_THIS(iface);
499 FIXME("(%p)\n", This);
500 return E_NOTIMPL;
503 static HRESULT WINAPI OleInPlaceObject_UIDeactivate(IOleInPlaceObject *iface)
505 WebBrowser *This = INPLACEOBJ_THIS(iface);
506 FIXME("(%p)\n", This);
507 return E_NOTIMPL;
510 static HRESULT WINAPI OleInPlaceObject_SetObjectRects(IOleInPlaceObject *iface,
511 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
513 WebBrowser *This = INPLACEOBJ_THIS(iface);
515 TRACE("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
517 memcpy(&This->pos_rect, lprcPosRect, sizeof(RECT));
519 if(lprcClipRect)
520 memcpy(&This->clip_rect, lprcClipRect, sizeof(RECT));
522 if(This->shell_embedding_hwnd) {
523 SetWindowPos(This->shell_embedding_hwnd, NULL,
524 lprcPosRect->left, lprcPosRect->top,
525 lprcPosRect->right-lprcPosRect->left,
526 lprcPosRect->bottom-lprcPosRect->top,
527 SWP_NOZORDER | SWP_NOACTIVATE);
530 return S_OK;
533 static HRESULT WINAPI OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject *iface)
535 WebBrowser *This = INPLACEOBJ_THIS(iface);
536 FIXME("(%p)\n", This);
537 return E_NOTIMPL;
540 #undef INPLACEOBJ_THIS
542 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl =
544 OleInPlaceObject_QueryInterface,
545 OleInPlaceObject_AddRef,
546 OleInPlaceObject_Release,
547 OleInPlaceObject_GetWindow,
548 OleInPlaceObject_ContextSensitiveHelp,
549 OleInPlaceObject_InPlaceDeactivate,
550 OleInPlaceObject_UIDeactivate,
551 OleInPlaceObject_SetObjectRects,
552 OleInPlaceObject_ReactivateAndUndo
555 /**********************************************************************
556 * Implement the IOleControl interface
559 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
561 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface,
562 REFIID riid, LPVOID *ppobj)
564 WebBrowser *This = CONTROL_THIS(iface);
565 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
568 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
570 WebBrowser *This = CONTROL_THIS(iface);
571 return IWebBrowser_AddRef(WEBBROWSER(This));
574 static ULONG WINAPI OleControl_Release(IOleControl *iface)
576 WebBrowser *This = CONTROL_THIS(iface);
577 return IWebBrowser_Release(WEBBROWSER(This));
580 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
582 WebBrowser *This = CONTROL_THIS(iface);
583 FIXME("(%p)->(%p)\n", This, pCI);
584 return E_NOTIMPL;
587 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, struct tagMSG *pMsg)
589 WebBrowser *This = CONTROL_THIS(iface);
590 FIXME("(%p)->(%p)\n", This, pMsg);
591 return E_NOTIMPL;
594 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
596 WebBrowser *This = CONTROL_THIS(iface);
597 FIXME("(%p)->(%ld)\n", This, dispID);
598 return E_NOTIMPL;
601 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
603 WebBrowser *This = CONTROL_THIS(iface);
604 FIXME("(%p)->(%x)\n", This, bFreeze);
605 return E_NOTIMPL;
608 #undef CONTROL_THIS
610 static const IOleControlVtbl OleControlVtbl =
612 OleControl_QueryInterface,
613 OleControl_AddRef,
614 OleControl_Release,
615 OleControl_GetControlInfo,
616 OleControl_OnMnemonic,
617 OleControl_OnAmbientPropertyChange,
618 OleControl_FreezeEvents
621 #define ACTIVEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceActiveObject, iface)
623 static HRESULT WINAPI InPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface,
624 REFIID riid, void **ppv)
626 WebBrowser *This = ACTIVEOBJ_THIS(iface);
627 return IWebBrowser2_QueryInterface(WEBBROWSER2(This), riid, ppv);
630 static ULONG WINAPI InPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
632 WebBrowser *This = ACTIVEOBJ_THIS(iface);
633 return IWebBrowser2_AddRef(WEBBROWSER2(This));
636 static ULONG WINAPI InPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
638 WebBrowser *This = ACTIVEOBJ_THIS(iface);
639 return IWebBrowser2_Release(WEBBROWSER2(This));
642 static HRESULT WINAPI InPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface,
643 HWND *phwnd)
645 WebBrowser *This = ACTIVEOBJ_THIS(iface);
646 return IOleInPlaceObject_GetWindow(INPLACEOBJ(This), phwnd);
649 static HRESULT WINAPI InPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface,
650 BOOL fEnterMode)
652 WebBrowser *This = ACTIVEOBJ_THIS(iface);
653 return IOleInPlaceObject_ContextSensitiveHelp(INPLACEOBJ(This), fEnterMode);
656 static HRESULT WINAPI InPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface,
657 LPMSG lpmsg)
659 WebBrowser *This = ACTIVEOBJ_THIS(iface);
660 FIXME("(%p)->(%p)\n", This, lpmsg);
661 return E_NOTIMPL;
664 static HRESULT WINAPI InPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface,
665 BOOL fActivate)
667 WebBrowser *This = ACTIVEOBJ_THIS(iface);
668 FIXME("(%p)->(%x)\n", This, fActivate);
669 return E_NOTIMPL;
672 static HRESULT WINAPI InPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface,
673 BOOL fActivate)
675 WebBrowser *This = ACTIVEOBJ_THIS(iface);
676 FIXME("(%p)->(%x)\n", This, fActivate);
677 return E_NOTIMPL;
680 static HRESULT WINAPI InPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface,
681 LPCRECT lprcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
683 WebBrowser *This = ACTIVEOBJ_THIS(iface);
684 FIXME("(%p)->(%p %p %x)\n", This, lprcBorder, pUIWindow, fFrameWindow);
685 return E_NOTIMPL;
688 static HRESULT WINAPI InPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface,
689 BOOL fEnable)
691 WebBrowser *This = ACTIVEOBJ_THIS(iface);
692 FIXME("(%p)->(%x)\n", This, fEnable);
693 return E_NOTIMPL;
696 #undef ACTIVEOBJ_THIS
698 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
699 InPlaceActiveObject_QueryInterface,
700 InPlaceActiveObject_AddRef,
701 InPlaceActiveObject_Release,
702 InPlaceActiveObject_GetWindow,
703 InPlaceActiveObject_ContextSensitiveHelp,
704 InPlaceActiveObject_TranslateAccelerator,
705 InPlaceActiveObject_OnFrameWindowActivate,
706 InPlaceActiveObject_OnDocWindowActivate,
707 InPlaceActiveObject_ResizeBorder,
708 InPlaceActiveObject_EnableModeless
711 #define OLECMD_THIS(iface) DEFINE_THIS(WebBrowser, WBOleCommandTarget, iface)
713 static HRESULT WINAPI WBOleCommandTarget_QueryInterface(IOleCommandTarget *iface,
714 REFIID riid, void **ppv)
716 WebBrowser *This = OLECMD_THIS(iface);
717 return IWebBrowser2_QueryInterface(WEBBROWSER(This), riid, ppv);
720 static ULONG WINAPI WBOleCommandTarget_AddRef(IOleCommandTarget *iface)
722 WebBrowser *This = OLECMD_THIS(iface);
723 return IWebBrowser2_AddRef(WEBBROWSER(This));
726 static ULONG WINAPI WBOleCommandTarget_Release(IOleCommandTarget *iface)
728 WebBrowser *This = OLECMD_THIS(iface);
729 return IWebBrowser2_Release(WEBBROWSER(This));
732 static HRESULT WINAPI WBOleCommandTarget_QueryStatus(IOleCommandTarget *iface,
733 const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
735 WebBrowser *This = OLECMD_THIS(iface);
736 FIXME("(%p)->(%s %lu %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds,
737 pCmdText);
738 return E_NOTIMPL;
741 static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface,
742 const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn,
743 VARIANT *pvaOut)
745 WebBrowser *This = OLECMD_THIS(iface);
746 FIXME("(%p)->(%s %ld %ld %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID,
747 nCmdexecopt, pvaIn, pvaOut);
748 return E_NOTIMPL;
751 #undef OLECMD_THIS
753 static const IOleCommandTargetVtbl OleCommandTargetVtbl = {
754 WBOleCommandTarget_QueryInterface,
755 WBOleCommandTarget_AddRef,
756 WBOleCommandTarget_Release,
757 WBOleCommandTarget_QueryStatus,
758 WBOleCommandTarget_Exec
761 void WebBrowser_OleObject_Init(WebBrowser *This)
763 This->lpOleObjectVtbl = &OleObjectVtbl;
764 This->lpOleInPlaceObjectVtbl = &OleInPlaceObjectVtbl;
765 This->lpOleControlVtbl = &OleControlVtbl;
766 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
767 This->lpWBOleCommandTargetVtbl = &OleCommandTargetVtbl;
769 This->client = NULL;
770 This->inplace = NULL;
771 This->container = NULL;
772 This->iphwnd = NULL;
773 This->frame_hwnd = NULL;
774 This->frame = NULL;
775 This->uiwindow = NULL;
776 This->shell_embedding_hwnd = NULL;
778 memset(&This->pos_rect, 0, sizeof(RECT));
779 memset(&This->clip_rect, 0, sizeof(RECT));
780 memset(&This->frameinfo, 0, sizeof(OLEINPLACEFRAMEINFO));
783 void WebBrowser_OleObject_Destroy(WebBrowser *This)
785 if(This->client)
786 IOleObject_SetClientSite(OLEOBJ(This), NULL);
787 if(This->container)
788 IOleContainer_Release(This->container);
789 if(This->frame)
790 IOleInPlaceFrame_Release(This->frame);
791 if(This->uiwindow)
792 IOleInPlaceUIWindow_Release(This->uiwindow);