Assorted spelling fixes.
[wine/hacks.git] / dlls / shdocvw / webbrowser.c
blobdf8012b9310d02cec8ea5a2f8fad130baa02824b
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_IPersistMemory, riid)) {
76 TRACE("(%p)->(IID_IPersistStorage %p)\n", This, ppv);
77 *ppv = PERMEMORY(This);
78 }else if(IsEqualGUID (&IID_IPersistStreamInit, riid)) {
79 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
80 *ppv = PERSTRINIT(This);
81 }else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
82 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
83 *ppv = CLASSINFO(This);
84 }else if(IsEqualGUID(&IID_IProvideClassInfo2, riid)) {
85 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
86 *ppv = CLASSINFO(This);
87 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
88 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
89 *ppv = CONPTCONT(&This->doc_host.cps);
90 }else if(IsEqualGUID(&IID_IViewObject, riid)) {
91 TRACE("(%p)->(IID_IViewObject %p)\n", This, ppv);
92 *ppv = VIEWOBJ(This);
93 }else if(IsEqualGUID(&IID_IViewObject2, riid)) {
94 TRACE("(%p)->(IID_IViewObject2 %p)\n", This, ppv);
95 *ppv = VIEWOBJ2(This);
96 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
97 TRACE("(%p)->(IID_IOleInPlaceActiveObject %p)\n", This, ppv);
98 *ppv = ACTIVEOBJ(This);
99 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
100 TRACE("(%p)->(IID_IOleCommandTarget %p)\n", This, ppv);
101 *ppv = OLECMD(This);
102 }else if(IsEqualGUID(&IID_IHlinkFrame, riid)) {
103 TRACE("(%p)->(IID_IHlinkFrame %p)\n", This, ppv);
104 *ppv = HLINKFRAME(This);
105 }else if(IsEqualGUID(&IID_IQuickActivate, riid)) {
106 TRACE("(%p)->(IID_IQuickActivate %p) returning NULL\n", This, ppv);
107 return E_NOINTERFACE;
108 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
109 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
110 return E_NOINTERFACE;
111 }else if(IsEqualGUID(&IID_IPerPropertyBrowsing, riid)) {
112 TRACE("(%p)->(IID_IPerPropertyBrowsing %p) returning NULL\n", This, ppv);
113 return E_NOINTERFACE;
114 }else if(IsEqualGUID(&IID_IOleCache, riid)) {
115 TRACE("(%p)->(IID_IOleCache %p) returning NULL\n", This, ppv);
116 return E_NOINTERFACE;
117 }else if(IsEqualGUID(&IID_IOleInPlaceSite, riid)) {
118 TRACE("(%p)->(IID_IOleInPlaceSite %p) returning NULL\n", This, ppv);
119 return E_NOINTERFACE;
120 }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
121 TRACE("(%p)->(IID_IObjectWithSite %p) returning NULL\n", This, ppv);
122 return E_NOINTERFACE;
125 if(*ppv) {
126 IUnknown_AddRef((IUnknown*)*ppv);
127 return S_OK;
130 FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
131 return E_NOINTERFACE;
134 static ULONG WINAPI WebBrowser_AddRef(IWebBrowser2 *iface)
136 WebBrowser *This = WEBBROWSER_THIS(iface);
137 LONG ref = InterlockedIncrement(&This->ref);
138 TRACE("(%p) ref=%d\n", This, ref);
139 return ref;
142 static ULONG WINAPI WebBrowser_Release(IWebBrowser2 *iface)
144 WebBrowser *This = WEBBROWSER_THIS(iface);
145 LONG ref = InterlockedDecrement(&This->ref);
147 TRACE("(%p) ref=%d\n", This, ref);
149 if(!ref) {
150 if(This->doc_host.document)
151 IUnknown_Release(This->doc_host.document);
153 DocHost_Release(&This->doc_host);
155 WebBrowser_OleObject_Destroy(This);
157 heap_free(This);
158 SHDOCVW_UnlockModule();
161 return ref;
164 /* IDispatch methods */
165 static HRESULT WINAPI WebBrowser_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
167 WebBrowser *This = WEBBROWSER_THIS(iface);
168 FIXME("(%p)->(%p)\n", This, pctinfo);
169 return E_NOTIMPL;
172 static HRESULT WINAPI WebBrowser_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
173 LPTYPEINFO *ppTInfo)
175 WebBrowser *This = WEBBROWSER_THIS(iface);
176 FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
177 return E_NOTIMPL;
180 static HRESULT WINAPI WebBrowser_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
181 LPOLESTR *rgszNames, UINT cNames,
182 LCID lcid, DISPID *rgDispId)
184 WebBrowser *This = WEBBROWSER_THIS(iface);
185 FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
186 lcid, rgDispId);
187 return E_NOTIMPL;
190 static HRESULT WINAPI WebBrowser_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
191 REFIID riid, LCID lcid, WORD wFlags,
192 DISPPARAMS *pDispParams, VARIANT *pVarResult,
193 EXCEPINFO *pExepInfo, UINT *puArgErr)
195 WebBrowser *This = WEBBROWSER_THIS(iface);
196 ITypeInfo *typeinfo;
197 HRESULT hres;
199 TRACE("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
200 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
202 hres = get_typeinfo(&typeinfo);
203 if(FAILED(hres))
204 return hres;
206 return ITypeInfo_Invoke(typeinfo, WEBBROWSER2(This), dispIdMember, wFlags, pDispParams,
207 pVarResult, pExepInfo, puArgErr);
210 /* IWebBrowser methods */
211 static HRESULT WINAPI WebBrowser_GoBack(IWebBrowser2 *iface)
213 WebBrowser *This = WEBBROWSER_THIS(iface);
214 FIXME("(%p)\n", This);
215 return E_NOTIMPL;
218 static HRESULT WINAPI WebBrowser_GoForward(IWebBrowser2 *iface)
220 WebBrowser *This = WEBBROWSER_THIS(iface);
221 FIXME("(%p)\n", This);
222 return E_NOTIMPL;
225 static HRESULT WINAPI WebBrowser_GoHome(IWebBrowser2 *iface)
227 WebBrowser *This = WEBBROWSER_THIS(iface);
228 TRACE("(%p)\n", This);
229 return go_home(&This->doc_host);
232 static HRESULT WINAPI WebBrowser_GoSearch(IWebBrowser2 *iface)
234 WebBrowser *This = WEBBROWSER_THIS(iface);
235 FIXME("(%p)\n", This);
236 return E_NOTIMPL;
239 static HRESULT WINAPI WebBrowser_Navigate(IWebBrowser2 *iface, BSTR szUrl,
240 VARIANT *Flags, VARIANT *TargetFrameName,
241 VARIANT *PostData, VARIANT *Headers)
243 WebBrowser *This = WEBBROWSER_THIS(iface);
245 TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
246 PostData, Headers);
248 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
251 static HRESULT WINAPI WebBrowser_Refresh(IWebBrowser2 *iface)
253 WebBrowser *This = WEBBROWSER_THIS(iface);
254 FIXME("(%p)\n", This);
255 return E_NOTIMPL;
258 static HRESULT WINAPI WebBrowser_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
260 WebBrowser *This = WEBBROWSER_THIS(iface);
261 FIXME("(%p)->(%p)\n", This, Level);
262 return E_NOTIMPL;
265 static HRESULT WINAPI WebBrowser_Stop(IWebBrowser2 *iface)
267 WebBrowser *This = WEBBROWSER_THIS(iface);
268 FIXME("(%p)\n", This);
269 return E_NOTIMPL;
272 static HRESULT WINAPI WebBrowser_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
274 WebBrowser *This = WEBBROWSER_THIS(iface);
276 TRACE("(%p)->(%p)\n", This, ppDisp);
278 if(!ppDisp)
279 return E_POINTER;
281 *ppDisp = (IDispatch*)WEBBROWSER2(This);
282 IDispatch_AddRef(*ppDisp);
283 return S_OK;
286 static HRESULT WINAPI WebBrowser_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
288 WebBrowser *This = WEBBROWSER_THIS(iface);
289 FIXME("(%p)->(%p)\n", This, ppDisp);
290 return E_NOTIMPL;
293 static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
295 WebBrowser *This = WEBBROWSER_THIS(iface);
296 FIXME("(%p)->(%p)\n", This, ppDisp);
297 return E_NOTIMPL;
300 static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
302 WebBrowser *This = WEBBROWSER_THIS(iface);
304 TRACE("(%p)->(%p)\n", This, ppDisp);
306 *ppDisp = NULL;
307 if(This->doc_host.document)
308 IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
310 return S_OK;
313 static HRESULT WINAPI WebBrowser_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
315 WebBrowser *This = WEBBROWSER_THIS(iface);
316 FIXME("(%p)->(%p)\n", This, pBool);
317 return E_NOTIMPL;
320 static HRESULT WINAPI WebBrowser_get_Type(IWebBrowser2 *iface, BSTR *Type)
322 WebBrowser *This = WEBBROWSER_THIS(iface);
323 FIXME("(%p)->(%p)\n", This, Type);
324 return E_NOTIMPL;
327 static HRESULT WINAPI WebBrowser_get_Left(IWebBrowser2 *iface, long *pl)
329 WebBrowser *This = WEBBROWSER_THIS(iface);
331 TRACE("(%p)->(%p)\n", This, pl);
333 *pl = This->pos_rect.left;
334 return S_OK;
337 static HRESULT WINAPI WebBrowser_put_Left(IWebBrowser2 *iface, long Left)
339 WebBrowser *This = WEBBROWSER_THIS(iface);
340 RECT rect;
342 TRACE("(%p)->(%ld)\n", This, Left);
344 if(!This->inplace)
345 return E_UNEXPECTED;
347 rect = This->pos_rect;
348 rect.left = Left;
350 /* We don't really change the window position here.
351 * We just notify the embedder that he should do so. */
352 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
355 static HRESULT WINAPI WebBrowser_get_Top(IWebBrowser2 *iface, long *pl)
357 WebBrowser *This = WEBBROWSER_THIS(iface);
359 TRACE("(%p)->(%p)\n", This, pl);
361 *pl = This->pos_rect.top;
362 return S_OK;
365 static HRESULT WINAPI WebBrowser_put_Top(IWebBrowser2 *iface, long Top)
367 WebBrowser *This = WEBBROWSER_THIS(iface);
368 RECT rect;
370 TRACE("(%p)->(%ld)\n", This, Top);
372 if(!This->inplace)
373 return E_UNEXPECTED;
375 rect = This->pos_rect;
376 rect.top = Top;
378 /* We don't really change the window position here.
379 * We just notify the embedder that he should do so. */
380 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
383 static HRESULT WINAPI WebBrowser_get_Width(IWebBrowser2 *iface, long *pl)
385 WebBrowser *This = WEBBROWSER_THIS(iface);
387 TRACE("(%p)->(%p)\n", This, pl);
389 *pl = This->pos_rect.right - This->pos_rect.left;
390 return S_OK;
393 static HRESULT WINAPI WebBrowser_put_Width(IWebBrowser2 *iface, long Width)
395 WebBrowser *This = WEBBROWSER_THIS(iface);
396 RECT rect;
398 TRACE("(%p)->(%ld)\n", This, Width);
400 if(!This->inplace)
401 return E_UNEXPECTED;
403 rect = This->pos_rect;
404 rect.right = rect.left+Width;
406 /* We don't really change the window size here.
407 * We just notify the embedder that he should do so. */
408 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
411 static HRESULT WINAPI WebBrowser_get_Height(IWebBrowser2 *iface, long *pl)
413 WebBrowser *This = WEBBROWSER_THIS(iface);
415 TRACE("(%p)->(%p)\n", This, pl);
417 *pl = This->pos_rect.bottom - This->pos_rect.top;
418 return S_OK;
421 static HRESULT WINAPI WebBrowser_put_Height(IWebBrowser2 *iface, long Height)
423 WebBrowser *This = WEBBROWSER_THIS(iface);
424 RECT rect;
426 TRACE("(%p)->(%ld)\n", This, Height);
428 if(!This->inplace)
429 return E_UNEXPECTED;
431 rect = This->pos_rect;
432 rect.bottom = rect.top+Height;
434 /* We don't really change the window size here.
435 * We just notify the embedder that he should do so. */
436 return IOleInPlaceSite_OnPosRectChange(This->inplace, &rect);
439 static HRESULT WINAPI WebBrowser_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
441 WebBrowser *This = WEBBROWSER_THIS(iface);
442 FIXME("(%p)->(%p)\n", This, LocationName);
443 return E_NOTIMPL;
446 static HRESULT WINAPI WebBrowser_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
448 WebBrowser *This = WEBBROWSER_THIS(iface);
450 FIXME("(%p)->(%p)\n", This, LocationURL);
452 if(!This->doc_host.url) {
453 static const WCHAR null_char = 0;
454 *LocationURL = SysAllocString(&null_char);
455 return S_FALSE;
458 *LocationURL = SysAllocString(This->doc_host.url);
459 return S_OK;
462 static HRESULT WINAPI WebBrowser_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
464 WebBrowser *This = WEBBROWSER_THIS(iface);
466 TRACE("(%p)->(%p)\n", This, pBool);
468 *pBool = This->doc_host.busy;
469 return S_OK;
472 static HRESULT WINAPI WebBrowser_Quit(IWebBrowser2 *iface)
474 WebBrowser *This = WEBBROWSER_THIS(iface);
476 TRACE("(%p)\n", This);
478 /* It's a InternetExplorer specific method, we have nothing to do here. */
479 return E_FAIL;
482 static HRESULT WINAPI WebBrowser_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
484 WebBrowser *This = WEBBROWSER_THIS(iface);
485 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
486 return E_NOTIMPL;
489 static HRESULT WINAPI WebBrowser_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
491 WebBrowser *This = WEBBROWSER_THIS(iface);
492 FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
493 return E_NOTIMPL;
496 static HRESULT WINAPI WebBrowser_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
498 WebBrowser *This = WEBBROWSER_THIS(iface);
499 FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
500 return E_NOTIMPL;
503 static HRESULT WINAPI WebBrowser_get_Name(IWebBrowser2 *iface, BSTR *Name)
505 WebBrowser *This = WEBBROWSER_THIS(iface);
506 FIXME("(%p)->(%p)\n", This, Name);
507 return E_NOTIMPL;
510 static HRESULT WINAPI WebBrowser_get_HWND(IWebBrowser2 *iface, long *pHWND)
512 WebBrowser *This = WEBBROWSER_THIS(iface);
514 TRACE("(%p)->(%p)\n", This, pHWND);
516 /* WebBrowser control never has a frame window (in opposition to InternetExplorer) */
517 *pHWND = 0;
518 return E_FAIL;
521 static HRESULT WINAPI WebBrowser_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
523 WebBrowser *This = WEBBROWSER_THIS(iface);
524 FIXME("(%p)->(%p)\n", This, FullName);
525 return E_NOTIMPL;
528 static HRESULT WINAPI WebBrowser_get_Path(IWebBrowser2 *iface, BSTR *Path)
530 WebBrowser *This = WEBBROWSER_THIS(iface);
531 FIXME("(%p)->(%p)\n", This, Path);
532 return E_NOTIMPL;
535 static HRESULT WINAPI WebBrowser_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
537 WebBrowser *This = WEBBROWSER_THIS(iface);
539 TRACE("(%p)->(%p)\n", This, pBool);
541 *pBool = This->visible;
542 return S_OK;
545 static HRESULT WINAPI WebBrowser_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
547 WebBrowser *This = WEBBROWSER_THIS(iface);
548 VARIANTARG arg;
549 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
551 TRACE("(%p)->(%x)\n", This, Value);
553 This->visible = Value;
555 V_VT(&arg) = VT_BOOL;
556 V_BOOL(&arg) = Value;
557 call_sink(This->doc_host.cps.wbe2, DISPID_ONVISIBLE, &dispparams);
559 return S_OK;
562 static HRESULT WINAPI WebBrowser_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
564 WebBrowser *This = WEBBROWSER_THIS(iface);
566 TRACE("(%p)->(%p)\n", This, pBool);
568 *pBool = This->status_bar;
569 return S_OK;
572 static HRESULT WINAPI WebBrowser_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
574 WebBrowser *This = WEBBROWSER_THIS(iface);
575 VARIANTARG arg;
576 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
578 TRACE("(%p)->(%x)\n", This, Value);
580 This->status_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
582 /* In opposition to InternetExplorer, all we should do here is
583 * inform the embedder about the status bar change. */
585 V_VT(&arg) = VT_BOOL;
586 V_BOOL(&arg) = Value;
587 call_sink(This->doc_host.cps.wbe2, DISPID_ONSTATUSBAR, &dispparams);
589 return S_OK;
592 static HRESULT WINAPI WebBrowser_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
594 WebBrowser *This = WEBBROWSER_THIS(iface);
595 FIXME("(%p)->(%p)\n", This, StatusText);
596 return E_NOTIMPL;
599 static HRESULT WINAPI WebBrowser_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
601 WebBrowser *This = WEBBROWSER_THIS(iface);
602 FIXME("(%p)->(%s)\n", This, debugstr_w(StatusText));
603 return E_NOTIMPL;
606 static HRESULT WINAPI WebBrowser_get_ToolBar(IWebBrowser2 *iface, int *Value)
608 WebBrowser *This = WEBBROWSER_THIS(iface);
610 TRACE("(%p)->(%p)\n", This, Value);
612 *Value = This->tool_bar;
613 return S_OK;
616 static HRESULT WINAPI WebBrowser_put_ToolBar(IWebBrowser2 *iface, int Value)
618 WebBrowser *This = WEBBROWSER_THIS(iface);
619 VARIANTARG arg;
620 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
622 TRACE("(%p)->(%x)\n", This, Value);
624 This->tool_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
626 /* In opposition to InternetExplorer, all we should do here is
627 * inform the embedder about the tool bar change. */
629 V_VT(&arg) = VT_BOOL;
630 V_BOOL(&arg) = Value;
631 call_sink(This->doc_host.cps.wbe2, DISPID_ONTOOLBAR, &dispparams);
633 return S_OK;
636 static HRESULT WINAPI WebBrowser_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
638 WebBrowser *This = WEBBROWSER_THIS(iface);
640 TRACE("(%p)->(%p)\n", This, Value);
642 *Value = This->menu_bar;
643 return S_OK;
646 static HRESULT WINAPI WebBrowser_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
648 WebBrowser *This = WEBBROWSER_THIS(iface);
649 VARIANTARG arg;
650 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
652 TRACE("(%p)->(%x)\n", This, Value);
654 This->menu_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
656 /* In opposition to InternetExplorer, all we should do here is
657 * inform the embedder about the menu bar change. */
659 V_VT(&arg) = VT_BOOL;
660 V_BOOL(&arg) = Value;
661 call_sink(This->doc_host.cps.wbe2, DISPID_ONMENUBAR, &dispparams);
663 return S_OK;
666 static HRESULT WINAPI WebBrowser_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
668 WebBrowser *This = WEBBROWSER_THIS(iface);
670 TRACE("(%p)->(%p)\n", This, pbFullScreen);
672 *pbFullScreen = This->full_screen;
673 return S_OK;
676 static HRESULT WINAPI WebBrowser_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
678 WebBrowser *This = WEBBROWSER_THIS(iface);
679 VARIANTARG arg;
680 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
682 /* In opposition to InternetExplorer, all we should do here is
683 * inform the embedder about the fullscreen change. */
685 TRACE("(%p)->(%x)\n", This, bFullScreen);
687 This->full_screen = bFullScreen ? VARIANT_TRUE : VARIANT_FALSE;
689 V_VT(&arg) = VT_BOOL;
690 V_BOOL(&arg) = bFullScreen;
691 call_sink(This->doc_host.cps.wbe2, DISPID_ONFULLSCREEN, &dispparams);
693 return S_OK;
696 static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
697 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
699 WebBrowser *This = WEBBROWSER_THIS(iface);
701 TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
703 if(!This->client)
704 return E_FAIL;
706 if(!URL)
707 return S_OK;
709 if(V_VT(URL) != VT_BSTR) {
710 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
711 return E_INVALIDARG;
714 return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
717 static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
719 WebBrowser *This = WEBBROWSER_THIS(iface);
720 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
721 return E_NOTIMPL;
724 static HRESULT WINAPI WebBrowser_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
725 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
727 WebBrowser *This = WEBBROWSER_THIS(iface);
728 FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
729 return E_NOTIMPL;
732 static HRESULT WINAPI WebBrowser_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
733 VARIANT *pvarShow, VARIANT *pvarSize)
735 WebBrowser *This = WEBBROWSER_THIS(iface);
736 FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
737 return E_NOTIMPL;
740 static HRESULT WINAPI WebBrowser_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
742 WebBrowser *This = WEBBROWSER_THIS(iface);
743 FIXME("(%p)->(%p)\n", This, lpReadyState);
745 *lpReadyState = READYSTATE_COMPLETE;
746 return S_OK;
749 static HRESULT WINAPI WebBrowser_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
751 WebBrowser *This = WEBBROWSER_THIS(iface);
753 TRACE("(%p)->(%p)\n", This, pbOffline);
755 *pbOffline = This->doc_host.offline;
756 return S_OK;
759 static HRESULT WINAPI WebBrowser_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
761 WebBrowser *This = WEBBROWSER_THIS(iface);
763 TRACE("(%p)->(%x)\n", This, bOffline);
765 This->doc_host.offline = bOffline ? VARIANT_TRUE : VARIANT_FALSE;
766 return S_OK;
769 static HRESULT WINAPI WebBrowser_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
771 WebBrowser *This = WEBBROWSER_THIS(iface);
773 TRACE("(%p)->(%p)\n", This, pbSilent);
775 *pbSilent = This->doc_host.silent;
776 return S_OK;
779 static HRESULT WINAPI WebBrowser_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
781 WebBrowser *This = WEBBROWSER_THIS(iface);
783 TRACE("(%p)->(%x)\n", This, bSilent);
785 This->doc_host.silent = bSilent ? VARIANT_TRUE : VARIANT_FALSE;
786 return S_OK;
789 static HRESULT WINAPI WebBrowser_get_RegisterAsBrowser(IWebBrowser2 *iface,
790 VARIANT_BOOL *pbRegister)
792 WebBrowser *This = WEBBROWSER_THIS(iface);
793 FIXME("(%p)->(%p)\n", This, pbRegister);
794 return E_NOTIMPL;
797 static HRESULT WINAPI WebBrowser_put_RegisterAsBrowser(IWebBrowser2 *iface,
798 VARIANT_BOOL bRegister)
800 WebBrowser *This = WEBBROWSER_THIS(iface);
801 FIXME("(%p)->(%x)\n", This, bRegister);
802 return E_NOTIMPL;
805 static HRESULT WINAPI WebBrowser_get_RegisterAsDropTarget(IWebBrowser2 *iface,
806 VARIANT_BOOL *pbRegister)
808 WebBrowser *This = WEBBROWSER_THIS(iface);
809 FIXME("(%p)->(%p)\n", This, pbRegister);
810 *pbRegister=0;
811 return S_OK;
814 static HRESULT WINAPI WebBrowser_put_RegisterAsDropTarget(IWebBrowser2 *iface,
815 VARIANT_BOOL bRegister)
817 WebBrowser *This = WEBBROWSER_THIS(iface);
818 FIXME("(%p)->(%x)\n", This, bRegister);
819 return S_OK;
822 static HRESULT WINAPI WebBrowser_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
824 WebBrowser *This = WEBBROWSER_THIS(iface);
826 TRACE("(%p)->(%p)\n", This, pbRegister);
828 *pbRegister = This->theater_mode;
829 return S_OK;
832 static HRESULT WINAPI WebBrowser_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
834 WebBrowser *This = WEBBROWSER_THIS(iface);
835 VARIANTARG arg;
836 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
838 TRACE("(%p)->(%x)\n", This, bRegister);
840 This->theater_mode = bRegister ? VARIANT_TRUE : VARIANT_FALSE;
842 /* In opposition to InternetExplorer, all we should do here is
843 * inform the embedder about the theater mode change. */
845 V_VT(&arg) = VT_BOOL;
846 V_BOOL(&arg) = bRegister;
847 call_sink(This->doc_host.cps.wbe2, DISPID_ONTHEATERMODE, &dispparams);
849 return S_OK;
852 static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
854 WebBrowser *This = WEBBROWSER_THIS(iface);
856 TRACE("(%p)->(%p)\n", This, Value);
858 *Value = This->address_bar;
859 return S_OK;
862 static HRESULT WINAPI WebBrowser_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
864 WebBrowser *This = WEBBROWSER_THIS(iface);
865 VARIANTARG arg;
866 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
868 TRACE("(%p)->(%x)\n", This, Value);
870 This->address_bar = Value ? VARIANT_TRUE : VARIANT_FALSE;
872 /* In opposition to InternetExplorer, all we should do here is
873 * inform the embedder about the address bar change. */
875 V_VT(&arg) = VT_BOOL;
876 V_BOOL(&arg) = Value;
877 call_sink(This->doc_host.cps.wbe2, DISPID_ONADDRESSBAR, &dispparams);
879 return S_OK;
882 static HRESULT WINAPI WebBrowser_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
884 WebBrowser *This = WEBBROWSER_THIS(iface);
886 TRACE("(%p)->(%p)\n", This, Value);
888 /* It's InternetExplorer object's method. We have nothing to do here. */
889 return E_NOTIMPL;
892 static HRESULT WINAPI WebBrowser_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
894 WebBrowser *This = WEBBROWSER_THIS(iface);
895 VARIANTARG arg;
896 DISPPARAMS dispparams = {&arg, NULL, 1, 0};
898 TRACE("(%p)->(%x)\n", This, Value);
900 /* In opposition to InternetExplorer, all we should do here is
901 * inform the embedder about the resizable change. */
903 V_VT(&arg) = VT_BOOL;
904 V_BOOL(&arg) = Value;
905 call_sink(This->doc_host.cps.wbe2, DISPID_WINDOWSETRESIZABLE, &dispparams);
907 return S_OK;
910 #undef WEBBROWSER_THIS
912 static const IWebBrowser2Vtbl WebBrowser2Vtbl =
914 WebBrowser_QueryInterface,
915 WebBrowser_AddRef,
916 WebBrowser_Release,
917 WebBrowser_GetTypeInfoCount,
918 WebBrowser_GetTypeInfo,
919 WebBrowser_GetIDsOfNames,
920 WebBrowser_Invoke,
921 WebBrowser_GoBack,
922 WebBrowser_GoForward,
923 WebBrowser_GoHome,
924 WebBrowser_GoSearch,
925 WebBrowser_Navigate,
926 WebBrowser_Refresh,
927 WebBrowser_Refresh2,
928 WebBrowser_Stop,
929 WebBrowser_get_Application,
930 WebBrowser_get_Parent,
931 WebBrowser_get_Container,
932 WebBrowser_get_Document,
933 WebBrowser_get_TopLevelContainer,
934 WebBrowser_get_Type,
935 WebBrowser_get_Left,
936 WebBrowser_put_Left,
937 WebBrowser_get_Top,
938 WebBrowser_put_Top,
939 WebBrowser_get_Width,
940 WebBrowser_put_Width,
941 WebBrowser_get_Height,
942 WebBrowser_put_Height,
943 WebBrowser_get_LocationName,
944 WebBrowser_get_LocationURL,
945 WebBrowser_get_Busy,
946 WebBrowser_Quit,
947 WebBrowser_ClientToWindow,
948 WebBrowser_PutProperty,
949 WebBrowser_GetProperty,
950 WebBrowser_get_Name,
951 WebBrowser_get_HWND,
952 WebBrowser_get_FullName,
953 WebBrowser_get_Path,
954 WebBrowser_get_Visible,
955 WebBrowser_put_Visible,
956 WebBrowser_get_StatusBar,
957 WebBrowser_put_StatusBar,
958 WebBrowser_get_StatusText,
959 WebBrowser_put_StatusText,
960 WebBrowser_get_ToolBar,
961 WebBrowser_put_ToolBar,
962 WebBrowser_get_MenuBar,
963 WebBrowser_put_MenuBar,
964 WebBrowser_get_FullScreen,
965 WebBrowser_put_FullScreen,
966 WebBrowser_Navigate2,
967 WebBrowser_QueryStatusWB,
968 WebBrowser_ExecWB,
969 WebBrowser_ShowBrowserBar,
970 WebBrowser_get_ReadyState,
971 WebBrowser_get_Offline,
972 WebBrowser_put_Offline,
973 WebBrowser_get_Silent,
974 WebBrowser_put_Silent,
975 WebBrowser_get_RegisterAsBrowser,
976 WebBrowser_put_RegisterAsBrowser,
977 WebBrowser_get_RegisterAsDropTarget,
978 WebBrowser_put_RegisterAsDropTarget,
979 WebBrowser_get_TheaterMode,
980 WebBrowser_put_TheaterMode,
981 WebBrowser_get_AddressBar,
982 WebBrowser_put_AddressBar,
983 WebBrowser_get_Resizable,
984 WebBrowser_put_Resizable
987 static HRESULT WebBrowser_Create(INT version, IUnknown *pOuter, REFIID riid, void **ppv)
989 WebBrowser *ret;
990 HRESULT hres;
992 TRACE("(%p %s %p) version=%d\n", pOuter, debugstr_guid(riid), ppv, version);
994 ret = heap_alloc(sizeof(WebBrowser));
996 ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
997 ret->ref = 0;
998 ret->version = version;
1000 DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
1002 ret->visible = VARIANT_TRUE;
1003 ret->menu_bar = VARIANT_TRUE;
1004 ret->address_bar = VARIANT_TRUE;
1005 ret->status_bar = VARIANT_TRUE;
1006 ret->tool_bar = VARIANT_TRUE;
1007 ret->full_screen = VARIANT_FALSE;
1008 ret->theater_mode = VARIANT_FALSE;
1010 WebBrowser_OleObject_Init(ret);
1011 WebBrowser_ViewObject_Init(ret);
1012 WebBrowser_Persist_Init(ret);
1013 WebBrowser_ClassInfo_Init(ret);
1014 WebBrowser_HlinkFrame_Init(ret);
1016 hres = IWebBrowser_QueryInterface(WEBBROWSER(ret), riid, ppv);
1017 if(SUCCEEDED(hres)) {
1018 SHDOCVW_LockModule();
1019 }else {
1020 heap_free(ret);
1021 return hres;
1024 return hres;
1027 HRESULT WebBrowserV1_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1029 return WebBrowser_Create(1, pOuter, riid, ppv);
1032 HRESULT WebBrowserV2_Create(IUnknown *pOuter, REFIID riid, void **ppv)
1034 return WebBrowser_Create(2, pOuter, riid, ppv);