2 * Implementation of IOleObject interfaces for WebBrowser control
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
27 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
32 /**********************************************************************
33 * Implement the IOleObject interface for the WebBrowser control
36 #define OLEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleObject, iface)
38 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
40 WebBrowser *This = OLEOBJ_THIS(iface);
41 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppv);
44 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
46 WebBrowser *This = OLEOBJ_THIS(iface);
47 return IWebBrowser_AddRef(WEBBROWSER(This));
50 static ULONG WINAPI OleObject_Release(IOleObject *iface)
52 WebBrowser *This = OLEOBJ_THIS(iface);
53 return IWebBrowser_Release(WEBBROWSER(This));
56 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE pClientSite)
58 WebBrowser *This = OLEOBJ_THIS(iface);
59 FIXME("(%p)->(%p)\n", This, pClientSite);
63 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, LPOLECLIENTSITE *ppClientSite)
65 WebBrowser *This = OLEOBJ_THIS(iface);
66 FIXME("(%p)->(%p)\n", This, ppClientSite);
70 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp,
71 LPCOLESTR szContainerObj)
73 WebBrowser *This = OLEOBJ_THIS(iface);
74 FIXME("(%p)->(%s, %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
78 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
80 WebBrowser *This = OLEOBJ_THIS(iface);
81 FIXME("(%p)->(%ld)\n", This, dwSaveOption);
85 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
87 WebBrowser *This = OLEOBJ_THIS(iface);
88 FIXME("(%p)->(%ld, %p)\n", This, dwWhichMoniker, pmk);
92 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign,
93 DWORD dwWhichMoniker, LPMONIKER *ppmk)
95 WebBrowser *This = OLEOBJ_THIS(iface);
96 FIXME("(%p)->(%ld, %ld, %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
100 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, LPDATAOBJECT pDataObject,
101 BOOL fCreation, DWORD dwReserved)
103 WebBrowser *This = OLEOBJ_THIS(iface);
104 FIXME("(%p)->(%p, %d, %ld)\n", This, pDataObject, fCreation, dwReserved);
108 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved,
109 LPDATAOBJECT *ppDataObject)
111 WebBrowser *This = OLEOBJ_THIS(iface);
112 FIXME("(%p)->(%ld, %p)\n", This, dwReserved, ppDataObject);
116 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tagMSG* lpmsg,
117 LPOLECLIENTSITE pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
119 WebBrowser *This = OLEOBJ_THIS(iface);
120 FIXME("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
124 case OLEIVERB_INPLACEACTIVATE:
125 FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
128 FIXME ("stub for OLEIVERB_HIDE\n");
135 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
137 WebBrowser *This = OLEOBJ_THIS(iface);
138 TRACE("(%p)->(%p)\n", This, ppEnumOleVerb);
139 return OleRegEnumVerbs(&CLSID_WebBrowser, ppEnumOleVerb);
142 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
144 WebBrowser *This = OLEOBJ_THIS(iface);
145 FIXME("(%p)\n", This);
149 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
151 WebBrowser *This = OLEOBJ_THIS(iface);
152 FIXME("(%p)\n", This);
156 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID* pClsid)
158 WebBrowser *This = OLEOBJ_THIS(iface);
159 FIXME("(%p)->(%p)\n", This, pClsid);
163 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType,
164 LPOLESTR* pszUserType)
166 WebBrowser *This = OLEOBJ_THIS(iface);
167 TRACE("(%p, %ld, %p)\n", This, dwFormOfType, pszUserType);
168 return OleRegGetUserType(&CLSID_WebBrowser, dwFormOfType, pszUserType);
171 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
173 WebBrowser *This = OLEOBJ_THIS(iface);
174 FIXME("(%p)->(%lx %p)\n", This, dwDrawAspect, psizel);
178 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
180 WebBrowser *This = OLEOBJ_THIS(iface);
181 FIXME("(%p)->(%lx, %p)\n", This, dwDrawAspect, psizel);
185 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink,
186 DWORD* pdwConnection)
188 WebBrowser *This = OLEOBJ_THIS(iface);
189 FIXME("(%p)->(%p, %p)\n", This, pAdvSink, pdwConnection);
193 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
195 WebBrowser *This = OLEOBJ_THIS(iface);
196 FIXME("(%p)->(%ld)\n", This, dwConnection);
200 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
202 WebBrowser *This = OLEOBJ_THIS(iface);
203 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
207 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
209 WebBrowser *This = OLEOBJ_THIS(iface);
212 TRACE("(%p)->(%lx, %p)\n", This, dwAspect, pdwStatus);
214 hres = OleRegGetMiscStatus(&CLSID_WebBrowser, dwAspect, pdwStatus);
222 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE* pLogpal)
224 WebBrowser *This = OLEOBJ_THIS(iface);
225 FIXME("(%p)->(%p)\n", This, pLogpal);
231 static const IOleObjectVtbl OleObjectVtbl =
233 OleObject_QueryInterface,
236 OleObject_SetClientSite,
237 OleObject_GetClientSite,
238 OleObject_SetHostNames,
240 OleObject_SetMoniker,
241 OleObject_GetMoniker,
242 OleObject_InitFromData,
243 OleObject_GetClipboardData,
247 OleObject_IsUpToDate,
248 OleObject_GetUserClassID,
249 OleObject_GetUserType,
254 OleObject_EnumAdvise,
255 OleObject_GetMiscStatus,
256 OleObject_SetColorScheme
259 /**********************************************************************
260 * Implement the IOleInPlaceObject interface
263 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
265 static HRESULT WINAPI OleInPlaceObject_QueryInterface(IOleInPlaceObject *iface,
266 REFIID riid, LPVOID *ppobj)
268 WebBrowser *This = INPLACEOBJ_THIS(iface);
269 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
272 static ULONG WINAPI OleInPlaceObject_AddRef(IOleInPlaceObject *iface)
274 WebBrowser *This = INPLACEOBJ_THIS(iface);
275 return IWebBrowser_AddRef(WEBBROWSER(This));
278 static ULONG WINAPI OleInPlaceObject_Release(IOleInPlaceObject *iface)
280 WebBrowser *This = INPLACEOBJ_THIS(iface);
281 return IWebBrowser_Release(WEBBROWSER(This));
284 static HRESULT WINAPI OleInPlaceObject_GetWindow(IOleInPlaceObject *iface, HWND* phwnd)
286 WebBrowser *This = INPLACEOBJ_THIS(iface);
288 FIXME("(%p)->(%p)\n", This, phwnd);
291 /* Create a fake window to fool MFC into believing that we actually
292 * have an implemented browser control. Avoids the assertion.
295 hwnd = CreateWindowA("BUTTON", "Web Control",
296 WS_HSCROLL | WS_VSCROLL | WS_OVERLAPPEDWINDOW,
297 CW_USEDEFAULT, CW_USEDEFAULT, 600,
298 400, NULL, NULL, NULL, NULL);
301 TRACE ("Returning hwnd = %d\n", hwnd);
307 static HRESULT WINAPI OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject *iface,
310 WebBrowser *This = INPLACEOBJ_THIS(iface);
311 FIXME("(%p)->(%x)\n", This, fEnterMode);
315 static HRESULT WINAPI OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject *iface)
317 WebBrowser *This = INPLACEOBJ_THIS(iface);
318 FIXME("(%p)\n", This);
322 static HRESULT WINAPI OleInPlaceObject_UIDeactivate(IOleInPlaceObject *iface)
324 WebBrowser *This = INPLACEOBJ_THIS(iface);
325 FIXME("(%p)\n", This);
329 static HRESULT WINAPI OleInPlaceObject_SetObjectRects(IOleInPlaceObject *iface,
330 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
332 WebBrowser *This = INPLACEOBJ_THIS(iface);
333 FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
337 static HRESULT WINAPI OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject *iface)
339 WebBrowser *This = INPLACEOBJ_THIS(iface);
340 FIXME("(%p)\n", This);
344 #undef INPLACEOBJ_THIS
346 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl =
348 OleInPlaceObject_QueryInterface,
349 OleInPlaceObject_AddRef,
350 OleInPlaceObject_Release,
351 OleInPlaceObject_GetWindow,
352 OleInPlaceObject_ContextSensitiveHelp,
353 OleInPlaceObject_InPlaceDeactivate,
354 OleInPlaceObject_UIDeactivate,
355 OleInPlaceObject_SetObjectRects,
356 OleInPlaceObject_ReactivateAndUndo
359 /**********************************************************************
360 * Implement the IOleControl interface
363 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
365 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface,
366 REFIID riid, LPVOID *ppobj)
368 WebBrowser *This = CONTROL_THIS(iface);
369 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
372 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
374 WebBrowser *This = CONTROL_THIS(iface);
375 return IWebBrowser_AddRef(WEBBROWSER(This));
378 static ULONG WINAPI OleControl_Release(IOleControl *iface)
380 WebBrowser *This = CONTROL_THIS(iface);
381 return IWebBrowser_Release(WEBBROWSER(This));
384 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, LPCONTROLINFO pCI)
386 WebBrowser *This = CONTROL_THIS(iface);
387 FIXME("(%p)->(%p)\n", This, pCI);
391 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, struct tagMSG *pMsg)
393 WebBrowser *This = CONTROL_THIS(iface);
394 FIXME("(%p)->(%p)\n", This, pMsg);
398 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
400 WebBrowser *This = CONTROL_THIS(iface);
401 FIXME("(%p)->(%ld)\n", This, dispID);
405 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
407 WebBrowser *This = CONTROL_THIS(iface);
408 FIXME("(%p)->(%x)\n", This, bFreeze);
414 static const IOleControlVtbl OleControlVtbl =
416 OleControl_QueryInterface,
419 OleControl_GetControlInfo,
420 OleControl_OnMnemonic,
421 OleControl_OnAmbientPropertyChange,
422 OleControl_FreezeEvents
425 void WebBrowser_OleObject_Init(WebBrowser *This)
427 This->lpOleObjectVtbl = &OleObjectVtbl;
428 This->lpOleInPlaceObjectVtbl = &OleInPlaceObjectVtbl;
429 This->lpOleControlVtbl = &OleControlVtbl;