Moved a few remaining 16-bit window functions to wnd16.c and moved it
[wine.git] / dlls / shdocvw / oleobject.c
blobd7db11a995c308075a72ecea5a3698a50494743f
1 /*
2 * Implementation of IOleObject interfaces for IE Web Browser
4 * - IOleObject
5 * - IOleInPlaceObject
6 * - IOleControl
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
25 #include <string.h>
26 #include "wine/debug.h"
27 #include "shdocvw.h"
28 #include "ole2.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) )
62 return E_INVALIDARG;
64 if (IsEqualGUID (&IID_IPersistStorage, riid))
66 TRACE("Returning IID_IPersistStorage interface\n");
67 *ppobj = (LPVOID)&SHDOCVW_PersistStorage;
68 WBOOBJ_AddRef (iface);
69 return S_OK;
71 else if (IsEqualGUID (&IID_IPersistStreamInit, riid))
73 TRACE("Returning IID_IPersistStreamInit interface\n");
74 *ppobj = (LPVOID)&SHDOCVW_PersistStreamInit;
75 WBOOBJ_AddRef (iface);
76 return S_OK;
78 else if (IsEqualGUID (&IID_IProvideClassInfo, riid))
80 TRACE("Returning IID_IProvideClassInfo interface\n");
81 *ppobj = (LPVOID)&SHDOCVW_ProvideClassInfo;
82 WBOOBJ_AddRef (iface);
83 return S_OK;
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);
91 return S_OK;
93 else if (IsEqualGUID (&IID_IQuickActivate, riid))
95 TRACE("Returning IID_IQuickActivate interface\n");
96 *ppobj = (LPVOID)&SHDOCVW_QuickActivate;
97 WBOOBJ_AddRef (iface);
98 return S_OK;
100 else if (IsEqualGUID (&IID_IConnectionPointContainer, riid))
102 TRACE("Returning IID_IConnectionPointContainer interface\n");
103 *ppobj = (LPVOID)&SHDOCVW_ConnectionPointContainer;
104 WBOOBJ_AddRef (iface);
105 return S_OK;
107 else if (IsEqualGUID (&IID_IOleInPlaceObject, riid))
109 TRACE("Returning IID_IOleInPlaceObject interface\n");
110 *ppobj = (LPVOID)&SHDOCVW_OleInPlaceObject;
111 WBOOBJ_AddRef (iface);
112 return S_OK;
114 else if (IsEqualGUID (&IID_IOleControl, riid))
116 TRACE("Returning IID_IOleControl interface\n");
117 *ppobj = (LPVOID)&SHDOCVW_OleControl;
118 WBOOBJ_AddRef (iface);
119 return S_OK;
121 else if (IsEqualGUID (&IID_IWebBrowser, riid))
123 TRACE("Returning IID_IWebBrowser interface\n");
124 *ppobj = (LPVOID)&SHDOCVW_WebBrowser;
125 WBOOBJ_AddRef (iface);
126 return S_OK;
128 else if (IsEqualGUID (&IID_IDispatch, riid))
130 TRACE("Returning IID_IDispatch interface\n");
131 *ppobj = (LPVOID)&SHDOCVW_WebBrowser;
132 WBOOBJ_AddRef (iface);
133 return S_OK;
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);
148 TRACE("\n");
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 */
160 TRACE("\n");
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);
171 return S_OK;
174 /************************************************************************
175 * WBOOBJ_GetClientSite (IOleObject)
177 static HRESULT WINAPI WBOOBJ_GetClientSite(LPOLEOBJECT iface,
178 LPOLECLIENTSITE* ppClientSite)
180 FIXME("stub: (%p)\n", *ppClientSite);
181 return S_OK;
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));
192 return S_OK;
195 /************************************************************************
196 * WBOOBJ_Close (IOleObject)
198 static HRESULT WINAPI WBOOBJ_Close(LPOLEOBJECT iface, DWORD dwSaveOption)
200 FIXME("stub: ()\n");
201 return S_OK;
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);
211 return S_OK;
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);
223 return E_UNSPEC;
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);
258 switch (iVerb)
260 case OLEIVERB_INPLACEACTIVATE:
261 FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
262 break;
263 case OLEIVERB_HIDE:
264 FIXME ("stub for OLEIVERB_HIDE\n");
265 break;
268 return S_OK;
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)
289 FIXME(": Stub\n");
290 return E_NOTIMPL;
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);
310 return S_OK;
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,
332 SIZEL* psizel)
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,
343 SIZEL* psizel)
345 FIXME("stub: (%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
346 return S_OK;
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);
356 return S_OK;
359 /************************************************************************
360 * WBOOBJ_Unadvise (IOleObject)
362 static HRESULT WINAPI WBOOBJ_Unadvise(LPOLEOBJECT iface, DWORD dwConnection)
364 FIXME("stub: (%p, %ld)\n", iface, dwConnection);
365 return S_OK;
368 /************************************************************************
369 * WBOOBJ_EnumAdvise (IOleObject)
371 static HRESULT WINAPI WBOOBJ_EnumAdvise(LPOLEOBJECT iface, IEnumSTATDATA** ppenumAdvise)
373 FIXME("stub: (%p, %p)\n", iface, ppenumAdvise);
374 return S_OK;
377 /************************************************************************
378 * WBOOBJ_GetMiscStatus (IOleObject)
380 * Delegate to OleRegGetMiscStatus.
382 static HRESULT WINAPI WBOOBJ_GetMiscStatus(LPOLEOBJECT iface, DWORD dwAspect,
383 DWORD* pdwStatus)
385 HRESULT hres;
387 TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus);
389 hres = OleRegGetMiscStatus(&CLSID_WebBrowser, dwAspect, pdwStatus);
391 if (FAILED(hres))
392 *pdwStatus = 0;
394 return S_OK;
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,
417 WBOOBJ_AddRef,
418 WBOOBJ_Release,
419 WBOOBJ_SetClientSite,
420 WBOOBJ_GetClientSite,
421 WBOOBJ_SetHostNames,
422 WBOOBJ_Close,
423 WBOOBJ_SetMoniker,
424 WBOOBJ_GetMoniker,
425 WBOOBJ_InitFromData,
426 WBOOBJ_GetClipboardData,
427 WBOOBJ_DoVerb,
428 WBOOBJ_EnumVerbs,
429 WBOOBJ_Update,
430 WBOOBJ_IsUpToDate,
431 WBOOBJ_GetUserClassID,
432 WBOOBJ_GetUserType,
433 WBOOBJ_SetExtent,
434 WBOOBJ_GetExtent,
435 WBOOBJ_Advise,
436 WBOOBJ_Unadvise,
437 WBOOBJ_EnumAdvise,
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);
462 TRACE("\n");
463 return ++(This->ref);
466 static ULONG WINAPI WBOIPO_Release(LPOLEINPLACEOBJECT iface)
468 ICOM_THIS(IOleInPlaceObjectImpl, iface);
470 /* static class, won't be freed */
471 TRACE("\n");
472 return --(This->ref);
475 static HRESULT WINAPI WBOIPO_GetWindow(LPOLEINPLACEOBJECT iface, HWND* phwnd)
477 #if 0
478 /* Create a fake window to fool MFC into believing that we actually
479 * have an implemented browser control. Avoids the assertion.
481 HWND hwnd;
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);
487 *phwnd = hwnd;
488 TRACE ("Returning hwnd = %d\n", hwnd);
489 #endif
491 FIXME("stub HWND* = %p\n", phwnd);
492 return S_OK;
495 static HRESULT WINAPI WBOIPO_ContextSensitiveHelp(LPOLEINPLACEOBJECT iface,
496 BOOL fEnterMode)
498 FIXME("stub fEnterMode = %d\n", fEnterMode);
499 return S_OK;
502 static HRESULT WINAPI WBOIPO_InPlaceDeactivate(LPOLEINPLACEOBJECT iface)
504 FIXME("stub \n");
505 return S_OK;
508 static HRESULT WINAPI WBOIPO_UIDeactivate(LPOLEINPLACEOBJECT iface)
510 FIXME("stub \n");
511 return S_OK;
514 static HRESULT WINAPI WBOIPO_SetObjectRects(LPOLEINPLACEOBJECT iface,
515 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
517 FIXME("stub PosRect = %p, ClipRect = %p\n", lprcPosRect, lprcClipRect);
518 return S_OK;
521 static HRESULT WINAPI WBOIPO_ReactivateAndUndo(LPOLEINPLACEOBJECT iface)
523 FIXME("stub \n");
524 return S_OK;
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,
535 WBOIPO_AddRef,
536 WBOIPO_Release,
537 WBOIPO_GetWindow,
538 WBOIPO_ContextSensitiveHelp,
539 WBOIPO_InPlaceDeactivate,
540 WBOIPO_UIDeactivate,
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);
565 TRACE("\n");
566 return ++(This->ref);
569 static ULONG WINAPI WBOC_Release(LPOLECONTROL iface)
571 ICOM_THIS(IOleControlImpl, iface);
573 /* static class, won't be freed */
574 TRACE("\n");
575 return --(This->ref);
578 static HRESULT WINAPI WBOC_GetControlInfo(LPOLECONTROL iface, LPCONTROLINFO pCI)
580 FIXME("stub: LPCONTROLINFO = %p\n", pCI);
581 return S_OK;
584 static HRESULT WINAPI WBOC_OnMnemonic(LPOLECONTROL iface, struct tagMSG *pMsg)
586 FIXME("stub: MSG* = %p\n", pMsg);
587 return S_OK;
590 static HRESULT WINAPI WBOC_OnAmbientPropertyChange(LPOLECONTROL iface, DISPID dispID)
592 FIXME("stub: DISPID = %ld\n", dispID);
593 return S_OK;
596 static HRESULT WINAPI WBOC_FreezeEvents(LPOLECONTROL iface, BOOL bFreeze)
598 FIXME("stub: bFreeze = %d\n", bFreeze);
599 return S_OK;
602 /**********************************************************************
603 * IOleControl virtual function table for IE Web Browser component
606 static ICOM_VTABLE(IOleControl) WBOC_Vtbl =
608 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
609 WBOC_QueryInterface,
610 WBOC_AddRef,
611 WBOC_Release,
612 WBOC_GetControlInfo,
613 WBOC_OnMnemonic,
614 WBOC_OnAmbientPropertyChange,
615 WBOC_FreezeEvents
618 IOleControlImpl SHDOCVW_OleControl = { &WBOC_Vtbl, 1 };