wined3d: Don't report filtering for WINED3DFMT_R32F.
[wine/multimedia.git] / dlls / shdocvw / webbrowser.c
blobc9af82f7448e52200f2db2b8de2f291a9401ffb8
1 /*
2 * Implementation of IWebBrowser interface for WebBrowser control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/debug.h"
23 #include "shdocvw.h"
24 #include "exdispid.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
28 /**********************************************************************
29 * Implement the IWebBrowser interface
32 #define WEBBROWSER_THIS(iface) DEFINE_THIS(WebBrowser, WebBrowser2, iface)
34 static HRESULT WINAPI WebBrowser_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
36 WebBrowser *This = WEBBROWSER_THIS(iface);
38 if (ppv == NULL)
39 return E_POINTER;
40 *ppv = NULL;
42 if(IsEqualGUID(&IID_IUnknown, riid)) {
43 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
44 *ppv = WEBBROWSER(This);
45 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
46 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
47 *ppv = WEBBROWSER(This);
48 }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
49 TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
50 *ppv = WEBBROWSER(This);
51 }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
52 TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
53 *ppv = WEBBROWSER(This);
54 }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
55 TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
56 *ppv = WEBBROWSER(This);
57 }else if(IsEqualGUID(&IID_IOleObject, riid)) {
58 TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
59 *ppv = OLEOBJ(This);
60 }else if(IsEqualGUID(&IID_IOleWindow, riid)) {
61 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
62 *ppv = INPLACEOBJ(This);
63 }else if(IsEqualGUID (&IID_IOleInPlaceObject, riid)) {
64 TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
65 *ppv = INPLACEOBJ(This);
66 }else if(IsEqualGUID(&IID_IOleControl, riid)) {
67 TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
68 *ppv = CONTROL(This);
69 }else if(IsEqualGUID(&IID_IPersist, riid)) {
70 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
71 *ppv = PERSTORAGE(This);
72 }else if(IsEqualGUID(&IID_IPersistStorage, riid)) {
73 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
74 *ppv = PERSTORAGE(This);
75 }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
76 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
77 *ppv = PERSTRINIT(This);
78 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
79 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
80 *ppv = CLASSINFO(This);
81 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
82 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
83 *ppv = CLASSINFO(This);
84 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
85 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
86 *ppv = CONPTCONT(&This->doc_host.cps);
87 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
88 TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
89 *ppv = VIEWOBJ(This);
90 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
91 TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
92 *ppv = VIEWOBJ2(This);
93 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
94 TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
95 *ppv = ACTIVEOBJ(This);
96 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
97 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
98 *ppv = OLECMD(This);
99 }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
100 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
101 *ppv = HLINKFRAME(This);
102 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
103 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
104 return E_NOINTERFACE;
105 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
106 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
107 return E_NOINTERFACE;
110 if(*ppv) {
111 IUnknown_AddRef((IUnknown*)*ppv);
112 return S_OK;
115 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
116 return E_NOINTERFACE;
119 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
121 WebBrowser *This = WEBBROWSER_THIS(iface);
122 LONG ref = InterlockedIncrement(&This->ref);
123 TRACE("(%p) ref=%d\n", This, ref);
124 return ref;
127 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
129 WebBrowser *This = WEBBROWSER_THIS(iface);
130 LONG ref = InterlockedDecrement(&This->ref);
132 TRACE("(%p) ref=%d\n", This, ref);
134 if(!ref) {
135 if(This->doc_host.document)
136 IUnknown_Release(This->doc_host.document);
138 DocHost_Release(&This->doc_host);
140 WebBrowser_OleObject_Destroy(This);
142 shdocvw_free(This);
143 SHDOCVW_UnlockModule();
146 return ref;
149 /* IDispatch methods */
150 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
152 WebBrowser *This = WEBBROWSER_THIS(iface);
153 FIXME("(%p)->(%p)\n", This, pctinfo);
154 return E_NOTIMPL;
157 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
158 LPTYPEINFO *ppTInfo)
160 WebBrowser *This = WEBBROWSER_THIS(iface);
161 FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
162 return E_NOTIMPL;
165 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
166 LPOLESTR *rgszNames, UINT cNames,
167 LCID lcid, DISPID *rgDispId)
169 WebBrowser *This = WEBBROWSER_THIS(iface);
170 FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
171 lcid, rgDispId);
172 return E_NOTIMPL;
175 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
176 REFIID riid, LCID lcid, WORD wFlags,
177 DISPPARAMS *pDispParams, VARIANT *pVarResult,
178 EXCEPINFO *pExepInfo, UINT *puArgErr)
180 WebBrowser *This = WEBBROWSER_THIS(iface);
181 ITypeInfo *typeinfo;
182 HRESULT hres;
184 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
185 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
187 hres = get_typeinfo(&typeinfo);
188 if(FAILED(hres))
189 return hres;
191 return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
192 pVarResult, pExepInfo, puArgErr);
195 /* IWebBrowser methods */
196 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
198 WebBrowser *This = WEBBROWSER_THIS(iface);
199 FIXME("(%p)\n", This);
200 return E_NOTIMPL;
203 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
205 WebBrowser *This = WEBBROWSER_THIS(iface);
206 FIXME("(%p)\n", This);
207 return E_NOTIMPL;
210 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
212 WebBrowser *This = WEBBROWSER_THIS(iface);
213 TRACE("(%p)\n", This);
214 return go_home(&This->doc_host);
217 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
219 WebBrowser *This = WEBBROWSER_THIS(iface);
220 FIXME("(%p)\n", This);
221 return E_NOTIMPL;
224 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
225 VARIANT *Flags, VARIANT *TargetFrameName,
226 VARIANT *PostData, VARIANT *Headers)
228 WebBrowser *This = WEBBROWSER_THIS(iface);
230 TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
231 PostData, Headers);
233 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
236 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
238 WebBrowser *This = WEBBROWSER_THIS(iface);
239 FIXME("(%p)\n", This);
240 return E_NOTIMPL;
243 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
245 WebBrowser *This = WEBBROWSER_THIS(iface);
246 FIXME("(%p)->(%p)\n", This, Level);
247 return E_NOTIMPL;
250 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
252 WebBrowser *This = WEBBROWSER_THIS(iface);
253 FIXME("(%p)\n", This);
254 return E_NOTIMPL;
257 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
259 WebBrowser *This = WEBBROWSER_THIS(iface);
260 FIXME("(%p)->(%p)\n", This, ppDisp);
261 return E_NOTIMPL;
264 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
266 WebBrowser *This = WEBBROWSER_THIS(iface);
267 FIXME("(%p)->(%p)\n", This, ppDisp);
268 return E_NOTIMPL;
271 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
273 WebBrowser *This = WEBBROWSER_THIS(iface);
274 FIXME("(%p)->(%p)\n", This, ppDisp);
275 return E_NOTIMPL;
278 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
280 WebBrowser *This = WEBBROWSER_THIS(iface);
282 TRACE("(%p)->(%p)\n", This, ppDisp);
284 *ppDisp = NULL;
285 if(This->doc_host.document)
286 IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
288 return S_OK;
291 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
293 WebBrowser *This = WEBBROWSER_THIS(iface);
294 FIXME("(%p)->(%p)\n", This, pBool);
295 return E_NOTIMPL;
298 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
300 WebBrowser *This = WEBBROWSER_THIS(iface);
301 FIXME("(%p)->(%p)\n", This, Type);
302 return E_NOTIMPL;
305 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, long *pl)
307 WebBrowser *This = WEBBROWSER_THIS(iface);
309 TRACE("(%p)->(%p)\n", This, pl);
311 *pl = This->pos_rect.left;
312 return S_OK;
315 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, long Left)
317 WebBrowser *This = WEBBROWSER_THIS(iface);
318 RECT rect;
320 TRACE("(%p)->(%ld)\n", This, Left);
322 if(!This->inplace)
323 return E_UNEXPECTED;
325 memcpy(&rect, &This->pos_rect, sizeof(RECT));
326 rect.left = Left;
328 /* We don't really change the window position here.
329 * We just notify the embedder that he should do so. */
330 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
333 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, long *pl)
335 WebBrowser *This = WEBBROWSER_THIS(iface);
337 TRACE("(%p)->(%p)\n", This, pl);
339 *pl = This->pos_rect.top;
340 return S_OK;
343 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, long Top)
345 WebBrowser *This = WEBBROWSER_THIS(iface);
346 RECT rect;
348 TRACE("(%p)->(%ld)\n", This, Top);
350 if(!This->inplace)
351 return E_UNEXPECTED;
353 memcpy(&rect, &This->pos_rect, sizeof(RECT));
354 rect.top = Top;
356 /* We don't really change the window position here.
357 * We just notify the embedder that he should do so. */
358 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
361 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, long *pl)
363 WebBrowser *This = WEBBROWSER_THIS(iface);
365 TRACE("(%p)->(%p)\n", This, pl);
367 *pl = This->pos_rect.right - This->pos_rect.left;
368 return S_OK;
371 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, long Width)
373 WebBrowser *This = WEBBROWSER_THIS(iface);
374 RECT rect;
376 TRACE("(%p)->(%ld)\n", This, Width);
378 if(!This->inplace)
379 return E_UNEXPECTED;
381 memcpy(&rect, &This->pos_rect, sizeof(RECT));
382 rect.right = rect.left+Width;
384 /* We don't really change the window size here.
385 * We just notify the embedder that he should do so. */
386 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
389 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, long *pl)
391 WebBrowser *This = WEBBROWSER_THIS(iface);
393 TRACE("(%p)->(%p)\n", This, pl);
395 *pl = This->pos_rect.bottom - This->pos_rect.top;
396 return S_OK;
399 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, long Height)
401 WebBrowser *This = WEBBROWSER_THIS(iface);
402 RECT rect;
404 TRACE("(%p)->(%ld)\n", This, Height);
406 if(!This->inplace)
407 return E_UNEXPECTED;
409 memcpy(&rect, &This->pos_rect, sizeof(RECT));
410 rect.bottom = rect.top+Height;
412 /* We don't really change the window size here.
413 * We just notify the embedder that he should do so. */
414 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
417 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
419 WebBrowser *This = WEBBROWSER_THIS(iface);
420 FIXME("(%p)->(%p)\n", This, LocationName);
421 return E_NOTIMPL;
424 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
426 WebBrowser *This = WEBBROWSER_THIS(iface);
428 FIXME("(%p)->(%p)\n", This, LocationURL);
430 if(!This->doc_host.url) {
431 static const WCHAR null_char = 0;
432 *LocationURL = SysAllocString(&null_char);
433 return S_FALSE;
436 *LocationURL = SysAllocString(This->doc_host.url);
437 return S_OK;
440 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
442 WebBrowser *This = WEBBROWSER_THIS(iface);
443 FIXME("(%p)->(%p)\n", This, pBool);
444 return E_NOTIMPL;
447 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
449 WebBrowser *This = WEBBROWSER_THIS(iface);
450 FIXME("(%p)\n", This);
451 return E_NOTIMPL;
454 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
456 WebBrowser *This = WEBBROWSER_THIS(iface);
457 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
458 return E_NOTIMPL;
461 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
463 WebBrowser *This = WEBBROWSER_THIS(iface);
464 FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
465 return E_NOTIMPL;
468 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
470 WebBrowser *This = WEBBROWSER_THIS(iface);
471 FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
472 return E_NOTIMPL;
475 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
477 WebBrowser *This = WEBBROWSER_THIS(iface);
478 FIXME("(%p)->(%p)\n", This, Name);
479 return E_NOTIMPL;
482 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, long *pHWND)
484 WebBrowser *This = WEBBROWSER_THIS(iface);
486 TRACE("(%p)->(%p)\n", This, pHWND);
488 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
489 *pHWND = 0;
490 return E_FAIL;
493 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
495 WebBrowser *This = WEBBROWSER_THIS(iface);
496 FIXME("(%p)->(%p)\n", This, FullName);
497 return E_NOTIMPL;
500 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
502 WebBrowser *This = WEBBROWSER_THIS(iface);
503 FIXME("(%p)->(%p)\n", This, Path);
504 return E_NOTIMPL;
507 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
509 WebBrowser *This = WEBBROWSER_THIS(iface);
511 TRACE("(%p)->(%p)\n", This, pBool);
513 *pBool = This->visible;
514 return S_OK;
517 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
519 WebBrowser *This = WEBBROWSER_THIS(iface);
520 VARIANTARG arg;
521 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
523 TRACE("(%p)->(%x)\n", This, Value);
525 This->visible = Value;
527 V_VT(&arg) = VT_BOOL;
528 V_BOOL(&arg) = Value;
529 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
531 return S_OK;
534 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
536 WebBrowser *This = WEBBROWSER_THIS(iface);
538 TRACE("(%p)->(%p)\n", This, pBool);
540 *pBool = This->status_bar;
541 return S_OK;
544 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
546 WebBrowser *This = WEBBROWSER_THIS(iface);
547 VARIANTARG arg;
548 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
550 TRACE("(%p)->(%x)\n", This, Value);
552 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
554 /* In opposition to InternetExplorer, all we should do here is
555 * inform the embedder about the status bar change. */
557 V_VT(&arg) = VT_BOOL;
558 V_BOOL(&arg) = Value;
559 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
561 return S_OK;
564 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
566 WebBrowser *This = WEBBROWSER_THIS(iface);
567 FIXME("(%p)->(%p)\n", This, StatusText);
568 return E_NOTIMPL;
571 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
573 WebBrowser *This = WEBBROWSER_THIS(iface);
574 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
575 return E_NOTIMPL;
578 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
580 WebBrowser *This = WEBBROWSER_THIS(iface);
582 TRACE("(%p)->(%p)\n", This, Value);
584 *Value = This->tool_bar;
585 return S_OK;
588 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
590 WebBrowser *This = WEBBROWSER_THIS(iface);
591 VARIANTARG arg;
592 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
594 TRACE("(%p)->(%x)\n", This, Value);
596 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
598 /* In opposition to InternetExplorer, all we should do here is
599 * inform the embedder about the tool bar change. */
601 V_VT(&arg) = VT_BOOL;
602 V_BOOL(&arg) = Value;
603 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
605 return S_OK;
608 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
610 WebBrowser *This = WEBBROWSER_THIS(iface);
612 TRACE("(%p)->(%p)\n", This, Value);
614 *Value = This->menu_bar;
615 return S_OK;
618 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
620 WebBrowser *This = WEBBROWSER_THIS(iface);
621 VARIANTARG arg;
622 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
624 TRACE("(%p)->(%x)\n", This, Value);
626 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
628 /* In opposition to InternetExplorer, all we should do here is
629 * inform the embedder about the menu bar change. */
631 V_VT(&arg) = VT_BOOL;
632 V_BOOL(&arg) = Value;
633 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
635 return S_OK;
638 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
640 WebBrowser *This = WEBBROWSER_THIS(iface);
642 TRACE("(%p)->(%p)\n", This, pbFullScreen);
644 *pbFullScreen = This->full_screen;
645 return S_OK;
648 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
650 WebBrowser *This = WEBBROWSER_THIS(iface);
652 TRACE("(%p)->(%x)\n", This, bFullScreen);
654 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
655 return S_OK;
658 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
659 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
661 WebBrowser *This = WEBBROWSER_THIS(iface);
663 TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
665 if(!This->client)
666 return E_FAIL;
668 if(!URL)
669 return S_OK;
671 if(V_VT(URL) != VT_BSTR) {
672 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
673 return E_INVALIDARG;
676 return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
679 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
681 WebBrowser *This = WEBBROWSER_THIS(iface);
682 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
683 return E_NOTIMPL;
686 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
687 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
689 WebBrowser *This = WEBBROWSER_THIS(iface);
690 FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
691 return E_NOTIMPL;
694 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
695 VARIANT *pvarShow, VARIANT *pvarSize)
697 WebBrowser *This = WEBBROWSER_THIS(iface);
698 FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
699 return E_NOTIMPL;
702 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
704 WebBrowser *This = WEBBROWSER_THIS(iface);
705 FIXME("(%p)->(%p)\n", This, lpReadyState);
706 return E_NOTIMPL;
709 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
711 WebBrowser *This = WEBBROWSER_THIS(iface);
713 TRACE("(%p)->(%p)\n", This, pbOffline);
715 *pbOffline = This->doc_host.offline;
716 return S_OK;
719 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
721 WebBrowser *This = WEBBROWSER_THIS(iface);
723 TRACE("(%p)->(%x)\n", This, bOffline);
725 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
726 return S_OK;
729 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
731 WebBrowser *This = WEBBROWSER_THIS(iface);
733 TRACE("(%p)->(%p)\n", This, pbSilent);
735 *pbSilent = This->doc_host.silent;
736 return S_OK;
739 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
741 WebBrowser *This = WEBBROWSER_THIS(iface);
743 TRACE("(%p)->(%x)\n", This, bSilent);
745 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
746 return S_OK;
749 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
750 VARIANT_BOOL *pbRegister)
752 WebBrowser *This = WEBBROWSER_THIS(iface);
753 FIXME("(%p)->(%p)\n", This, pbRegister);
754 return E_NOTIMPL;
757 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
758 VARIANT_BOOL bRegister)
760 WebBrowser *This = WEBBROWSER_THIS(iface);
761 FIXME("(%p)->(%x)\n", This, bRegister);
762 return E_NOTIMPL;
765 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
766 VARIANT_BOOL *pbRegister)
768 WebBrowser *This = WEBBROWSER_THIS(iface);
769 FIXME("(%p)->(%p)\n", This, pbRegister);
770 return E_NOTIMPL;
773 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
774 VARIANT_BOOL bRegister)
776 WebBrowser *This = WEBBROWSER_THIS(iface);
777 FIXME("(%p)->(%x)\n", This, bRegister);
778 return S_OK;
781 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
783 WebBrowser *This = WEBBROWSER_THIS(iface);
784 FIXME("(%p)->(%p)\n", This, pbRegister);
785 return E_NOTIMPL;
788 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
790 WebBrowser *This = WEBBROWSER_THIS(iface);
791 FIXME("(%p)->(%x)\n", This, bRegister);
792 return E_NOTIMPL;
795 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
797 WebBrowser *This = WEBBROWSER_THIS(iface);
799 TRACE("(%p)->(%p)\n", This, Value);
801 *Value = This->address_bar;
802 return S_OK;
805 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
807 WebBrowser *This = WEBBROWSER_THIS(iface);
808 VARIANTARG arg;
809 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
811 TRACE("(%p)->(%x)\n", This, Value);
813 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
815 /* In opposition to InternetExplorer, all we should do here is
816 * inform the embedder about the address bar change. */
818 V_VT(&arg) = VT_BOOL;
819 V_BOOL(&arg) = Value;
820 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
822 return S_OK;
825 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
827 WebBrowser *This = WEBBROWSER_THIS(iface);
829 TRACE("(%p)->(%p)\n", This, Value);
831 /* It's InternetExplorer object's method. We have nothing to do here. */
832 return E_NOTIMPL;
835 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
837 WebBrowser *This = WEBBROWSER_THIS(iface);
839 TRACE("(%p)->(%x)\n", This, Value);
841 /* It's InternetExplorer object's method. We have nothing to do here. */
842 return S_OK;
845 #undef WEBBROWSER_THIS
847 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
849 WebBrowser_QueryInterface,
850 WebBrowser_AddRef,
851 WebBrowser_Release,
852 WebBrowser_GetTypeInfoCount,
853 WebBrowser_GetTypeInfo,
854 WebBrowser_GetIDsOfNames,
855 WebBrowser_Invoke,
856 WebBrowser_GoBack,
857 WebBrowser_GoForward,
858 WebBrowser_GoHome,
859 WebBrowser_GoSearch,
860 WebBrowser_Navigate,
861 WebBrowser_Refresh,
862 WebBrowser_Refresh2,
863 WebBrowser_Stop,
864 WebBrowser_get_Application,
865 WebBrowser_get_Parent,
866 WebBrowser_get_Container,
867 WebBrowser_get_Document,
868 WebBrowser_get_TopLevelContainer,
869 WebBrowser_get_Type,
870 WebBrowser_get_Left,
871 WebBrowser_put_Left,
872 WebBrowser_get_Top,
873 WebBrowser_put_Top,
874 WebBrowser_get_Width,
875 WebBrowser_put_Width,
876 WebBrowser_get_Height,
877 WebBrowser_put_Height,
878 WebBrowser_get_LocationName,
879 WebBrowser_get_LocationURL,
880 WebBrowser_get_Busy,
881 WebBrowser_Quit,
882 WebBrowser_ClientToWindow,
883 WebBrowser_PutProperty,
884 WebBrowser_GetProperty,
885 WebBrowser_get_Name,
886 WebBrowser_get_HWND,
887 WebBrowser_get_FullName,
888 WebBrowser_get_Path,
889 WebBrowser_get_Visible,
890 WebBrowser_put_Visible,
891 WebBrowser_get_StatusBar,
892 WebBrowser_put_StatusBar,
893 WebBrowser_get_StatusText,
894 WebBrowser_put_StatusText,
895 WebBrowser_get_ToolBar,
896 WebBrowser_put_ToolBar,
897 WebBrowser_get_MenuBar,
898 WebBrowser_put_MenuBar,
899 WebBrowser_get_FullScreen,
900 WebBrowser_put_FullScreen,
901 WebBrowser_Navigate2,
902 WebBrowser_QueryStatusWB,
903 WebBrowser_ExecWB,
904 WebBrowser_ShowBrowserBar,
905 WebBrowser_get_ReadyState,
906 WebBrowser_get_Offline,
907 WebBrowser_put_Offline,
908 WebBrowser_get_Silent,
909 WebBrowser_put_Silent,
910 WebBrowser_get_RegisterAsBrowser,
911 WebBrowser_put_RegisterAsBrowser,
912 WebBrowser_get_RegisterAsDropTarget,
913 WebBrowser_put_RegisterAsDropTarget,
914 WebBrowser_get_TheaterMode,
915 WebBrowser_put_TheaterMode,
916 WebBrowser_get_AddressBar,
917 WebBrowser_put_AddressBar,
918 WebBrowser_get_Resizable,
919 WebBrowser_put_Resizable
922 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
924 WebBrowser *ret;
925 HRESULT hres;
927 TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
929 ret = shdocvw_alloc(sizeof(WebBrowser));
931 ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
932 ret->ref = 0;
933 ret->version = version;
935 DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
937 ret->visible = VARIANT_TRUE;
938 ret->menu_bar = VARIANT_TRUE;
939 ret->address_bar = VARIANT_TRUE;
940 ret->status_bar = VARIANT_TRUE;
941 ret->tool_bar = VARIANT_TRUE;
942 ret->full_screen = VARIANT_FALSE;
944 WebBrowser_OleObject_Init(ret);
945 WebBrowser_ViewObject_Init(ret);
946 WebBrowser_Persist_Init(ret);
947 WebBrowser_ClassInfo_Init(ret);
948 WebBrowser_HlinkFrame_Init(ret);
950 hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
951 if(SUCCEEDED(hres)) {
952 SHDOCVW_LockModule();
953 }else {
954 shdocvw_free(ret);
955 return hres;
958 return hres;
961 HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv)
963 return WebBrowser_Create(1, pOuter, riid, ppv);
966 HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv)
968 return WebBrowser_Create(2, pOuter, riid, ppv);