2 * Implementation of IOleObject interfaces for IE Web Browser
8 * Copyright 2001 John R. Sheets (for CodeWeavers)
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
32 /**********************************************************************
33 * Implement the IOleObject interface for the web browser component
35 * Based on DefaultHandler code in dlls/ole32/defaulthandler.c.
38 static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface);
39 static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface);
41 /************************************************************************
42 * WBOOBJ_QueryInterface (IUnknown)
44 * Interfaces we need to (at least pretend to) retrieve:
46 * a6bc3ac0-dbaa-11ce-9de3-00aa004bb851 IID_IProvideClassInfo2
47 * b196b283-bab4-101a-b69c-00aa00341d07 IID_IProvideClassInfo
48 * cf51ed10-62fe-11cf-bf86-00a0c9034836 IID_IQuickActivate
49 * 7fd52380-4e07-101b-ae2d-08002b2ec713 IID_IPersistStreamInit
50 * 0000010a-0000-0000-c000-000000000046 IID_IPersistStorage
51 * b196b284-bab4-101a-b69c-00aa00341d07 IID_IConnectionPointContainer
53 static HRESULT WINAPI WBOOBJ_QueryInterface(LPOLEOBJECT iface,
54 REFIID riid, void** ppobj)
56 ICOM_THIS(IOleObjectImpl, iface);
59 * Perform a sanity check on the parameters.
61 if ((This == NULL) || (ppobj == NULL) )
64 if (IsEqualGUID (&IID_IPersistStorage, riid))
66 TRACE("Returning IID_IPersistStorage interface\n");
67 *ppobj = (LPVOID)&SHDOCVW_PersistStorage;
68 WBOOBJ_AddRef (iface);
71 else if (IsEqualGUID (&IID_IPersistStreamInit, riid))
73 TRACE("Returning IID_IPersistStreamInit interface\n");
74 *ppobj = (LPVOID)&SHDOCVW_PersistStreamInit;
75 WBOOBJ_AddRef (iface);
78 else if (IsEqualGUID (&IID_IProvideClassInfo, riid))
80 TRACE("Returning IID_IProvideClassInfo interface\n");
81 *ppobj = (LPVOID)&SHDOCVW_ProvideClassInfo;
82 WBOOBJ_AddRef (iface);
85 else if (IsEqualGUID (&IID_IProvideClassInfo2, riid))
87 TRACE("Returning IID_IProvideClassInfo2 interface %p\n",
88 &SHDOCVW_ProvideClassInfo2);
89 *ppobj = (LPVOID)&SHDOCVW_ProvideClassInfo2;
90 WBOOBJ_AddRef (iface);
93 else if (IsEqualGUID (&IID_IQuickActivate, riid))
95 TRACE("Returning IID_IQuickActivate interface\n");
96 *ppobj = (LPVOID)&SHDOCVW_QuickActivate;
97 WBOOBJ_AddRef (iface);
100 else if (IsEqualGUID (&IID_IConnectionPointContainer, riid))
102 TRACE("Returning IID_IConnectionPointContainer interface\n");
103 *ppobj = (LPVOID)&SHDOCVW_ConnectionPointContainer;
104 WBOOBJ_AddRef (iface);
107 else if (IsEqualGUID (&IID_IOleInPlaceObject, riid))
109 TRACE("Returning IID_IOleInPlaceObject interface\n");
110 *ppobj = (LPVOID)&SHDOCVW_OleInPlaceObject;
111 WBOOBJ_AddRef (iface);
114 else if (IsEqualGUID (&IID_IOleControl, riid))
116 TRACE("Returning IID_IOleControl interface\n");
117 *ppobj = (LPVOID)&SHDOCVW_OleControl;
118 WBOOBJ_AddRef (iface);
121 else if (IsEqualGUID (&IID_IWebBrowser, riid))
123 TRACE("Returning IID_IWebBrowser interface\n");
124 *ppobj = (LPVOID)&SHDOCVW_WebBrowser;
125 WBOOBJ_AddRef (iface);
128 else if (IsEqualGUID (&IID_IDispatch, riid))
130 TRACE("Returning IID_IDispatch interface\n");
131 *ppobj = (LPVOID)&SHDOCVW_WebBrowser;
132 WBOOBJ_AddRef (iface);
136 TRACE ("Failed to find iid = %s\n", debugstr_guid(riid));
138 return E_NOINTERFACE;
141 /************************************************************************
142 * WBOOBJ_AddRef (IUnknown)
144 static ULONG WINAPI WBOOBJ_AddRef(LPOLEOBJECT iface)
146 ICOM_THIS(IOleObjectImpl, iface);
149 return ++(This->ref);
152 /************************************************************************
153 * WBOOBJ_Release (IUnknown)
155 static ULONG WINAPI WBOOBJ_Release(LPOLEOBJECT iface)
157 ICOM_THIS(IOleObjectImpl, iface);
159 /* static class, won't be freed */
161 return --(This->ref);
164 /************************************************************************
165 * WBOOBJ_SetClientSite (IOleObject)
167 static HRESULT WINAPI WBOOBJ_SetClientSite(LPOLEOBJECT iface,
168 LPOLECLIENTSITE pClientSite)
170 FIXME("stub: (%p, %p)\n", iface, pClientSite);
174 /************************************************************************
175 * WBOOBJ_GetClientSite (IOleObject)
177 static HRESULT WINAPI WBOOBJ_GetClientSite(LPOLEOBJECT iface,
178 LPOLECLIENTSITE* ppClientSite)
180 FIXME("stub: (%p)\n", *ppClientSite);
184 /************************************************************************
185 * WBOOBJ_SetHostNames (IOleObject)
187 static HRESULT WINAPI WBOOBJ_SetHostNames(LPOLEOBJECT iface, LPCOLESTR szContainerApp,
188 LPCOLESTR szContainerObj)
190 FIXME("stub: (%p, %s, %s)\n", iface, debugstr_w(szContainerApp),
191 debugstr_w(szContainerObj));
195 /************************************************************************
196 * WBOOBJ_Close (IOleObject)
198 static HRESULT WINAPI WBOOBJ_Close(LPOLEOBJECT iface, DWORD dwSaveOption)
204 /************************************************************************
205 * WBOOBJ_SetMoniker (IOleObject)
207 static HRESULT WINAPI WBOOBJ_SetMoniker(LPOLEOBJECT iface,
208 DWORD dwWhichMoniker, IMoniker* pmk)
210 FIXME("stub: (%p, %ld, %p)\n", iface, dwWhichMoniker, pmk);
214 /************************************************************************
215 * WBOOBJ_GetMoniker (IOleObject)
217 * Delegate this request to the client site if we have one.
219 static HRESULT WINAPI WBOOBJ_GetMoniker(LPOLEOBJECT iface, DWORD dwAssign,
220 DWORD dwWhichMoniker, LPMONIKER *ppmk)
222 FIXME("stub (%p, %ld, %ld, %p)\n", iface, dwAssign, dwWhichMoniker, ppmk);
226 /************************************************************************
227 * WBOOBJ_InitFromData (IOleObject)
229 * This method is meaningless if the server is not running
231 static HRESULT WINAPI WBOOBJ_InitFromData(LPOLEOBJECT iface, LPDATAOBJECT pDataObject,
232 BOOL fCreation, DWORD dwReserved)
234 FIXME("stub: (%p, %p, %d, %ld)\n", iface, pDataObject, fCreation, dwReserved);
235 return OLE_E_NOTRUNNING;
238 /************************************************************************
239 * WBOOBJ_GetClipboardData (IOleObject)
241 * This method is meaningless if the server is not running
243 static HRESULT WINAPI WBOOBJ_GetClipboardData(LPOLEOBJECT iface, DWORD dwReserved,
244 LPDATAOBJECT *ppDataObject)
246 FIXME("stub: (%p, %ld, %p)\n", iface, dwReserved, ppDataObject);
247 return OLE_E_NOTRUNNING;
250 /************************************************************************
251 * WBOOBJ_DoVerb (IOleObject)
253 static HRESULT WINAPI WBOOBJ_DoVerb(LPOLEOBJECT iface, LONG iVerb, struct tagMSG* lpmsg,
254 LPOLECLIENTSITE pActiveSite, LONG lindex,
255 HWND hwndParent, LPCRECT lprcPosRect)
257 FIXME(": stub iVerb = %ld\n", iVerb);
260 case OLEIVERB_INPLACEACTIVATE:
261 FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
264 FIXME ("stub for OLEIVERB_HIDE\n");
271 /************************************************************************
272 * WBOOBJ_EnumVerbs (IOleObject)
274 * Delegate to OleRegEnumVerbs.
276 static HRESULT WINAPI WBOOBJ_EnumVerbs(LPOLEOBJECT iface,
277 IEnumOLEVERB** ppEnumOleVerb)
279 TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
281 return OleRegEnumVerbs(&CLSID_WebBrowser, ppEnumOleVerb);
284 /************************************************************************
285 * WBOOBJ_EnumVerbs (IOleObject)
287 static HRESULT WINAPI WBOOBJ_Update(LPOLEOBJECT iface)
293 /************************************************************************
294 * WBOOBJ_IsUpToDate (IOleObject)
296 * This method is meaningless if the server is not running
298 static HRESULT WINAPI WBOOBJ_IsUpToDate(LPOLEOBJECT iface)
300 FIXME("(%p)\n", iface);
301 return OLE_E_NOTRUNNING;
304 /************************************************************************
305 * WBOOBJ_GetUserClassID (IOleObject)
307 static HRESULT WINAPI WBOOBJ_GetUserClassID(LPOLEOBJECT iface, CLSID* pClsid)
309 FIXME("stub: (%p, %p)\n", iface, pClsid);
313 /************************************************************************
314 * WBOOBJ_GetUserType (IOleObject)
316 * Delegate to OleRegGetUserType.
318 static HRESULT WINAPI WBOOBJ_GetUserType(LPOLEOBJECT iface, DWORD dwFormOfType,
319 LPOLESTR* pszUserType)
321 TRACE("(%p, %ld, %p)\n", iface, dwFormOfType, pszUserType);
323 return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
326 /************************************************************************
327 * WBOOBJ_SetExtent (IOleObject)
329 * This method is meaningless if the server is not running
331 static HRESULT WINAPI WBOOBJ_SetExtent(LPOLEOBJECT iface, DWORD dwDrawAspect,
334 FIXME("stub: (%p, %lx, (%ld x %ld))\n", iface, dwDrawAspect,
335 psizel->cx, psizel->cy);
336 return OLE_E_NOTRUNNING;
339 /************************************************************************
340 * WBOOBJ_GetExtent (IOleObject)
342 static HRESULT WINAPI WBOOBJ_GetExtent(LPOLEOBJECT iface, DWORD dwDrawAspect,
345 FIXME("stub: (%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
349 /************************************************************************
350 * WBOOBJ_Advise (IOleObject)
352 static HRESULT WINAPI WBOOBJ_Advise(LPOLEOBJECT iface, IAdviseSink* pAdvSink,
353 DWORD* pdwConnection)
355 FIXME("stub: (%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
359 /************************************************************************
360 * WBOOBJ_Unadvise (IOleObject)
362 static HRESULT WINAPI WBOOBJ_Unadvise(LPOLEOBJECT iface, DWORD dwConnection)
364 FIXME("stub: (%p, %ld)\n", iface, dwConnection);
368 /************************************************************************
369 * WBOOBJ_EnumAdvise (IOleObject)
371 static HRESULT WINAPI WBOOBJ_EnumAdvise(LPOLEOBJECT iface, IEnumSTATDATA** ppenumAdvise)
373 FIXME("stub: (%p, %p)\n", iface, ppenumAdvise);
377 /************************************************************************
378 * WBOOBJ_GetMiscStatus (IOleObject)
380 * Delegate to OleRegGetMiscStatus.
382 static HRESULT WINAPI WBOOBJ_GetMiscStatus(LPOLEOBJECT iface, DWORD dwAspect,
387 TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus);
389 hres = OleRegGetMiscStatus(&CLSID_WebBrowser, dwAspect, pdwStatus);
397 /************************************************************************
398 * WBOOBJ_SetColorScheme (IOleObject)
400 * This method is meaningless if the server is not running
402 static HRESULT WINAPI WBOOBJ_SetColorScheme(LPOLEOBJECT iface,
403 struct tagLOGPALETTE* pLogpal)
405 FIXME("stub: (%p, %p))\n", iface, pLogpal);
406 return OLE_E_NOTRUNNING;
409 /**********************************************************************
410 * IOleObject virtual function table for IE Web Browser component
413 static ICOM_VTABLE(IOleObject) WBOOBJ_Vtbl =
415 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
416 WBOOBJ_QueryInterface,
419 WBOOBJ_SetClientSite,
420 WBOOBJ_GetClientSite,
426 WBOOBJ_GetClipboardData,
431 WBOOBJ_GetUserClassID,
438 WBOOBJ_GetMiscStatus,
439 WBOOBJ_SetColorScheme
442 IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 };
445 /**********************************************************************
446 * Implement the IOleInPlaceObject interface
449 static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface,
450 REFIID riid, LPVOID *ppobj)
452 ICOM_THIS(IOleInPlaceObjectImpl, iface);
454 FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
455 return E_NOINTERFACE;
458 static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface)
460 ICOM_THIS(IOleInPlaceObjectImpl, iface);
463 return ++(This->ref);
466 static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface)
468 ICOM_THIS(IOleInPlaceObjectImpl, iface);
470 /* static class, won't be freed */
472 return --(This->ref);
475 static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd)
478 /* Create a fake window to fool MFC into believing that we actually
479 * have an implemented browser control. Avoids the assertion.
482 hwnd = CreateWindowA("BUTTON", "Web Control",
483 WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
484 CW_USEDEFAULT, CW_USEDEFAULT, 600,
485 400, NULL, NULL, NULL, NULL);
488 TRACE ("Returning hwnd = %d\n", hwnd);
491 FIXME("stub HWND* = %p\n", phwnd);
495 static HRESULT WINAPI WBOIPO_ContextSensitiveHelp(LPOLEINPLACEOBJECT iface,
498 FIXME("stub fEnterMode = %d\n", fEnterMode);
502 static HRESULT WINAPI WBOIPO_InPlaceDeactivate(LPOLEINPLACEOBJECT iface)
508 static HRESULT WINAPI WBOIPO_UIDeactivate(LPOLEINPLACEOBJECT iface)
514 static HRESULT WINAPI WBOIPO_SetObjectRects(LPOLEINPLACEOBJECT iface,
515 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
517 FIXME("stub PosRect = %p, ClipRect = %p\n", lprcPosRect, lprcClipRect);
521 static HRESULT WINAPI WBOIPO_ReactivateAndUndo(LPOLEINPLACEOBJECT iface)
527 /**********************************************************************
528 * IOleInPlaceObject virtual function table for IE Web Browser component
531 static ICOM_VTABLE(IOleInPlaceObject) WBOIPO_Vtbl =
533 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
534 WBOIPO_QueryInterface,
538 WBOIPO_ContextSensitiveHelp,
539 WBOIPO_InPlaceDeactivate,
541 WBOIPO_SetObjectRects,
542 WBOIPO_ReactivateAndUndo
545 IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 };
548 /**********************************************************************
549 * Implement the IOleControl interface
552 static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface,
553 REFIID riid, LPVOID *ppobj)
555 ICOM_THIS(IOleControlImpl, iface);
557 FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
558 return E_NOINTERFACE;
561 static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface)
563 ICOM_THIS(IOleControlImpl, iface);
566 return ++(This->ref);
569 static ULONG WINAPI WBOC_Release(LPOLECONTROL iface)
571 ICOM_THIS(IOleControlImpl, iface);
573 /* static class, won't be freed */
575 return --(This->ref);
578 static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI)
580 FIXME("stub: LPCONTROLINFO = %p\n", pCI);
584 static HRESULT WINAPI WBOC_OnMnemonic(LPOLECONTROL iface, struct tagMSG *pMsg)
586 FIXME("stub: MSG* = %p\n", pMsg);
590 static HRESULT WINAPI WBOC_OnAmbientPropertyChange(LPOLECONTROL iface, DISPID dispID)
592 FIXME("stub: DISPID = %ld\n", dispID);
596 static HRESULT WINAPI WBOC_FreezeEvents(LPOLECONTROL iface, BOOL bFreeze)
598 FIXME("stub: bFreeze = %d\n", bFreeze);
602 /**********************************************************************
603 * IOleControl virtual function table for IE Web Browser component
606 static ICOM_VTABLE(IOleControl) WBOC_Vtbl =
608 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
614 WBOC_OnAmbientPropertyChange,
618 IOleControlImpl SHDOCVW_OleControl = { &WBOC_Vtbl, 1 };