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 IOleObjectVtbl WBOOBJ_Vtbl =
415 WBOOBJ_QueryInterface,
418 WBOOBJ_SetClientSite,
419 WBOOBJ_GetClientSite,
425 WBOOBJ_GetClipboardData,
430 WBOOBJ_GetUserClassID,
437 WBOOBJ_GetMiscStatus,
438 WBOOBJ_SetColorScheme
441 IOleObjectImpl SHDOCVW_OleObject = { &WBOOBJ_Vtbl, 1 };
444 /**********************************************************************
445 * Implement the IOleInPlaceObject interface
448 static HRESULT WINAPI WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface,
449 REFIID riid, LPVOID *ppobj)
451 ICOM_THIS(IOleInPlaceObjectImpl, iface);
453 FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
454 return E_NOINTERFACE;
457 static ULONG WINAPI WBOIPO_AddRef(LPOLEINPLACEOBJECT iface)
459 ICOM_THIS(IOleInPlaceObjectImpl, iface);
462 return ++(This->ref);
465 static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface)
467 ICOM_THIS(IOleInPlaceObjectImpl, iface);
469 /* static class, won't be freed */
471 return --(This->ref);
474 static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd)
477 /* Create a fake window to fool MFC into believing that we actually
478 * have an implemented browser control. Avoids the assertion.
481 hwnd = CreateWindowA("BUTTON", "Web Control",
482 WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
483 CW_USEDEFAULT, CW_USEDEFAULT, 600,
484 400, NULL, NULL, NULL, NULL);
487 TRACE ("Returning hwnd = %d\n", hwnd);
490 FIXME("stub HWND* = %p\n", phwnd);
494 static HRESULT WINAPI WBOIPO_ContextSensitiveHelp(LPOLEINPLACEOBJECT iface,
497 FIXME("stub fEnterMode = %d\n", fEnterMode);
501 static HRESULT WINAPI WBOIPO_InPlaceDeactivate(LPOLEINPLACEOBJECT iface)
507 static HRESULT WINAPI WBOIPO_UIDeactivate(LPOLEINPLACEOBJECT iface)
513 static HRESULT WINAPI WBOIPO_SetObjectRects(LPOLEINPLACEOBJECT iface,
514 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
516 FIXME("stub PosRect = %p, ClipRect = %p\n", lprcPosRect, lprcClipRect);
520 static HRESULT WINAPI WBOIPO_ReactivateAndUndo(LPOLEINPLACEOBJECT iface)
526 /**********************************************************************
527 * IOleInPlaceObject virtual function table for IE Web Browser component
530 static IOleInPlaceObjectVtbl WBOIPO_Vtbl =
532 WBOIPO_QueryInterface,
536 WBOIPO_ContextSensitiveHelp,
537 WBOIPO_InPlaceDeactivate,
539 WBOIPO_SetObjectRects,
540 WBOIPO_ReactivateAndUndo
543 IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject = { &WBOIPO_Vtbl, 1 };
546 /**********************************************************************
547 * Implement the IOleControl interface
550 static HRESULT WINAPI WBOC_QueryInterface(LPOLECONTROL iface,
551 REFIID riid, LPVOID *ppobj)
553 ICOM_THIS(IOleControlImpl, iface);
555 FIXME("(%p)->(%s,%p),stub!\n", This, debugstr_guid(riid), ppobj);
556 return E_NOINTERFACE;
559 static ULONG WINAPI WBOC_AddRef(LPOLECONTROL iface)
561 ICOM_THIS(IOleControlImpl, iface);
564 return ++(This->ref);
567 static ULONG WINAPI WBOC_Release(LPOLECONTROL iface)
569 ICOM_THIS(IOleControlImpl, iface);
571 /* static class, won't be freed */
573 return --(This->ref);
576 static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI)
578 FIXME("stub: LPCONTROLINFO = %p\n", pCI);
582 static HRESULT WINAPI WBOC_OnMnemonic(LPOLECONTROL iface, struct tagMSG *pMsg)
584 FIXME("stub: MSG* = %p\n", pMsg);
588 static HRESULT WINAPI WBOC_OnAmbientPropertyChange(LPOLECONTROL iface, DISPID dispID)
590 FIXME("stub: DISPID = %ld\n", dispID);
594 static HRESULT WINAPI WBOC_FreezeEvents(LPOLECONTROL iface, BOOL bFreeze)
596 FIXME("stub: bFreeze = %d\n", bFreeze);
600 /**********************************************************************
601 * IOleControl virtual function table for IE Web Browser component
604 static IOleControlVtbl WBOC_Vtbl =
611 WBOC_OnAmbientPropertyChange,
615 IOleControlImpl SHDOCVW_OleControl = { &WBOC_Vtbl, 1 };