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 IOleObjectImpl
*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 SHDOCVW_LockModule();
148 return 2; /* non-heap based object */
151 /************************************************************************
152 * WBOOBJ_Release (IUnknown)
154 static ULONG WINAPI
WBOOBJ_Release(LPOLEOBJECT iface
)
156 SHDOCVW_UnlockModule();
158 return 1; /* non-heap based object */
161 /************************************************************************
162 * WBOOBJ_SetClientSite (IOleObject)
164 static HRESULT WINAPI
WBOOBJ_SetClientSite(LPOLEOBJECT iface
,
165 LPOLECLIENTSITE pClientSite
)
167 FIXME("stub: (%p, %p)\n", iface
, pClientSite
);
171 /************************************************************************
172 * WBOOBJ_GetClientSite (IOleObject)
174 static HRESULT WINAPI
WBOOBJ_GetClientSite(LPOLEOBJECT iface
,
175 LPOLECLIENTSITE
* ppClientSite
)
177 FIXME("stub: (%p)\n", *ppClientSite
);
181 /************************************************************************
182 * WBOOBJ_SetHostNames (IOleObject)
184 static HRESULT WINAPI
WBOOBJ_SetHostNames(LPOLEOBJECT iface
, LPCOLESTR szContainerApp
,
185 LPCOLESTR szContainerObj
)
187 FIXME("stub: (%p, %s, %s)\n", iface
, debugstr_w(szContainerApp
),
188 debugstr_w(szContainerObj
));
192 /************************************************************************
193 * WBOOBJ_Close (IOleObject)
195 static HRESULT WINAPI
WBOOBJ_Close(LPOLEOBJECT iface
, DWORD dwSaveOption
)
201 /************************************************************************
202 * WBOOBJ_SetMoniker (IOleObject)
204 static HRESULT WINAPI
WBOOBJ_SetMoniker(LPOLEOBJECT iface
,
205 DWORD dwWhichMoniker
, IMoniker
* pmk
)
207 FIXME("stub: (%p, %ld, %p)\n", iface
, dwWhichMoniker
, pmk
);
211 /************************************************************************
212 * WBOOBJ_GetMoniker (IOleObject)
214 * Delegate this request to the client site if we have one.
216 static HRESULT WINAPI
WBOOBJ_GetMoniker(LPOLEOBJECT iface
, DWORD dwAssign
,
217 DWORD dwWhichMoniker
, LPMONIKER
*ppmk
)
219 FIXME("stub (%p, %ld, %ld, %p)\n", iface
, dwAssign
, dwWhichMoniker
, ppmk
);
223 /************************************************************************
224 * WBOOBJ_InitFromData (IOleObject)
226 * This method is meaningless if the server is not running
228 static HRESULT WINAPI
WBOOBJ_InitFromData(LPOLEOBJECT iface
, LPDATAOBJECT pDataObject
,
229 BOOL fCreation
, DWORD dwReserved
)
231 FIXME("stub: (%p, %p, %d, %ld)\n", iface
, pDataObject
, fCreation
, dwReserved
);
232 return OLE_E_NOTRUNNING
;
235 /************************************************************************
236 * WBOOBJ_GetClipboardData (IOleObject)
238 * This method is meaningless if the server is not running
240 static HRESULT WINAPI
WBOOBJ_GetClipboardData(LPOLEOBJECT iface
, DWORD dwReserved
,
241 LPDATAOBJECT
*ppDataObject
)
243 FIXME("stub: (%p, %ld, %p)\n", iface
, dwReserved
, ppDataObject
);
244 return OLE_E_NOTRUNNING
;
247 /************************************************************************
248 * WBOOBJ_DoVerb (IOleObject)
250 static HRESULT WINAPI
WBOOBJ_DoVerb(LPOLEOBJECT iface
, LONG iVerb
, struct tagMSG
* lpmsg
,
251 LPOLECLIENTSITE pActiveSite
, LONG lindex
,
252 HWND hwndParent
, LPCRECT lprcPosRect
)
254 FIXME(": stub iVerb = %ld\n", iVerb
);
257 case OLEIVERB_INPLACEACTIVATE
:
258 FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
261 FIXME ("stub for OLEIVERB_HIDE\n");
268 /************************************************************************
269 * WBOOBJ_EnumVerbs (IOleObject)
271 * Delegate to OleRegEnumVerbs.
273 static HRESULT WINAPI
WBOOBJ_EnumVerbs(LPOLEOBJECT iface
,
274 IEnumOLEVERB
** ppEnumOleVerb
)
276 TRACE("(%p, %p)\n", iface
, ppEnumOleVerb
);
278 return OleRegEnumVerbs(&CLSID_WebBrowser
, ppEnumOleVerb
);
281 /************************************************************************
282 * WBOOBJ_EnumVerbs (IOleObject)
284 static HRESULT WINAPI
WBOOBJ_Update(LPOLEOBJECT iface
)
290 /************************************************************************
291 * WBOOBJ_IsUpToDate (IOleObject)
293 * This method is meaningless if the server is not running
295 static HRESULT WINAPI
WBOOBJ_IsUpToDate(LPOLEOBJECT iface
)
297 FIXME("(%p)\n", iface
);
298 return OLE_E_NOTRUNNING
;
301 /************************************************************************
302 * WBOOBJ_GetUserClassID (IOleObject)
304 static HRESULT WINAPI
WBOOBJ_GetUserClassID(LPOLEOBJECT iface
, CLSID
* pClsid
)
306 FIXME("stub: (%p, %p)\n", iface
, pClsid
);
310 /************************************************************************
311 * WBOOBJ_GetUserType (IOleObject)
313 * Delegate to OleRegGetUserType.
315 static HRESULT WINAPI
WBOOBJ_GetUserType(LPOLEOBJECT iface
, DWORD dwFormOfType
,
316 LPOLESTR
* pszUserType
)
318 TRACE("(%p, %ld, %p)\n", iface
, dwFormOfType
, pszUserType
);
320 return OleRegGetUserType(&CLSID_WebBrowser
, dwFormOfType
, pszUserType
);
323 /************************************************************************
324 * WBOOBJ_SetExtent (IOleObject)
326 * This method is meaningless if the server is not running
328 static HRESULT WINAPI
WBOOBJ_SetExtent(LPOLEOBJECT iface
, DWORD dwDrawAspect
,
331 FIXME("stub: (%p, %lx, (%ld x %ld))\n", iface
, dwDrawAspect
,
332 psizel
->cx
, psizel
->cy
);
333 return OLE_E_NOTRUNNING
;
336 /************************************************************************
337 * WBOOBJ_GetExtent (IOleObject)
339 static HRESULT WINAPI
WBOOBJ_GetExtent(LPOLEOBJECT iface
, DWORD dwDrawAspect
,
342 FIXME("stub: (%p, %lx, %p)\n", iface
, dwDrawAspect
, psizel
);
346 /************************************************************************
347 * WBOOBJ_Advise (IOleObject)
349 static HRESULT WINAPI
WBOOBJ_Advise(LPOLEOBJECT iface
, IAdviseSink
* pAdvSink
,
350 DWORD
* pdwConnection
)
352 FIXME("stub: (%p, %p, %p)\n", iface
, pAdvSink
, pdwConnection
);
356 /************************************************************************
357 * WBOOBJ_Unadvise (IOleObject)
359 static HRESULT WINAPI
WBOOBJ_Unadvise(LPOLEOBJECT iface
, DWORD dwConnection
)
361 FIXME("stub: (%p, %ld)\n", iface
, dwConnection
);
365 /************************************************************************
366 * WBOOBJ_EnumAdvise (IOleObject)
368 static HRESULT WINAPI
WBOOBJ_EnumAdvise(LPOLEOBJECT iface
, IEnumSTATDATA
** ppenumAdvise
)
370 FIXME("stub: (%p, %p)\n", iface
, ppenumAdvise
);
374 /************************************************************************
375 * WBOOBJ_GetMiscStatus (IOleObject)
377 * Delegate to OleRegGetMiscStatus.
379 static HRESULT WINAPI
WBOOBJ_GetMiscStatus(LPOLEOBJECT iface
, DWORD dwAspect
,
384 TRACE("(%p, %lx, %p)\n", iface
, dwAspect
, pdwStatus
);
386 hres
= OleRegGetMiscStatus(&CLSID_WebBrowser
, dwAspect
, pdwStatus
);
394 /************************************************************************
395 * WBOOBJ_SetColorScheme (IOleObject)
397 * This method is meaningless if the server is not running
399 static HRESULT WINAPI
WBOOBJ_SetColorScheme(LPOLEOBJECT iface
,
400 struct tagLOGPALETTE
* pLogpal
)
402 FIXME("stub: (%p, %p))\n", iface
, pLogpal
);
403 return OLE_E_NOTRUNNING
;
406 /**********************************************************************
407 * IOleObject virtual function table for IE Web Browser component
410 static IOleObjectVtbl WBOOBJ_Vtbl
=
412 WBOOBJ_QueryInterface
,
415 WBOOBJ_SetClientSite
,
416 WBOOBJ_GetClientSite
,
422 WBOOBJ_GetClipboardData
,
427 WBOOBJ_GetUserClassID
,
434 WBOOBJ_GetMiscStatus
,
435 WBOOBJ_SetColorScheme
438 IOleObjectImpl SHDOCVW_OleObject
= {&WBOOBJ_Vtbl
};
441 /**********************************************************************
442 * Implement the IOleInPlaceObject interface
445 static HRESULT WINAPI
WBOIPO_QueryInterface(LPOLEINPLACEOBJECT iface
,
446 REFIID riid
, LPVOID
*ppobj
)
448 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid
));
450 if (ppobj
== NULL
) return E_POINTER
;
452 return E_NOINTERFACE
;
455 static ULONG WINAPI
WBOIPO_AddRef(LPOLEINPLACEOBJECT iface
)
457 SHDOCVW_LockModule();
459 return 2; /* non-heap based object */
462 static ULONG WINAPI
WBOIPO_Release(LPOLEINPLACEOBJECT iface
)
464 SHDOCVW_UnlockModule();
466 return 1; /* non-heap based object */
469 static HRESULT WINAPI
WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface
, HWND
* phwnd
)
472 /* Create a fake window to fool MFC into believing that we actually
473 * have an implemented browser control. Avoids the assertion.
476 hwnd
= CreateWindowA("BUTTON", "Web Control",
477 WS_HSCROLL
| WS_VSCROLL
| WS_OVERLAPPEDWINDOW
,
478 CW_USEDEFAULT
, CW_USEDEFAULT
, 600,
479 400, NULL
, NULL
, NULL
, NULL
);
482 TRACE ("Returning hwnd = %d\n", hwnd
);
485 FIXME("stub HWND* = %p\n", phwnd
);
489 static HRESULT WINAPI
WBOIPO_ContextSensitiveHelp(LPOLEINPLACEOBJECT iface
,
492 FIXME("stub fEnterMode = %d\n", fEnterMode
);
496 static HRESULT WINAPI
WBOIPO_InPlaceDeactivate(LPOLEINPLACEOBJECT iface
)
502 static HRESULT WINAPI
WBOIPO_UIDeactivate(LPOLEINPLACEOBJECT iface
)
508 static HRESULT WINAPI
WBOIPO_SetObjectRects(LPOLEINPLACEOBJECT iface
,
509 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
511 FIXME("stub PosRect = %p, ClipRect = %p\n", lprcPosRect
, lprcClipRect
);
515 static HRESULT WINAPI
WBOIPO_ReactivateAndUndo(LPOLEINPLACEOBJECT iface
)
521 /**********************************************************************
522 * IOleInPlaceObject virtual function table for IE Web Browser component
525 static IOleInPlaceObjectVtbl WBOIPO_Vtbl
=
527 WBOIPO_QueryInterface
,
531 WBOIPO_ContextSensitiveHelp
,
532 WBOIPO_InPlaceDeactivate
,
534 WBOIPO_SetObjectRects
,
535 WBOIPO_ReactivateAndUndo
538 IOleInPlaceObjectImpl SHDOCVW_OleInPlaceObject
= {&WBOIPO_Vtbl
};
541 /**********************************************************************
542 * Implement the IOleControl interface
545 static HRESULT WINAPI
WBOC_QueryInterface(LPOLECONTROL iface
,
546 REFIID riid
, LPVOID
*ppobj
)
548 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid
));
550 if (ppobj
== NULL
) return E_POINTER
;
552 return E_NOINTERFACE
;
555 static ULONG WINAPI
WBOC_AddRef(LPOLECONTROL iface
)
557 SHDOCVW_LockModule();
559 return 2; /* non-heap based object */
562 static ULONG WINAPI
WBOC_Release(LPOLECONTROL iface
)
564 SHDOCVW_UnlockModule();
566 return 1; /* non-heap based object */
569 static HRESULT WINAPI
WBOC_GetControlInfo(LPOLECONTROL iface
, LPCONTROLINFO pCI
)
571 FIXME("stub: LPCONTROLINFO = %p\n", pCI
);
575 static HRESULT WINAPI
WBOC_OnMnemonic(LPOLECONTROL iface
, struct tagMSG
*pMsg
)
577 FIXME("stub: MSG* = %p\n", pMsg
);
581 static HRESULT WINAPI
WBOC_OnAmbientPropertyChange(LPOLECONTROL iface
, DISPID dispID
)
583 FIXME("stub: DISPID = %ld\n", dispID
);
587 static HRESULT WINAPI
WBOC_FreezeEvents(LPOLECONTROL iface
, BOOL bFreeze
)
589 FIXME("stub: bFreeze = %d\n", bFreeze
);
593 /**********************************************************************
594 * IOleControl virtual function table for IE Web Browser component
597 static IOleControlVtbl WBOC_Vtbl
=
604 WBOC_OnAmbientPropertyChange
,
608 IOleControlImpl SHDOCVW_OleControl
= {&WBOC_Vtbl
};