]> git.saurik.com Git - wxWidgets.git/blob - src/msw/webview_ie.cpp
Add helper wxString::IterOffsetInMBStr() method.
[wxWidgets.git] / src / msw / webview_ie.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/webview_ie.cpp
3 // Purpose: wxMSW wxWebViewIE class implementation for web view component
4 // Author: Marianne Gagnon
5 // Id: $Id$
6 // Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #if defined(__BORLANDC__)
14 #pragma hdrstop
15 #endif
16
17 #include "wx/msw/webview_ie.h"
18
19 #if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE
20
21 #include <olectl.h>
22 #include <oleidl.h>
23 #include <exdispid.h>
24 #include <exdisp.h>
25 #include <mshtml.h>
26 #include "wx/msw/registry.h"
27 #include "wx/msw/missing.h"
28 #include "wx/filesys.h"
29 #include "wx/dynlib.h"
30 #include <initguid.h>
31
32 /* These GUID definitions are our own implementation to support interfaces
33 * normally in urlmon.h. See include/wx/msw/webview_ie.h
34 */
35
36 namespace {
37
38 DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
39 DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
40 DEFINE_GUID(wxIID_IDocHostUIHandler, 0xbd3f23c0, 0xd43e, 0x11cf, 0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a);
41
42 }
43
44 wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewIE, wxWebView);
45
46 BEGIN_EVENT_TABLE(wxWebViewIE, wxControl)
47 EVT_ACTIVEX(wxID_ANY, wxWebViewIE::onActiveXEvent)
48 EVT_ERASE_BACKGROUND(wxWebViewIE::onEraseBg)
49 END_EVENT_TABLE()
50
51 bool wxWebViewIE::Create(wxWindow* parent,
52 wxWindowID id,
53 const wxString& url,
54 const wxPoint& pos,
55 const wxSize& size,
56 long style,
57 const wxString& name)
58 {
59 if (!wxControl::Create(parent, id, pos, size, style,
60 wxDefaultValidator, name))
61 {
62 return false;
63 }
64
65 m_webBrowser = NULL;
66 m_isBusy = false;
67 m_historyLoadingFromList = false;
68 m_historyEnabled = true;
69 m_historyPosition = -1;
70 m_zoomType = wxWEB_VIEW_ZOOM_TYPE_TEXT;
71
72 if (::CoCreateInstance(CLSID_WebBrowser, NULL,
73 CLSCTX_INPROC_SERVER, // CLSCTX_INPROC,
74 IID_IWebBrowser2 , (void**)&m_webBrowser) != 0)
75 {
76 wxLogError("Failed to initialize IE, CoCreateInstance returned an error");
77 return false;
78 }
79
80 m_ie.SetDispatchPtr(m_webBrowser); // wxAutomationObject will release itself
81
82 m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
83 m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
84
85 m_uiHandler = new DocHostUIHandler;
86 m_uiHandler->AddRef();
87
88 m_container = new wxIEContainer(this, IID_IWebBrowser2, m_webBrowser, m_uiHandler);
89
90 EnableControlFeature(21 /* FEATURE_DISABLE_NAVIGATION_SOUNDS */);
91
92 LoadURL(url);
93 return true;
94 }
95
96 wxWebViewIE::~wxWebViewIE()
97 {
98 for(unsigned int i = 0; i < m_factories.size(); i++)
99 {
100 m_factories[i]->Release();
101 }
102
103 m_uiHandler->Release();
104 }
105
106 void wxWebViewIE::LoadURL(const wxString& url)
107 {
108 m_ie.CallMethod("Navigate", wxConvertStringToOle(url));
109 }
110
111 void wxWebViewIE::SetPage(const wxString& html, const wxString& baseUrl)
112 {
113 BSTR bstr = SysAllocString(OLESTR(""));
114 SAFEARRAY *psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1);
115 if (psaStrings != NULL)
116 {
117 VARIANT *param;
118 HRESULT hr = SafeArrayAccessData(psaStrings, (LPVOID*)&param);
119 param->vt = VT_BSTR;
120 param->bstrVal = bstr;
121
122 hr = SafeArrayUnaccessData(psaStrings);
123
124 IHTMLDocument2* document = GetDocument();
125 document->write(psaStrings);
126 document->close();
127 document->Release();
128
129 SafeArrayDestroy(psaStrings);
130
131 bstr = SysAllocString(html.wc_str());
132
133 // Creates a new one-dimensional array
134 psaStrings = SafeArrayCreateVector(VT_VARIANT, 0, 1);
135 if (psaStrings != NULL)
136 {
137 hr = SafeArrayAccessData(psaStrings, (LPVOID*)&param);
138 param->vt = VT_BSTR;
139 param->bstrVal = bstr;
140 hr = SafeArrayUnaccessData(psaStrings);
141
142 document = GetDocument();
143 document->write(psaStrings);
144 document->Release();
145
146 // SafeArrayDestroy calls SysFreeString for each BSTR
147 SafeArrayDestroy(psaStrings);
148
149 //We send the events when we are done to mimic webkit
150 //Navigated event
151 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
152 GetId(), baseUrl, "");
153 event.SetEventObject(this);
154 HandleWindowEvent(event);
155
156 //Document complete event
157 event.SetEventType(wxEVT_COMMAND_WEB_VIEW_LOADED);
158 event.SetEventObject(this);
159 HandleWindowEvent(event);
160 }
161 else
162 {
163 wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL");
164 }
165 }
166 else
167 {
168 wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL during clear");
169 }
170 }
171
172 wxString wxWebViewIE::GetPageSource() const
173 {
174 IHTMLDocument2* document = GetDocument();
175 IHTMLElement *bodyTag = NULL;
176 IHTMLElement *htmlTag = NULL;
177 wxString source;
178 HRESULT hr = document->get_body(&bodyTag);
179 if(SUCCEEDED(hr))
180 {
181 hr = bodyTag->get_parentElement(&htmlTag);
182 if(SUCCEEDED(hr))
183 {
184 BSTR bstr;
185 htmlTag->get_outerHTML(&bstr);
186 source = wxString(bstr);
187 htmlTag->Release();
188 }
189 bodyTag->Release();
190 }
191
192 document->Release();
193 return source;
194 }
195
196 wxWebViewZoom wxWebViewIE::GetZoom() const
197 {
198 switch( m_zoomType )
199 {
200 case wxWEB_VIEW_ZOOM_TYPE_LAYOUT:
201 return GetIEOpticalZoom();
202 case wxWEB_VIEW_ZOOM_TYPE_TEXT:
203 return GetIETextZoom();
204 default:
205 wxFAIL;
206 }
207
208 //Dummy return to stop compiler warnings
209 return wxWEB_VIEW_ZOOM_MEDIUM;
210
211 }
212
213 void wxWebViewIE::SetZoom(wxWebViewZoom zoom)
214 {
215 switch( m_zoomType )
216 {
217 case wxWEB_VIEW_ZOOM_TYPE_LAYOUT:
218 SetIEOpticalZoom(zoom);
219 break;
220 case wxWEB_VIEW_ZOOM_TYPE_TEXT:
221 SetIETextZoom(zoom);
222 break;
223 default:
224 wxFAIL;
225 }
226 }
227
228 void wxWebViewIE::SetIETextZoom(wxWebViewZoom level)
229 {
230 //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
231 //is 0 to 4 so the check is unnecessary, these match exactly with the
232 //enum values
233 VARIANT zoomVariant;
234 VariantInit (&zoomVariant);
235 V_VT(&zoomVariant) = VT_I4;
236 V_I4(&zoomVariant) = level;
237
238 #if wxDEBUG_LEVEL
239 HRESULT result =
240 #endif
241 m_webBrowser->ExecWB(OLECMDID_ZOOM,
242 OLECMDEXECOPT_DONTPROMPTUSER,
243 &zoomVariant, NULL);
244 wxASSERT(result == S_OK);
245 }
246
247 wxWebViewZoom wxWebViewIE::GetIETextZoom() const
248 {
249 VARIANT zoomVariant;
250 VariantInit (&zoomVariant);
251 V_VT(&zoomVariant) = VT_I4;
252
253 #if wxDEBUG_LEVEL
254 HRESULT result =
255 #endif
256 m_webBrowser->ExecWB(OLECMDID_ZOOM,
257 OLECMDEXECOPT_DONTPROMPTUSER,
258 NULL, &zoomVariant);
259 wxASSERT(result == S_OK);
260
261 //We can safely cast here as we know that the range matches our enum
262 return static_cast<wxWebViewZoom>(V_I4(&zoomVariant));
263 }
264
265 void wxWebViewIE::SetIEOpticalZoom(wxWebViewZoom level)
266 {
267 //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
268 //is 10 to 1000 so the check is unnecessary
269 VARIANT zoomVariant;
270 VariantInit (&zoomVariant);
271 V_VT(&zoomVariant) = VT_I4;
272
273 //We make a somewhat arbitray map here, taken from values used by webkit
274 switch(level)
275 {
276 case wxWEB_VIEW_ZOOM_TINY:
277 V_I4(&zoomVariant) = 60;
278 break;
279 case wxWEB_VIEW_ZOOM_SMALL:
280 V_I4(&zoomVariant) = 80;
281 break;
282 case wxWEB_VIEW_ZOOM_MEDIUM:
283 V_I4(&zoomVariant) = 100;
284 break;
285 case wxWEB_VIEW_ZOOM_LARGE:
286 V_I4(&zoomVariant) = 130;
287 break;
288 case wxWEB_VIEW_ZOOM_LARGEST:
289 V_I4(&zoomVariant) = 160;
290 break;
291 default:
292 wxFAIL;
293 }
294
295 #if wxDEBUG_LEVEL
296 HRESULT result =
297 #endif
298 m_webBrowser->ExecWB((OLECMDID)63 /*OLECMDID_OPTICAL_ZOOM*/,
299 OLECMDEXECOPT_DODEFAULT,
300 &zoomVariant,
301 NULL);
302 wxASSERT(result == S_OK);
303 }
304
305 wxWebViewZoom wxWebViewIE::GetIEOpticalZoom() const
306 {
307 VARIANT zoomVariant;
308 VariantInit (&zoomVariant);
309 V_VT(&zoomVariant) = VT_I4;
310
311 #if wxDEBUG_LEVEL
312 HRESULT result =
313 #endif
314 m_webBrowser->ExecWB((OLECMDID)63 /*OLECMDID_OPTICAL_ZOOM*/,
315 OLECMDEXECOPT_DODEFAULT, NULL,
316 &zoomVariant);
317 wxASSERT(result == S_OK);
318
319 const int zoom = V_I4(&zoomVariant);
320
321 //We make a somewhat arbitray map here, taken from values used by webkit
322 if (zoom <= 65)
323 {
324 return wxWEB_VIEW_ZOOM_TINY;
325 }
326 else if (zoom > 65 && zoom <= 90)
327 {
328 return wxWEB_VIEW_ZOOM_SMALL;
329 }
330 else if (zoom > 90 && zoom <= 115)
331 {
332 return wxWEB_VIEW_ZOOM_MEDIUM;
333 }
334 else if (zoom > 115 && zoom <= 145)
335 {
336 return wxWEB_VIEW_ZOOM_LARGE;
337 }
338 else /*if (zoom > 145) */ //Using else removes a compiler warning
339 {
340 return wxWEB_VIEW_ZOOM_LARGEST;
341 }
342 }
343
344 void wxWebViewIE::SetZoomType(wxWebViewZoomType type)
345 {
346 m_zoomType = type;
347 }
348
349 wxWebViewZoomType wxWebViewIE::GetZoomType() const
350 {
351 return m_zoomType;
352 }
353
354 bool wxWebViewIE::CanSetZoomType(wxWebViewZoomType type) const
355 {
356 //IE 6 and below only support text zoom, so check the registry to see what
357 //version we actually have
358 wxRegKey key(wxRegKey::HKLM, "Software\\Microsoft\\Internet Explorer");
359 wxString value;
360 key.QueryValue("Version", value);
361
362 long version = wxAtoi(value.Left(1));
363 if(version <= 6 && type == wxWEB_VIEW_ZOOM_TYPE_LAYOUT)
364 return false;
365 else
366 return true;
367 }
368
369 void wxWebViewIE::Print()
370 {
371 m_webBrowser->ExecWB(OLECMDID_PRINTPREVIEW,
372 OLECMDEXECOPT_DODEFAULT, NULL, NULL);
373 }
374
375 bool wxWebViewIE::CanGoBack() const
376 {
377 if(m_historyEnabled)
378 return m_historyPosition > 0;
379 else
380 return false;
381 }
382
383 bool wxWebViewIE::CanGoForward() const
384 {
385 if(m_historyEnabled)
386 return m_historyPosition != static_cast<int>(m_historyList.size()) - 1;
387 else
388 return false;
389 }
390
391 void wxWebViewIE::LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item)
392 {
393 int pos = -1;
394 for(unsigned int i = 0; i < m_historyList.size(); i++)
395 {
396 //We compare the actual pointers to find the correct item
397 if(m_historyList[i].get() == item.get())
398 pos = i;
399 }
400 wxASSERT_MSG(pos != static_cast<int>(m_historyList.size()),
401 "invalid history item");
402 m_historyLoadingFromList = true;
403 LoadURL(item->GetUrl());
404 m_historyPosition = pos;
405 }
406
407 wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewIE::GetBackwardHistory()
408 {
409 wxVector<wxSharedPtr<wxWebViewHistoryItem> > backhist;
410 //As we don't have std::copy or an iterator constructor in the wxwidgets
411 //native vector we construct it by hand
412 for(int i = 0; i < m_historyPosition; i++)
413 {
414 backhist.push_back(m_historyList[i]);
415 }
416 return backhist;
417 }
418
419 wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewIE::GetForwardHistory()
420 {
421 wxVector<wxSharedPtr<wxWebViewHistoryItem> > forwardhist;
422 //As we don't have std::copy or an iterator constructor in the wxwidgets
423 //native vector we construct it by hand
424 for(int i = m_historyPosition + 1; i < static_cast<int>(m_historyList.size()); i++)
425 {
426 forwardhist.push_back(m_historyList[i]);
427 }
428 return forwardhist;
429 }
430
431 void wxWebViewIE::GoBack()
432 {
433 LoadHistoryItem(m_historyList[m_historyPosition - 1]);
434 }
435
436 void wxWebViewIE::GoForward()
437 {
438 LoadHistoryItem(m_historyList[m_historyPosition + 1]);
439 }
440
441 void wxWebViewIE::Stop()
442 {
443 m_ie.CallMethod("Stop");
444 }
445
446 void wxWebViewIE::ClearHistory()
447 {
448 m_historyList.clear();
449 m_historyPosition = -1;
450 }
451
452 void wxWebViewIE::EnableHistory(bool enable)
453 {
454 m_historyEnabled = enable;
455 m_historyList.clear();
456 m_historyPosition = -1;
457 }
458
459 void wxWebViewIE::Reload(wxWebViewReloadFlags flags)
460 {
461 VARIANTARG level;
462 VariantInit(&level);
463 V_VT(&level) = VT_I2;
464
465 switch(flags)
466 {
467 case wxWEB_VIEW_RELOAD_DEFAULT:
468 V_I2(&level) = REFRESH_NORMAL;
469 break;
470 case wxWEB_VIEW_RELOAD_NO_CACHE:
471 V_I2(&level) = REFRESH_COMPLETELY;
472 break;
473 default:
474 wxFAIL_MSG("Unexpected reload type");
475 }
476
477 m_webBrowser->Refresh2(&level);
478 }
479
480 bool wxWebViewIE::IsOfflineMode()
481 {
482 wxVariant out = m_ie.GetProperty("Offline");
483
484 wxASSERT(out.GetType() == "bool");
485
486 return out.GetBool();
487 }
488
489 void wxWebViewIE::SetOfflineMode(bool offline)
490 {
491 // FIXME: the wxWidgets docs do not really document what the return
492 // parameter of PutProperty is
493 #if wxDEBUG_LEVEL
494 const bool success =
495 #endif
496 m_ie.PutProperty("Offline", (offline ?
497 VARIANT_TRUE :
498 VARIANT_FALSE));
499 wxASSERT(success);
500 }
501
502 bool wxWebViewIE::IsBusy() const
503 {
504 if (m_isBusy) return true;
505
506 wxVariant out = m_ie.GetProperty("Busy");
507
508 wxASSERT(out.GetType() == "bool");
509
510 return out.GetBool();
511 }
512
513 wxString wxWebViewIE::GetCurrentURL() const
514 {
515 wxVariant out = m_ie.GetProperty("LocationURL");
516
517 wxASSERT(out.GetType() == "string");
518 return out.GetString();
519 }
520
521 wxString wxWebViewIE::GetCurrentTitle() const
522 {
523 IHTMLDocument2* document = GetDocument();
524 BSTR title;
525
526 document->get_nameProp(&title);
527 document->Release();
528 return wxString(title);
529 }
530
531 bool wxWebViewIE::CanCut() const
532 {
533 return CanExecCommand("Cut");
534 }
535
536 bool wxWebViewIE::CanCopy() const
537 {
538 return CanExecCommand("Copy");
539 }
540 bool wxWebViewIE::CanPaste() const
541 {
542 return CanExecCommand("Paste");
543 }
544
545 void wxWebViewIE::Cut()
546 {
547 ExecCommand("Cut");
548 }
549
550 void wxWebViewIE::Copy()
551 {
552 ExecCommand("Copy");
553 }
554
555 void wxWebViewIE::Paste()
556 {
557 ExecCommand("Paste");
558 }
559
560 bool wxWebViewIE::CanUndo() const
561 {
562 return CanExecCommand("Undo");
563 }
564 bool wxWebViewIE::CanRedo() const
565 {
566 return CanExecCommand("Redo");
567 }
568
569 void wxWebViewIE::Undo()
570 {
571 ExecCommand("Undo");
572 }
573
574 void wxWebViewIE::Redo()
575 {
576 ExecCommand("Redo");
577 }
578
579 void wxWebViewIE::SetEditable(bool enable)
580 {
581 IHTMLDocument2* document = GetDocument();
582 if( enable )
583 document->put_designMode(SysAllocString(L"On"));
584 else
585 document->put_designMode(SysAllocString(L"Off"));
586
587 document->Release();
588 }
589
590 bool wxWebViewIE::IsEditable() const
591 {
592 IHTMLDocument2* document = GetDocument();
593 BSTR mode;
594 document->get_designMode(&mode);
595 document->Release();
596 if(wxString(mode) == "On")
597 return true;
598 else
599 return false;
600 }
601
602 void wxWebViewIE::SelectAll()
603 {
604 ExecCommand("SelectAll");
605 }
606
607 bool wxWebViewIE::HasSelection() const
608 {
609 IHTMLDocument2* document = GetDocument();
610 IHTMLSelectionObject* selection;
611 wxString sel;
612 HRESULT hr = document->get_selection(&selection);
613 if(SUCCEEDED(hr))
614 {
615 BSTR type;
616 selection->get_type(&type);
617 sel = wxString(type);
618 selection->Release();
619 }
620 document->Release();
621 return sel != "None";
622 }
623
624 void wxWebViewIE::DeleteSelection()
625 {
626 ExecCommand("Delete");
627 }
628
629 wxString wxWebViewIE::GetSelectedText() const
630 {
631 IHTMLDocument2* document = GetDocument();
632 IHTMLSelectionObject* selection;
633 wxString selected;
634 HRESULT hr = document->get_selection(&selection);
635 if(SUCCEEDED(hr))
636 {
637 IDispatch* disrange;
638 hr = selection->createRange(&disrange);
639 if(SUCCEEDED(hr))
640 {
641 IHTMLTxtRange* range;
642 hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
643 if(SUCCEEDED(hr))
644 {
645 BSTR text;
646 range->get_text(&text);
647 selected = wxString(text);
648 range->Release();
649 }
650 disrange->Release();
651 }
652 selection->Release();
653 }
654 document->Release();
655 return selected;
656 }
657
658 wxString wxWebViewIE::GetSelectedSource() const
659 {
660 IHTMLDocument2* document = GetDocument();
661 IHTMLSelectionObject* selection;
662 wxString selected;
663 HRESULT hr = document->get_selection(&selection);
664 if(SUCCEEDED(hr))
665 {
666 IDispatch* disrange;
667 hr = selection->createRange(&disrange);
668 if(SUCCEEDED(hr))
669 {
670 IHTMLTxtRange* range;
671 hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
672 if(SUCCEEDED(hr))
673 {
674 BSTR text;
675 range->get_htmlText(&text);
676 selected = wxString(text);
677 range->Release();
678 }
679 disrange->Release();
680 }
681 selection->Release();
682 }
683 document->Release();
684 return selected;
685 }
686
687 void wxWebViewIE::ClearSelection()
688 {
689 IHTMLDocument2* document = GetDocument();
690 IHTMLSelectionObject* selection;
691 wxString selected;
692 HRESULT hr = document->get_selection(&selection);
693 if(SUCCEEDED(hr))
694 {
695 selection->empty();
696 selection->Release();
697 }
698 document->Release();
699 }
700
701 wxString wxWebViewIE::GetPageText() const
702 {
703 IHTMLDocument2* document = GetDocument();
704 wxString text;
705 IHTMLElement* body;
706 HRESULT hr = document->get_body(&body);
707 if(SUCCEEDED(hr))
708 {
709 BSTR out;
710 body->get_innerText(&out);
711 text = wxString(out);
712 body->Release();
713 }
714 document->Release();
715 return text;
716 }
717
718 void wxWebViewIE::RunScript(const wxString& javascript)
719 {
720 IHTMLDocument2* document = GetDocument();
721 IHTMLWindow2* window;
722 wxString language = "javascript";
723 HRESULT hr = document->get_parentWindow(&window);
724 if(SUCCEEDED(hr))
725 {
726 VARIANT level;
727 VariantInit(&level);
728 V_VT(&level) = VT_EMPTY;
729 window->execScript(SysAllocString(javascript.wc_str()),
730 SysAllocString(language.wc_str()),
731 &level);
732 }
733 document->Release();
734 }
735
736 void wxWebViewIE::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
737 {
738 wxDynamicLibrary urlMon(wxT("urlmon.dll"));
739 if(urlMon.HasSymbol(wxT("CoInternetGetSession")))
740 {
741 typedef HRESULT (WINAPI *CoInternetGetSession_t)(DWORD, wxIInternetSession**, DWORD);
742 wxDYNLIB_FUNCTION(CoInternetGetSession_t, CoInternetGetSession, urlMon);
743
744 ClassFactory* cf = new ClassFactory(handler);
745 wxIInternetSession* session;
746 HRESULT res = (*pfnCoInternetGetSession)(0, &session, 0);
747 if(FAILED(res))
748 {
749 wxFAIL_MSG("Could not retrive internet session");
750 }
751
752 HRESULT hr = session->RegisterNameSpace(cf, CLSID_FileProtocol,
753 handler->GetName().wc_str(),
754 0, NULL, 0);
755 if(FAILED(hr))
756 {
757 wxFAIL_MSG("Could not register protocol");
758 }
759 m_factories.push_back(cf);
760 }
761 else
762 {
763 wxFAIL_MSG("urlmon does not contain CoInternetGetSession");
764 }
765 }
766
767 bool wxWebViewIE::CanExecCommand(wxString command) const
768 {
769 IHTMLDocument2* document = GetDocument();
770 VARIANT_BOOL enabled;
771
772 document->queryCommandEnabled(SysAllocString(command.wc_str()), &enabled);
773 document->Release();
774
775 return (enabled == VARIANT_TRUE);
776 }
777
778 void wxWebViewIE::ExecCommand(wxString command)
779 {
780 IHTMLDocument2* document = GetDocument();
781 document->execCommand(SysAllocString(command.wc_str()), VARIANT_FALSE, VARIANT(), NULL);
782 document->Release();
783 }
784
785 IHTMLDocument2* wxWebViewIE::GetDocument() const
786 {
787 wxVariant variant = m_ie.GetProperty("Document");
788 IHTMLDocument2* document = (IHTMLDocument2*)variant.GetVoidPtr();
789
790 wxASSERT(document);
791
792 return document;
793 }
794
795 bool wxWebViewIE::EnableControlFeature(long flag, bool enable)
796 {
797 #if wxUSE_DYNLIB_CLASS
798
799 wxDynamicLibrary urlMon(wxT("urlmon.dll"));
800 if( urlMon.IsLoaded() &&
801 urlMon.HasSymbol("CoInternetSetFeatureEnabled") &&
802 urlMon.HasSymbol("CoInternetIsFeatureEnabled"))
803 {
804 typedef HRESULT (WINAPI *CoInternetSetFeatureEnabled_t)(DWORD, DWORD, BOOL);
805 typedef HRESULT (WINAPI *CoInternetIsFeatureEnabled_t)(DWORD, DWORD);
806
807 wxDYNLIB_FUNCTION(CoInternetSetFeatureEnabled_t, CoInternetSetFeatureEnabled, urlMon);
808 wxDYNLIB_FUNCTION(CoInternetIsFeatureEnabled_t, CoInternetIsFeatureEnabled, urlMon);
809
810 HRESULT hr = (*pfnCoInternetIsFeatureEnabled)(flag,
811 0x2 /* SET_FEATURE_ON_PROCESS */);
812 if((hr == S_OK && enable) || (hr == S_FALSE && !enable))
813 return true;
814
815 hr = (*pfnCoInternetSetFeatureEnabled)(flag,
816 0x2/* SET_FEATURE_ON_PROCESS */,
817 (enable ? TRUE : FALSE));
818 if ( FAILED(hr) )
819 {
820 wxLogApiError(wxT("CoInternetSetFeatureEnabled"), hr);
821 return false;
822 }
823 return true;
824 }
825 return false;
826 #else
827 wxUnusedVar(flag);
828 wxUnusedVar(enable);
829 return false;
830 #endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
831 }
832
833 void wxWebViewIE::onActiveXEvent(wxActiveXEvent& evt)
834 {
835 if (m_webBrowser == NULL) return;
836
837 switch (evt.GetDispatchId())
838 {
839 case DISPID_BEFORENAVIGATE2:
840 {
841 m_isBusy = true;
842
843 wxString url = evt[1].GetString();
844 wxString target = evt[3].GetString();
845
846 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING,
847 GetId(), url, target);
848
849 //skip empty javascript events.
850 if(url == "javascript:\"\"" && target.IsEmpty())
851 {
852 event.Veto();
853 }
854 else
855 {
856 event.SetEventObject(this);
857 HandleWindowEvent(event);
858 }
859
860 if (!event.IsAllowed())
861 {
862 wxActiveXEventNativeMSW* nativeParams =
863 evt.GetNativeParameters();
864 *V_BOOLREF(&nativeParams->pDispParams->rgvarg[0]) = VARIANT_TRUE;
865 }
866
867 // at this point, either the navigation event has been cancelled
868 // and we're not busy, either it was accepted and IWebBrowser2's
869 // Busy property will be true; so we don't need our override
870 // flag anymore.
871 m_isBusy = false;
872
873 break;
874 }
875
876 case DISPID_NAVIGATECOMPLETE2:
877 {
878 wxString url = evt[1].GetString();
879 // TODO: set target parameter if possible
880 wxString target = wxEmptyString;
881 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED,
882 GetId(), url, target);
883 event.SetEventObject(this);
884 HandleWindowEvent(event);
885 break;
886 }
887
888 case DISPID_PROGRESSCHANGE:
889 {
890 // download progress
891 break;
892 }
893
894 case DISPID_DOCUMENTCOMPLETE:
895 {
896 //Only send a complete even if we are actually finished, this brings
897 //the event in to line with webkit
898 READYSTATE rs;
899 m_webBrowser->get_ReadyState( &rs );
900 if(rs != READYSTATE_COMPLETE)
901 break;
902
903 wxString url = evt[1].GetString();
904
905 //As we are complete we also add to the history list, but not if the
906 //page is not the main page, ie it is a subframe
907 //We also have to check if we are loading a file:// url, if so we
908 //need to change the comparison as ie passes back a different style
909 //of url
910 if(m_historyEnabled && !m_historyLoadingFromList &&
911 (url == GetCurrentURL() ||
912 (GetCurrentURL().substr(0, 4) == "file" &&
913 wxFileSystem::URLToFileName(GetCurrentURL()).GetFullPath() == url)))
914 {
915 //If we are not at the end of the list, then erase everything
916 //between us and the end before adding the new page
917 if(m_historyPosition != static_cast<int>(m_historyList.size()) - 1)
918 {
919 m_historyList.erase(m_historyList.begin() + m_historyPosition + 1,
920 m_historyList.end());
921 }
922 wxSharedPtr<wxWebViewHistoryItem> item(new wxWebViewHistoryItem(url, GetCurrentTitle()));
923 m_historyList.push_back(item);
924 m_historyPosition++;
925 }
926 //Reset as we are done now
927 m_historyLoadingFromList = false;
928 // TODO: set target parameter if possible
929 wxString target = wxEmptyString;
930 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_LOADED, GetId(),
931 url, target);
932 event.SetEventObject(this);
933 HandleWindowEvent(event);
934 break;
935 }
936
937 case DISPID_STATUSTEXTCHANGE:
938 {
939 break;
940 }
941
942 case DISPID_TITLECHANGE:
943 {
944 wxString title = evt[0].GetString();
945
946 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED,
947 GetId(), GetCurrentURL(), "");
948 event.SetString(title);
949 event.SetEventObject(this);
950 HandleWindowEvent(event);
951 break;
952 }
953
954 case DISPID_NAVIGATEERROR:
955 {
956 wxWebViewNavigationError errorType = wxWEB_NAV_ERR_OTHER;
957 wxString errorCode = "?";
958 switch (evt[3].GetLong())
959 {
960 case INET_E_INVALID_URL: // (0x800C0002L or -2146697214)
961 errorCode = "INET_E_INVALID_URL";
962 errorType = wxWEB_NAV_ERR_REQUEST;
963 break;
964 case INET_E_NO_SESSION: // (0x800C0003L or -2146697213)
965 errorCode = "INET_E_NO_SESSION";
966 errorType = wxWEB_NAV_ERR_CONNECTION;
967 break;
968 case INET_E_CANNOT_CONNECT: // (0x800C0004L or -2146697212)
969 errorCode = "INET_E_CANNOT_CONNECT";
970 errorType = wxWEB_NAV_ERR_CONNECTION;
971 break;
972 case INET_E_RESOURCE_NOT_FOUND: // (0x800C0005L or -2146697211)
973 errorCode = "INET_E_RESOURCE_NOT_FOUND";
974 errorType = wxWEB_NAV_ERR_NOT_FOUND;
975 break;
976 case INET_E_OBJECT_NOT_FOUND: // (0x800C0006L or -2146697210)
977 errorCode = "INET_E_OBJECT_NOT_FOUND";
978 errorType = wxWEB_NAV_ERR_NOT_FOUND;
979 break;
980 case INET_E_DATA_NOT_AVAILABLE: // (0x800C0007L or -2146697209)
981 errorCode = "INET_E_DATA_NOT_AVAILABLE";
982 errorType = wxWEB_NAV_ERR_NOT_FOUND;
983 break;
984 case INET_E_DOWNLOAD_FAILURE: // (0x800C0008L or -2146697208)
985 errorCode = "INET_E_DOWNLOAD_FAILURE";
986 errorType = wxWEB_NAV_ERR_CONNECTION;
987 break;
988 case INET_E_AUTHENTICATION_REQUIRED: // (0x800C0009L or -2146697207)
989 errorCode = "INET_E_AUTHENTICATION_REQUIRED";
990 errorType = wxWEB_NAV_ERR_AUTH;
991 break;
992 case INET_E_NO_VALID_MEDIA: // (0x800C000AL or -2146697206)
993 errorCode = "INET_E_NO_VALID_MEDIA";
994 errorType = wxWEB_NAV_ERR_REQUEST;
995 break;
996 case INET_E_CONNECTION_TIMEOUT: // (0x800C000BL or -2146697205)
997 errorCode = "INET_E_CONNECTION_TIMEOUT";
998 errorType = wxWEB_NAV_ERR_CONNECTION;
999 break;
1000 case INET_E_INVALID_REQUEST: // (0x800C000CL or -2146697204)
1001 errorCode = "INET_E_INVALID_REQUEST";
1002 errorType = wxWEB_NAV_ERR_REQUEST;
1003 break;
1004 case INET_E_UNKNOWN_PROTOCOL: // (0x800C000DL or -2146697203)
1005 errorCode = "INET_E_UNKNOWN_PROTOCOL";
1006 errorType = wxWEB_NAV_ERR_REQUEST;
1007 break;
1008 case INET_E_SECURITY_PROBLEM: // (0x800C000EL or -2146697202)
1009 errorCode = "INET_E_SECURITY_PROBLEM";
1010 errorType = wxWEB_NAV_ERR_SECURITY;
1011 break;
1012 case INET_E_CANNOT_LOAD_DATA: // (0x800C000FL or -2146697201)
1013 errorCode = "INET_E_CANNOT_LOAD_DATA";
1014 errorType = wxWEB_NAV_ERR_OTHER;
1015 break;
1016 case INET_E_CANNOT_INSTANTIATE_OBJECT:
1017 // CoCreateInstance will return an error code if this happens,
1018 // we'll handle this above.
1019 return;
1020 break;
1021 case INET_E_REDIRECT_FAILED: // (0x800C0014L or -2146697196)
1022 errorCode = "INET_E_REDIRECT_FAILED";
1023 errorType = wxWEB_NAV_ERR_OTHER;
1024 break;
1025 case INET_E_REDIRECT_TO_DIR: // (0x800C0015L or -2146697195)
1026 errorCode = "INET_E_REDIRECT_TO_DIR";
1027 errorType = wxWEB_NAV_ERR_REQUEST;
1028 break;
1029 case INET_E_CANNOT_LOCK_REQUEST: // (0x800C0016L or -2146697194)
1030 errorCode = "INET_E_CANNOT_LOCK_REQUEST";
1031 errorType = wxWEB_NAV_ERR_OTHER;
1032 break;
1033 case INET_E_USE_EXTEND_BINDING: // (0x800C0017L or -2146697193)
1034 errorCode = "INET_E_USE_EXTEND_BINDING";
1035 errorType = wxWEB_NAV_ERR_OTHER;
1036 break;
1037 case INET_E_TERMINATED_BIND: // (0x800C0018L or -2146697192)
1038 errorCode = "INET_E_TERMINATED_BIND";
1039 errorType = wxWEB_NAV_ERR_OTHER;
1040 break;
1041 case INET_E_INVALID_CERTIFICATE: // (0x800C0019L or -2146697191)
1042 errorCode = "INET_E_INVALID_CERTIFICATE";
1043 errorType = wxWEB_NAV_ERR_CERTIFICATE;
1044 break;
1045 case INET_E_CODE_DOWNLOAD_DECLINED: // (0x800C0100L or -2146696960)
1046 errorCode = "INET_E_CODE_DOWNLOAD_DECLINED";
1047 errorType = wxWEB_NAV_ERR_USER_CANCELLED;
1048 break;
1049 case INET_E_RESULT_DISPATCHED: // (0x800C0200L or -2146696704)
1050 // cancel request cancelled...
1051 errorCode = "INET_E_RESULT_DISPATCHED";
1052 errorType = wxWEB_NAV_ERR_OTHER;
1053 break;
1054 case INET_E_CANNOT_REPLACE_SFP_FILE: // (0x800C0300L or -2146696448)
1055 errorCode = "INET_E_CANNOT_REPLACE_SFP_FILE";
1056 errorType = wxWEB_NAV_ERR_SECURITY;
1057 break;
1058 case INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY:
1059 errorCode = "INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY";
1060 errorType = wxWEB_NAV_ERR_SECURITY;
1061 break;
1062 case INET_E_CODE_INSTALL_SUPPRESSED:
1063 errorCode = "INET_E_CODE_INSTALL_SUPPRESSED";
1064 errorType = wxWEB_NAV_ERR_SECURITY;
1065 break;
1066 }
1067
1068 wxString url = evt[1].GetString();
1069 wxString target = evt[2].GetString();
1070 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_ERROR, GetId(),
1071 url, target);
1072 event.SetEventObject(this);
1073 event.SetInt(errorType);
1074 event.SetString(errorCode);
1075 HandleWindowEvent(event);
1076 break;
1077 }
1078 case DISPID_NEWWINDOW3:
1079 {
1080 wxString url = evt[4].GetString();
1081
1082 wxWebViewEvent event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW,
1083 GetId(), url, wxEmptyString);
1084 event.SetEventObject(this);
1085 HandleWindowEvent(event);
1086
1087 //We always cancel this event otherwise an Internet Exporer window
1088 //is opened for the url
1089 wxActiveXEventNativeMSW* nativeParams = evt.GetNativeParameters();
1090 *V_BOOLREF(&nativeParams->pDispParams->rgvarg[3]) = VARIANT_TRUE;
1091 break;
1092 }
1093 }
1094
1095 evt.Skip();
1096 }
1097
1098 VirtualProtocol::VirtualProtocol(wxSharedPtr<wxWebViewHandler> handler)
1099 {
1100 m_file = NULL;
1101 m_handler = handler;
1102 }
1103
1104 BEGIN_IID_TABLE(VirtualProtocol)
1105 ADD_IID(Unknown)
1106 ADD_RAW_IID(wxIID_IInternetProtocolRoot)
1107 ADD_RAW_IID(wxIID_IInternetProtocol)
1108 END_IID_TABLE;
1109
1110 IMPLEMENT_IUNKNOWN_METHODS(VirtualProtocol)
1111
1112 HRESULT VirtualProtocol::Start(LPCWSTR szUrl, wxIInternetProtocolSink *pOIProtSink,
1113 wxIInternetBindInfo *pOIBindInfo, DWORD grfPI,
1114 HANDLE_PTR dwReserved)
1115 {
1116 wxUnusedVar(szUrl);
1117 wxUnusedVar(pOIBindInfo);
1118 wxUnusedVar(grfPI);
1119 wxUnusedVar(dwReserved);
1120 m_protocolSink = pOIProtSink;
1121
1122 //We get the file itself from the protocol handler
1123 m_file = m_handler->GetFile(szUrl);
1124
1125
1126 if(!m_file)
1127 return INET_E_RESOURCE_NOT_FOUND;
1128
1129 //We return the stream length for current and total size as we can always
1130 //read the whole file from the stream
1131 wxFileOffset length = m_file->GetStream()->GetLength();
1132 m_protocolSink->ReportData(wxBSCF_FIRSTDATANOTIFICATION |
1133 wxBSCF_DATAFULLYAVAILABLE |
1134 wxBSCF_LASTDATANOTIFICATION,
1135 length, length);
1136 return S_OK;
1137 }
1138
1139 HRESULT VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRead)
1140 {
1141 //If the file is null we return false to indicte it is finished
1142 if(!m_file)
1143 return S_FALSE;
1144
1145 wxStreamError err = m_file->GetStream()->Read(pv, cb).GetLastError();
1146 *pcbRead = m_file->GetStream()->LastRead();
1147
1148 if(err == wxSTREAM_NO_ERROR)
1149 {
1150 if(*pcbRead < cb)
1151 {
1152 wxDELETE(m_file);
1153 m_protocolSink->ReportResult(S_OK, 0, NULL);
1154 }
1155 //As we are not eof there is more data
1156 return S_OK;
1157 }
1158 else if(err == wxSTREAM_EOF)
1159 {
1160 wxDELETE(m_file);
1161 m_protocolSink->ReportResult(S_OK, 0, NULL);
1162 //We are eof and so finished
1163 return S_OK;
1164 }
1165 else if(err == wxSTREAM_READ_ERROR)
1166 {
1167 wxDELETE(m_file);
1168 return INET_E_DOWNLOAD_FAILURE;
1169 }
1170 else
1171 {
1172 //Dummy return to surpress a compiler warning
1173 wxFAIL;
1174 return INET_E_DOWNLOAD_FAILURE;
1175 }
1176 }
1177
1178 BEGIN_IID_TABLE(ClassFactory)
1179 ADD_IID(Unknown)
1180 ADD_IID(ClassFactory)
1181 END_IID_TABLE;
1182
1183 IMPLEMENT_IUNKNOWN_METHODS(ClassFactory)
1184
1185 HRESULT ClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid,
1186 void ** ppvObject)
1187 {
1188 if (pUnkOuter)
1189 return CLASS_E_NOAGGREGATION;
1190 VirtualProtocol* vp = new VirtualProtocol(m_handler);
1191 vp->AddRef();
1192 HRESULT hr = vp->QueryInterface(riid, ppvObject);
1193 vp->Release();
1194 return hr;
1195
1196 }
1197
1198 STDMETHODIMP ClassFactory::LockServer(BOOL fLock)
1199 {
1200 wxUnusedVar(fLock);
1201 return S_OK;
1202 }
1203
1204 wxIEContainer::wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk,
1205 DocHostUIHandler* uiHandler) :
1206 wxActiveXContainer(parent,iid,pUnk)
1207 {
1208 m_uiHandler = uiHandler;
1209 }
1210
1211 wxIEContainer::~wxIEContainer()
1212 {
1213 }
1214
1215 bool wxIEContainer::QueryClientSiteInterface(REFIID iid, void **_interface,
1216 const char *&desc)
1217 {
1218 if (m_uiHandler && IsEqualIID(iid, wxIID_IDocHostUIHandler))
1219 {
1220 *_interface = (IUnknown *) (wxIDocHostUIHandler *) m_uiHandler;
1221 desc = "IDocHostUIHandler";
1222 return true;
1223 }
1224 return false;
1225 }
1226
1227 HRESULT DocHostUIHandler::ShowContextMenu(DWORD dwID, POINT *ppt,
1228 IUnknown *pcmdtReserved,
1229 IDispatch *pdispReserved)
1230 {
1231 wxUnusedVar(dwID);
1232 wxUnusedVar(ppt);
1233 wxUnusedVar(pcmdtReserved);
1234 wxUnusedVar(pdispReserved);
1235 return E_NOTIMPL;
1236 }
1237
1238 HRESULT DocHostUIHandler::GetHostInfo(DOCHOSTUIINFO *pInfo)
1239 {
1240 //don't show 3d border and ebales themes.
1241 pInfo->dwFlags = pInfo->dwFlags | DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME;
1242 return S_OK;
1243 }
1244
1245 HRESULT DocHostUIHandler::ShowUI(DWORD dwID,
1246 IOleInPlaceActiveObject *pActiveObject,
1247 IOleCommandTarget *pCommandTarget,
1248 IOleInPlaceFrame *pFrame,
1249 IOleInPlaceUIWindow *pDoc)
1250 {
1251 wxUnusedVar(dwID);
1252 wxUnusedVar(pActiveObject);
1253 wxUnusedVar(pCommandTarget);
1254 wxUnusedVar(pFrame);
1255 wxUnusedVar(pDoc);
1256 return S_FALSE;
1257 }
1258
1259 HRESULT DocHostUIHandler::HideUI(void)
1260 {
1261 return E_NOTIMPL;
1262 }
1263
1264 HRESULT DocHostUIHandler::UpdateUI(void)
1265 {
1266 return E_NOTIMPL;
1267 }
1268
1269 HRESULT DocHostUIHandler::EnableModeless(BOOL fEnable)
1270 {
1271 wxUnusedVar(fEnable);
1272 return E_NOTIMPL;
1273 }
1274
1275 HRESULT DocHostUIHandler::OnDocWindowActivate(BOOL fActivate)
1276 {
1277 wxUnusedVar(fActivate);
1278 return E_NOTIMPL;
1279 }
1280
1281 HRESULT DocHostUIHandler::OnFrameWindowActivate(BOOL fActivate)
1282 {
1283 wxUnusedVar(fActivate);
1284 return E_NOTIMPL;
1285 }
1286
1287 HRESULT DocHostUIHandler::ResizeBorder(LPCRECT prcBorder,
1288 IOleInPlaceUIWindow *pUIWindow,
1289 BOOL fFrameWindow)
1290 {
1291 wxUnusedVar(prcBorder);
1292 wxUnusedVar(pUIWindow);
1293 wxUnusedVar(fFrameWindow);
1294 return E_NOTIMPL;
1295 }
1296
1297 HRESULT DocHostUIHandler::TranslateAccelerator(LPMSG lpMsg,
1298 const GUID *pguidCmdGroup,
1299 DWORD nCmdID)
1300 {
1301 if(lpMsg && lpMsg->message == WM_KEYDOWN)
1302 {
1303 //control is down?
1304 if((GetKeyState(VK_CONTROL) & 0x8000 ))
1305 {
1306 //skip CTRL-N, CTRL-F and CTRL-P
1307 if(lpMsg->wParam == 'N' || lpMsg->wParam == 'P' || lpMsg->wParam == 'F')
1308 {
1309 return S_OK;
1310 }
1311 }
1312 //skip F5
1313 if(lpMsg->wParam == VK_F5)
1314 {
1315 return S_OK;
1316 }
1317 }
1318
1319 wxUnusedVar(pguidCmdGroup);
1320 wxUnusedVar(nCmdID);
1321 return E_NOTIMPL;
1322 }
1323
1324 HRESULT DocHostUIHandler::GetOptionKeyPath(LPOLESTR *pchKey,DWORD dw)
1325 {
1326 wxUnusedVar(pchKey);
1327 wxUnusedVar(dw);
1328 return E_NOTIMPL;
1329 }
1330
1331 HRESULT DocHostUIHandler::GetDropTarget(IDropTarget *pDropTarget,
1332 IDropTarget **ppDropTarget)
1333 {
1334 wxUnusedVar(pDropTarget);
1335 wxUnusedVar(ppDropTarget);
1336 return E_NOTIMPL;
1337 }
1338
1339 HRESULT DocHostUIHandler::GetExternal(IDispatch **ppDispatch)
1340 {
1341 wxUnusedVar(ppDispatch);
1342 return E_NOTIMPL;
1343 }
1344
1345 HRESULT DocHostUIHandler::TranslateUrl(DWORD dwTranslate,
1346 OLECHAR *pchURLIn,
1347 OLECHAR **ppchURLOut)
1348 {
1349 wxUnusedVar(dwTranslate);
1350 wxUnusedVar(pchURLIn);
1351 wxUnusedVar(ppchURLOut);
1352 return E_NOTIMPL;
1353 }
1354
1355 HRESULT DocHostUIHandler::FilterDataObject(IDataObject *pDO, IDataObject **ppDORet)
1356 {
1357 wxUnusedVar(pDO);
1358 wxUnusedVar(ppDORet);
1359 return E_NOTIMPL;
1360 }
1361
1362 BEGIN_IID_TABLE(DocHostUIHandler)
1363 ADD_IID(Unknown)
1364 ADD_RAW_IID(wxIID_IDocHostUIHandler)
1365 END_IID_TABLE;
1366
1367 IMPLEMENT_IUNKNOWN_METHODS(DocHostUIHandler)
1368
1369 #endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE