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
);
60 TRACE("(%p)->(%p)\n", This
, pClientSite
);
62 if(This
->client
== pClientSite
)
66 IOleClientSite_Release(This
->client
);
69 IOleClientSite_AddRef(pClientSite
);
71 This
->client
= pClientSite
;
75 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, LPOLECLIENTSITE
*ppClientSite
)
77 WebBrowser
*This
= OLEOBJ_THIS(iface
);
79 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
85 IOleClientSite_AddRef(This
->client
);
86 *ppClientSite
= This
->client
;
91 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
,
92 LPCOLESTR szContainerObj
)
94 WebBrowser
*This
= OLEOBJ_THIS(iface
);
95 FIXME("(%p)->(%s, %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
99 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
101 WebBrowser
*This
= OLEOBJ_THIS(iface
);
102 FIXME("(%p)->(%ld)\n", This
, dwSaveOption
);
106 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
* pmk
)
108 WebBrowser
*This
= OLEOBJ_THIS(iface
);
109 FIXME("(%p)->(%ld, %p)\n", This
, dwWhichMoniker
, pmk
);
113 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
,
114 DWORD dwWhichMoniker
, LPMONIKER
*ppmk
)
116 WebBrowser
*This
= OLEOBJ_THIS(iface
);
117 FIXME("(%p)->(%ld, %ld, %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
121 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, LPDATAOBJECT pDataObject
,
122 BOOL fCreation
, DWORD dwReserved
)
124 WebBrowser
*This
= OLEOBJ_THIS(iface
);
125 FIXME("(%p)->(%p, %d, %ld)\n", This
, pDataObject
, fCreation
, dwReserved
);
129 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
,
130 LPDATAOBJECT
*ppDataObject
)
132 WebBrowser
*This
= OLEOBJ_THIS(iface
);
133 FIXME("(%p)->(%ld, %p)\n", This
, dwReserved
, ppDataObject
);
137 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, struct tagMSG
* lpmsg
,
138 LPOLECLIENTSITE pActiveSite
, LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
140 WebBrowser
*This
= OLEOBJ_THIS(iface
);
141 FIXME("(%p)->(%ld %p %p %ld %p %p)\n", This
, iVerb
, lpmsg
, pActiveSite
, lindex
, hwndParent
,
145 case OLEIVERB_INPLACEACTIVATE
:
146 FIXME ("stub for OLEIVERB_INPLACEACTIVATE\n");
149 FIXME ("stub for OLEIVERB_HIDE\n");
156 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
158 WebBrowser
*This
= OLEOBJ_THIS(iface
);
159 TRACE("(%p)->(%p)\n", This
, ppEnumOleVerb
);
160 return OleRegEnumVerbs(&CLSID_WebBrowser
, ppEnumOleVerb
);
163 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
165 WebBrowser
*This
= OLEOBJ_THIS(iface
);
166 FIXME("(%p)\n", This
);
170 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
172 WebBrowser
*This
= OLEOBJ_THIS(iface
);
173 FIXME("(%p)\n", This
);
177 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
* pClsid
)
179 WebBrowser
*This
= OLEOBJ_THIS(iface
);
180 FIXME("(%p)->(%p)\n", This
, pClsid
);
184 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
,
185 LPOLESTR
* pszUserType
)
187 WebBrowser
*This
= OLEOBJ_THIS(iface
);
188 TRACE("(%p, %ld, %p)\n", This
, dwFormOfType
, pszUserType
);
189 return OleRegGetUserType(&CLSID_WebBrowser
, dwFormOfType
, pszUserType
);
192 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
194 WebBrowser
*This
= OLEOBJ_THIS(iface
);
195 FIXME("(%p)->(%lx %p)\n", This
, dwDrawAspect
, psizel
);
199 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
201 WebBrowser
*This
= OLEOBJ_THIS(iface
);
202 FIXME("(%p)->(%lx, %p)\n", This
, dwDrawAspect
, psizel
);
206 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
,
207 DWORD
* pdwConnection
)
209 WebBrowser
*This
= OLEOBJ_THIS(iface
);
210 FIXME("(%p)->(%p, %p)\n", This
, pAdvSink
, pdwConnection
);
214 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
216 WebBrowser
*This
= OLEOBJ_THIS(iface
);
217 FIXME("(%p)->(%ld)\n", This
, dwConnection
);
221 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
223 WebBrowser
*This
= OLEOBJ_THIS(iface
);
224 FIXME("(%p)->(%p)\n", This
, ppenumAdvise
);
228 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
230 WebBrowser
*This
= OLEOBJ_THIS(iface
);
233 TRACE("(%p)->(%lx, %p)\n", This
, dwAspect
, pdwStatus
);
235 hres
= OleRegGetMiscStatus(&CLSID_WebBrowser
, dwAspect
, pdwStatus
);
243 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
* pLogpal
)
245 WebBrowser
*This
= OLEOBJ_THIS(iface
);
246 FIXME("(%p)->(%p)\n", This
, pLogpal
);
252 static const IOleObjectVtbl OleObjectVtbl
=
254 OleObject_QueryInterface
,
257 OleObject_SetClientSite
,
258 OleObject_GetClientSite
,
259 OleObject_SetHostNames
,
261 OleObject_SetMoniker
,
262 OleObject_GetMoniker
,
263 OleObject_InitFromData
,
264 OleObject_GetClipboardData
,
268 OleObject_IsUpToDate
,
269 OleObject_GetUserClassID
,
270 OleObject_GetUserType
,
275 OleObject_EnumAdvise
,
276 OleObject_GetMiscStatus
,
277 OleObject_SetColorScheme
280 /**********************************************************************
281 * Implement the IOleInPlaceObject interface
284 #define INPLACEOBJ_THIS(iface) DEFINE_THIS(WebBrowser, OleInPlaceObject, iface)
286 static HRESULT WINAPI
OleInPlaceObject_QueryInterface(IOleInPlaceObject
*iface
,
287 REFIID riid
, LPVOID
*ppobj
)
289 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
290 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
293 static ULONG WINAPI
OleInPlaceObject_AddRef(IOleInPlaceObject
*iface
)
295 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
296 return IWebBrowser_AddRef(WEBBROWSER(This
));
299 static ULONG WINAPI
OleInPlaceObject_Release(IOleInPlaceObject
*iface
)
301 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
302 return IWebBrowser_Release(WEBBROWSER(This
));
305 static HRESULT WINAPI
OleInPlaceObject_GetWindow(IOleInPlaceObject
*iface
, HWND
* phwnd
)
307 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
309 FIXME("(%p)->(%p)\n", This
, phwnd
);
312 /* Create a fake window to fool MFC into believing that we actually
313 * have an implemented browser control. Avoids the assertion.
316 hwnd
= CreateWindowA("BUTTON", "Web Control",
317 WS_HSCROLL
| WS_VSCROLL
| WS_OVERLAPPEDWINDOW
,
318 CW_USEDEFAULT
, CW_USEDEFAULT
, 600,
319 400, NULL
, NULL
, NULL
, NULL
);
322 TRACE ("Returning hwnd = %d\n", hwnd
);
328 static HRESULT WINAPI
OleInPlaceObject_ContextSensitiveHelp(IOleInPlaceObject
*iface
,
331 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
332 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
336 static HRESULT WINAPI
OleInPlaceObject_InPlaceDeactivate(IOleInPlaceObject
*iface
)
338 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
339 FIXME("(%p)\n", This
);
343 static HRESULT WINAPI
OleInPlaceObject_UIDeactivate(IOleInPlaceObject
*iface
)
345 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
346 FIXME("(%p)\n", This
);
350 static HRESULT WINAPI
OleInPlaceObject_SetObjectRects(IOleInPlaceObject
*iface
,
351 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
353 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
354 FIXME("(%p)->(%p %p)\n", This
, lprcPosRect
, lprcClipRect
);
358 static HRESULT WINAPI
OleInPlaceObject_ReactivateAndUndo(IOleInPlaceObject
*iface
)
360 WebBrowser
*This
= INPLACEOBJ_THIS(iface
);
361 FIXME("(%p)\n", This
);
365 #undef INPLACEOBJ_THIS
367 static const IOleInPlaceObjectVtbl OleInPlaceObjectVtbl
=
369 OleInPlaceObject_QueryInterface
,
370 OleInPlaceObject_AddRef
,
371 OleInPlaceObject_Release
,
372 OleInPlaceObject_GetWindow
,
373 OleInPlaceObject_ContextSensitiveHelp
,
374 OleInPlaceObject_InPlaceDeactivate
,
375 OleInPlaceObject_UIDeactivate
,
376 OleInPlaceObject_SetObjectRects
,
377 OleInPlaceObject_ReactivateAndUndo
380 /**********************************************************************
381 * Implement the IOleControl interface
384 #define CONTROL_THIS(iface) DEFINE_THIS(WebBrowser, OleControl, iface)
386 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
,
387 REFIID riid
, LPVOID
*ppobj
)
389 WebBrowser
*This
= CONTROL_THIS(iface
);
390 return IWebBrowser_QueryInterface(WEBBROWSER(This
), riid
, ppobj
);
393 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
395 WebBrowser
*This
= CONTROL_THIS(iface
);
396 return IWebBrowser_AddRef(WEBBROWSER(This
));
399 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
401 WebBrowser
*This
= CONTROL_THIS(iface
);
402 return IWebBrowser_Release(WEBBROWSER(This
));
405 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, LPCONTROLINFO pCI
)
407 WebBrowser
*This
= CONTROL_THIS(iface
);
408 FIXME("(%p)->(%p)\n", This
, pCI
);
412 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, struct tagMSG
*pMsg
)
414 WebBrowser
*This
= CONTROL_THIS(iface
);
415 FIXME("(%p)->(%p)\n", This
, pMsg
);
419 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
421 WebBrowser
*This
= CONTROL_THIS(iface
);
422 FIXME("(%p)->(%ld)\n", This
, dispID
);
426 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL bFreeze
)
428 WebBrowser
*This
= CONTROL_THIS(iface
);
429 FIXME("(%p)->(%x)\n", This
, bFreeze
);
435 static const IOleControlVtbl OleControlVtbl
=
437 OleControl_QueryInterface
,
440 OleControl_GetControlInfo
,
441 OleControl_OnMnemonic
,
442 OleControl_OnAmbientPropertyChange
,
443 OleControl_FreezeEvents
446 void WebBrowser_OleObject_Init(WebBrowser
*This
)
448 This
->lpOleObjectVtbl
= &OleObjectVtbl
;
449 This
->lpOleInPlaceObjectVtbl
= &OleInPlaceObjectVtbl
;
450 This
->lpOleControlVtbl
= &OleControlVtbl
;