1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/webview_ie.cpp
3 // Purpose: wxMSW wxWebViewIE class implementation for web view component
4 // Author: Marianne Gagnon
6 // Copyright: (c) 2010 Marianne Gagnon, 2011 Steven Lamerton
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
13 #if defined(__BORLANDC__)
17 #include "wx/msw/webview_ie.h"
19 #if wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE
26 #include "wx/msw/registry.h"
27 #include "wx/msw/missing.h"
28 #include "wx/filesys.h"
29 #include "wx/dynlib.h"
32 /* These GUID definitions are our own implementation to support interfaces
33 * normally in urlmon.h. See include/wx/msw/webview_ie.h
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);
42 enum //Internal find flags
44 wxWEB_VIEW_FIND_ADD_POINTERS
= 0x0001,
45 wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
= 0x0002
50 wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewIE
, wxWebView
);
52 BEGIN_EVENT_TABLE(wxWebViewIE
, wxControl
)
53 EVT_ACTIVEX(wxID_ANY
, wxWebViewIE
::onActiveXEvent
)
54 EVT_ERASE_BACKGROUND(wxWebViewIE
::onEraseBg
)
57 bool wxWebViewIE
::Create(wxWindow
* parent
,
65 if (!wxControl
::Create(parent
, id
, pos
, size
, style
,
66 wxDefaultValidator
, name
))
73 m_historyLoadingFromList
= false;
74 m_historyEnabled
= true;
75 m_historyPosition
= -1;
76 m_zoomType
= wxWEB_VIEW_ZOOM_TYPE_TEXT
;
79 if (::CoCreateInstance(CLSID_WebBrowser
, NULL
,
80 CLSCTX_INPROC_SERVER
, // CLSCTX_INPROC,
81 IID_IWebBrowser2
, (void**)&m_webBrowser
) != 0)
83 wxLogError("Failed to initialize IE, CoCreateInstance returned an error");
87 m_ie
.SetDispatchPtr(m_webBrowser
); // wxAutomationObject will release itself
89 m_webBrowser
->put_RegisterAsBrowser(VARIANT_TRUE
);
90 m_webBrowser
->put_RegisterAsDropTarget(VARIANT_TRUE
);
92 m_uiHandler
= new DocHostUIHandler
;
94 m_container
= new wxIEContainer(this, IID_IWebBrowser2
, m_webBrowser
, m_uiHandler
);
96 EnableControlFeature(21 /* FEATURE_DISABLE_NAVIGATION_SOUNDS */);
102 wxWebViewIE
::~wxWebViewIE()
104 for(unsigned int i
= 0; i
< m_factories
.size(); i
++)
106 m_factories
[i
]->Release();
111 void wxWebViewIE
::LoadURL(const wxString
& url
)
113 m_ie
.CallMethod("Navigate", wxConvertStringToOle(url
));
116 void wxWebViewIE
::DoSetPage(const wxString
& html
, const wxString
& baseUrl
)
118 BSTR bstr
= SysAllocString(OLESTR(""));
119 SAFEARRAY
*psaStrings
= SafeArrayCreateVector(VT_VARIANT
, 0, 1);
120 if (psaStrings
!= NULL
)
123 HRESULT hr
= SafeArrayAccessData(psaStrings
, (LPVOID
*)¶m
);
125 param
->bstrVal
= bstr
;
127 hr
= SafeArrayUnaccessData(psaStrings
);
129 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
134 document
->write(psaStrings
);
137 SafeArrayDestroy(psaStrings
);
139 bstr
= SysAllocString(html
.wc_str());
141 // Creates a new one-dimensional array
142 psaStrings
= SafeArrayCreateVector(VT_VARIANT
, 0, 1);
143 if (psaStrings
!= NULL
)
145 hr
= SafeArrayAccessData(psaStrings
, (LPVOID
*)¶m
);
147 param
->bstrVal
= bstr
;
148 hr
= SafeArrayUnaccessData(psaStrings
);
150 document
= GetDocument();
155 document
->write(psaStrings
);
157 // SafeArrayDestroy calls SysFreeString for each BSTR
158 SafeArrayDestroy(psaStrings
);
160 //We send the events when we are done to mimic webkit
162 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED
,
163 GetId(), baseUrl
, "");
164 event
.SetEventObject(this);
165 HandleWindowEvent(event
);
167 //Document complete event
168 event
.SetEventType(wxEVT_COMMAND_WEB_VIEW_LOADED
);
169 event
.SetEventObject(this);
170 HandleWindowEvent(event
);
174 wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL");
179 wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL during clear");
183 wxString wxWebViewIE
::GetPageSource() const
185 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
189 wxCOMPtr
<IHTMLElement
> bodyTag
;
190 wxCOMPtr
<IHTMLElement
> htmlTag
;
192 HRESULT hr
= document
->get_body(&bodyTag
);
195 hr
= bodyTag
->get_parentElement(&htmlTag
);
199 htmlTag
->get_outerHTML(&bstr
);
200 source
= wxString(bstr
);
211 wxWebViewZoom wxWebViewIE
::GetZoom() const
215 case wxWEB_VIEW_ZOOM_TYPE_LAYOUT
:
216 return GetIEOpticalZoom();
217 case wxWEB_VIEW_ZOOM_TYPE_TEXT
:
218 return GetIETextZoom();
223 //Dummy return to stop compiler warnings
224 return wxWEB_VIEW_ZOOM_MEDIUM
;
228 void wxWebViewIE
::SetZoom(wxWebViewZoom zoom
)
232 case wxWEB_VIEW_ZOOM_TYPE_LAYOUT
:
233 SetIEOpticalZoom(zoom
);
235 case wxWEB_VIEW_ZOOM_TYPE_TEXT
:
243 void wxWebViewIE
::SetIETextZoom(wxWebViewZoom level
)
245 //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
246 //is 0 to 4 so the check is unnecessary, these match exactly with the
249 VariantInit (&zoomVariant
);
250 V_VT(&zoomVariant
) = VT_I4
;
251 V_I4(&zoomVariant
) = level
;
256 m_webBrowser
->ExecWB(OLECMDID_ZOOM
,
257 OLECMDEXECOPT_DONTPROMPTUSER
,
259 wxASSERT(result
== S_OK
);
262 wxWebViewZoom wxWebViewIE
::GetIETextZoom() const
265 VariantInit (&zoomVariant
);
266 V_VT(&zoomVariant
) = VT_I4
;
271 m_webBrowser
->ExecWB(OLECMDID_ZOOM
,
272 OLECMDEXECOPT_DONTPROMPTUSER
,
274 wxASSERT(result
== S_OK
);
276 //We can safely cast here as we know that the range matches our enum
277 return static_cast<wxWebViewZoom
>(V_I4(&zoomVariant
));
280 void wxWebViewIE
::SetIEOpticalZoom(wxWebViewZoom level
)
282 //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
283 //is 10 to 1000 so the check is unnecessary
285 VariantInit (&zoomVariant
);
286 V_VT(&zoomVariant
) = VT_I4
;
288 //We make a somewhat arbitray map here, taken from values used by webkit
291 case wxWEB_VIEW_ZOOM_TINY
:
292 V_I4(&zoomVariant
) = 60;
294 case wxWEB_VIEW_ZOOM_SMALL
:
295 V_I4(&zoomVariant
) = 80;
297 case wxWEB_VIEW_ZOOM_MEDIUM
:
298 V_I4(&zoomVariant
) = 100;
300 case wxWEB_VIEW_ZOOM_LARGE
:
301 V_I4(&zoomVariant
) = 130;
303 case wxWEB_VIEW_ZOOM_LARGEST
:
304 V_I4(&zoomVariant
) = 160;
313 m_webBrowser
->ExecWB((OLECMDID
)63 /*OLECMDID_OPTICAL_ZOOM*/,
314 OLECMDEXECOPT_DODEFAULT
,
317 wxASSERT(result
== S_OK
);
320 wxWebViewZoom wxWebViewIE
::GetIEOpticalZoom() const
323 VariantInit (&zoomVariant
);
324 V_VT(&zoomVariant
) = VT_I4
;
329 m_webBrowser
->ExecWB((OLECMDID
)63 /*OLECMDID_OPTICAL_ZOOM*/,
330 OLECMDEXECOPT_DODEFAULT
, NULL
,
332 wxASSERT(result
== S_OK
);
334 const int zoom
= V_I4(&zoomVariant
);
336 //We make a somewhat arbitray map here, taken from values used by webkit
339 return wxWEB_VIEW_ZOOM_TINY
;
341 else if (zoom
> 65 && zoom
<= 90)
343 return wxWEB_VIEW_ZOOM_SMALL
;
345 else if (zoom
> 90 && zoom
<= 115)
347 return wxWEB_VIEW_ZOOM_MEDIUM
;
349 else if (zoom
> 115 && zoom
<= 145)
351 return wxWEB_VIEW_ZOOM_LARGE
;
353 else /*if (zoom > 145) */ //Using else removes a compiler warning
355 return wxWEB_VIEW_ZOOM_LARGEST
;
359 void wxWebViewIE
::SetZoomType(wxWebViewZoomType type
)
364 wxWebViewZoomType wxWebViewIE
::GetZoomType() const
369 bool wxWebViewIE
::CanSetZoomType(wxWebViewZoomType type
) const
371 //IE 6 and below only support text zoom, so check the registry to see what
372 //version we actually have
373 wxRegKey
key(wxRegKey
::HKLM
, "Software\\Microsoft\\Internet Explorer");
375 key
.QueryValue("Version", value
);
377 long version
= wxAtoi(value
.Left(1));
378 if(version
<= 6 && type
== wxWEB_VIEW_ZOOM_TYPE_LAYOUT
)
384 void wxWebViewIE
::Print()
386 m_webBrowser
->ExecWB(OLECMDID_PRINTPREVIEW
,
387 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
390 bool wxWebViewIE
::CanGoBack() const
393 return m_historyPosition
> 0;
398 bool wxWebViewIE
::CanGoForward() const
401 return m_historyPosition
!= static_cast<int>(m_historyList
.size()) - 1;
406 void wxWebViewIE
::LoadHistoryItem(wxSharedPtr
<wxWebViewHistoryItem
> item
)
409 for(unsigned int i
= 0; i
< m_historyList
.size(); i
++)
411 //We compare the actual pointers to find the correct item
412 if(m_historyList
[i
].get() == item
.get())
415 wxASSERT_MSG(pos
!= static_cast<int>(m_historyList
.size()),
416 "invalid history item");
417 m_historyLoadingFromList
= true;
418 LoadURL(item
->GetUrl());
419 m_historyPosition
= pos
;
422 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > wxWebViewIE
::GetBackwardHistory()
424 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > backhist
;
425 //As we don't have std::copy or an iterator constructor in the wxwidgets
426 //native vector we construct it by hand
427 for(int i
= 0; i
< m_historyPosition
; i
++)
429 backhist
.push_back(m_historyList
[i
]);
434 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > wxWebViewIE
::GetForwardHistory()
436 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > forwardhist
;
437 //As we don't have std::copy or an iterator constructor in the wxwidgets
438 //native vector we construct it by hand
439 for(int i
= m_historyPosition
+ 1; i
< static_cast<int>(m_historyList
.size()); i
++)
441 forwardhist
.push_back(m_historyList
[i
]);
446 void wxWebViewIE
::GoBack()
448 LoadHistoryItem(m_historyList
[m_historyPosition
- 1]);
451 void wxWebViewIE
::GoForward()
453 LoadHistoryItem(m_historyList
[m_historyPosition
+ 1]);
456 void wxWebViewIE
::Stop()
458 m_ie
.CallMethod("Stop");
461 void wxWebViewIE
::ClearHistory()
463 m_historyList
.clear();
464 m_historyPosition
= -1;
467 void wxWebViewIE
::EnableHistory(bool enable
)
469 m_historyEnabled
= enable
;
470 m_historyList
.clear();
471 m_historyPosition
= -1;
474 void wxWebViewIE
::Reload(wxWebViewReloadFlags flags
)
478 V_VT(&level
) = VT_I2
;
482 case wxWEB_VIEW_RELOAD_DEFAULT
:
483 V_I2(&level
) = REFRESH_NORMAL
;
485 case wxWEB_VIEW_RELOAD_NO_CACHE
:
486 V_I2(&level
) = REFRESH_COMPLETELY
;
489 wxFAIL_MSG("Unexpected reload type");
492 m_webBrowser
->Refresh2(&level
);
495 bool wxWebViewIE
::IsOfflineMode()
497 wxVariant out
= m_ie
.GetProperty("Offline");
499 wxASSERT(out
.GetType() == "bool");
501 return out
.GetBool();
504 void wxWebViewIE
::SetOfflineMode(bool offline
)
506 // FIXME: the wxWidgets docs do not really document what the return
507 // parameter of PutProperty is
511 m_ie
.PutProperty("Offline", (offline ?
517 bool wxWebViewIE
::IsBusy() const
519 if (m_isBusy
) return true;
521 wxVariant out
= m_ie
.GetProperty("Busy");
523 wxASSERT(out
.GetType() == "bool");
525 return out
.GetBool();
528 wxString wxWebViewIE
::GetCurrentURL() const
530 wxVariant out
= m_ie
.GetProperty("LocationURL");
532 wxASSERT(out
.GetType() == "string");
533 return out
.GetString();
536 wxString wxWebViewIE
::GetCurrentTitle() const
538 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
543 document
->get_nameProp(&title
);
544 return wxString(title
);
552 bool wxWebViewIE
::CanCut() const
554 return CanExecCommand("Cut");
557 bool wxWebViewIE
::CanCopy() const
559 return CanExecCommand("Copy");
562 bool wxWebViewIE
::CanPaste() const
564 return CanExecCommand("Paste");
567 void wxWebViewIE
::Cut()
572 void wxWebViewIE
::Copy()
577 void wxWebViewIE
::Paste()
579 ExecCommand("Paste");
582 bool wxWebViewIE
::CanUndo() const
584 return CanExecCommand("Undo");
587 bool wxWebViewIE
::CanRedo() const
589 return CanExecCommand("Redo");
592 void wxWebViewIE
::Undo()
597 void wxWebViewIE
::Redo()
602 long wxWebViewIE
::Find(const wxString
& text
, int flags
)
604 //If the text is empty then we clear.
608 if(m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
610 FindInternal(m_findText
, (m_findFlags
&~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
);
615 //Have we done this search before?
616 if(m_findText
== text
)
618 //Just do a highlight?
619 if((flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
) != (m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
))
622 if(!m_findPointers
.empty())
624 FindInternal(m_findText
, m_findFlags
, ((flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
) == 0 ? wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
: 0));
626 return m_findPosition
;
628 else if(((m_findFlags
& wxWEB_VIEW_FIND_ENTIRE_WORD
) == (flags
& wxWEB_VIEW_FIND_ENTIRE_WORD
)) && ((m_findFlags
& wxWEB_VIEW_FIND_MATCH_CASE
) == (flags
&wxWEB_VIEW_FIND_MATCH_CASE
)))
631 return FindNext(((flags
& wxWEB_VIEW_FIND_BACKWARDS
) ?
-1 : 1));
634 //Remove old highlight if any.
635 if(m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
637 FindInternal(m_findText
, (m_findFlags
&~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
);
639 //Reset find variables.
644 //find the text and return count.
645 FindInternal(text
, flags
, wxWEB_VIEW_FIND_ADD_POINTERS
);
646 return m_findPointers
.empty() ? wxNOT_FOUND
: m_findPointers
.size();
649 void wxWebViewIE
::SetEditable(bool enable
)
651 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
656 document
->put_designMode(SysAllocString(L
"On"));
658 document
->put_designMode(SysAllocString(L
"Off"));
663 bool wxWebViewIE
::IsEditable() const
665 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
670 document
->get_designMode(&mode
);
671 if(wxString(mode
) == "On")
682 void wxWebViewIE
::SelectAll()
684 ExecCommand("SelectAll");
687 bool wxWebViewIE
::HasSelection() const
689 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
693 wxCOMPtr
<IHTMLSelectionObject
> selection
;
695 HRESULT hr
= document
->get_selection(&selection
);
699 selection
->get_type(&type
);
700 sel
= wxString(type
);
702 return sel
!= "None";
710 void wxWebViewIE
::DeleteSelection()
712 ExecCommand("Delete");
715 wxString wxWebViewIE
::GetSelectedText() const
717 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
721 wxCOMPtr
<IHTMLSelectionObject
> selection
;
723 HRESULT hr
= document
->get_selection(&selection
);
726 wxCOMPtr
<IDispatch
> disrange
;
727 hr
= selection
->createRange(&disrange
);
730 wxCOMPtr
<IHTMLTxtRange
> range
;
731 hr
= disrange
->QueryInterface(IID_IHTMLTxtRange
, (void**)&range
);
735 range
->get_text(&text
);
736 selected
= wxString(text
);
748 wxString wxWebViewIE
::GetSelectedSource() const
750 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
754 wxCOMPtr
<IHTMLSelectionObject
> selection
;
756 HRESULT hr
= document
->get_selection(&selection
);
759 wxCOMPtr
<IDispatch
> disrange
;
760 hr
= selection
->createRange(&disrange
);
763 wxCOMPtr
<IHTMLTxtRange
> range
;
764 hr
= disrange
->QueryInterface(IID_IHTMLTxtRange
, (void**)&range
);
768 range
->get_htmlText(&text
);
769 selected
= wxString(text
);
781 void wxWebViewIE
::ClearSelection()
783 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
787 wxCOMPtr
<IHTMLSelectionObject
> selection
;
789 HRESULT hr
= document
->get_selection(&selection
);
797 wxString wxWebViewIE
::GetPageText() const
799 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
804 wxCOMPtr
<IHTMLElement
> body
;
805 HRESULT hr
= document
->get_body(&body
);
809 body
->get_innerText(&out
);
810 text
= wxString(out
);
820 void wxWebViewIE
::RunScript(const wxString
& javascript
)
822 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
826 wxCOMPtr
<IHTMLWindow2
> window
;
827 wxString language
= "javascript";
828 HRESULT hr
= document
->get_parentWindow(&window
);
833 V_VT(&level
) = VT_EMPTY
;
834 window
->execScript(SysAllocString(javascript
.wc_str()),
835 SysAllocString(language
.wc_str()),
841 void wxWebViewIE
::RegisterHandler(wxSharedPtr
<wxWebViewHandler
> handler
)
843 wxDynamicLibrary
urlMon(wxT("urlmon.dll"));
844 if(urlMon
.HasSymbol(wxT("CoInternetGetSession")))
846 typedef HRESULT (WINAPI
*CoInternetGetSession_t
)(DWORD
, wxIInternetSession
**, DWORD
);
847 wxDYNLIB_FUNCTION(CoInternetGetSession_t
, CoInternetGetSession
, urlMon
);
849 ClassFactory
* cf
= new ClassFactory(handler
);
850 wxIInternetSession
* session
;
851 HRESULT res
= (*pfnCoInternetGetSession
)(0, &session
, 0);
854 wxFAIL_MSG("Could not retrive internet session");
857 HRESULT hr
= session
->RegisterNameSpace(cf
, CLSID_FileProtocol
,
858 handler
->GetName().wc_str(),
862 wxFAIL_MSG("Could not register protocol");
864 m_factories
.push_back(cf
);
868 wxFAIL_MSG("urlmon does not contain CoInternetGetSession");
872 bool wxWebViewIE
::CanExecCommand(wxString command
) const
874 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
878 VARIANT_BOOL enabled
;
880 document
->queryCommandEnabled(SysAllocString(command
.wc_str()), &enabled
);
882 return (enabled
== VARIANT_TRUE
);
891 void wxWebViewIE
::ExecCommand(wxString command
)
893 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
897 document
->execCommand(SysAllocString(command
.wc_str()), VARIANT_FALSE
, VARIANT(), NULL
);
901 wxCOMPtr
<IHTMLDocument2
> wxWebViewIE
::GetDocument() const
903 wxCOMPtr
<IDispatch
> dispatch
;
904 wxCOMPtr
<IHTMLDocument2
> document
;
905 HRESULT result
= m_webBrowser
->get_Document(&dispatch
);
906 if(dispatch
&& SUCCEEDED(result
))
908 //document is set to null automatically if the interface isn't supported
909 dispatch
->QueryInterface(IID_IHTMLDocument2
, (void**)&document
);
914 bool wxWebViewIE
::IsElementVisible(IHTMLElement
* elm
)
916 IHTMLCurrentStyle
* style
;
917 IHTMLElement
*elm1
= elm
;
920 bool is_visible
= true;
921 //This method is not perfect but it does discover most of the hidden elements.
922 //so if a better solution is found, then please do improve.
925 if(SUCCEEDED(elm1
->QueryInterface(IID_IHTMLElement2
, (void**) &elm2
)))
927 if(SUCCEEDED(elm2
->get_currentStyle(&style
)))
929 //Check if the object has the style display:none.
930 if((style
->get_display(&tmp_bstr
) != S_OK
) ||
931 (tmp_bstr
!= NULL
&& (_wcsicmp(tmp_bstr
, L
"none") == 0)))
935 //Check if the object has the style visibility:hidden.
936 if(is_visible
&& (style
->get_visibility(&tmp_bstr
) != S_OK
) ||
937 (tmp_bstr
!= NULL
&& _wcsicmp(tmp_bstr
, L
"hidden") == 0))
946 //Lets check the object's parent element.
947 IHTMLElement
* parent
;
948 if(is_visible
&& SUCCEEDED(elm1
->get_parentElement(&parent
)))
962 void wxWebViewIE
::FindInternal(const wxString
& text
, int flags
, int internal_flag
)
964 IMarkupServices
*pIMS
;
965 IMarkupContainer
*pIMC
;
966 IMarkupPointer
*ptrBegin
, *ptrEnd
;
969 IHTMLDocument2
*document
= GetDocument();
970 //This function does the acutal work.
971 if(SUCCEEDED(document
->QueryInterface(IID_IMarkupServices
, (void **)&pIMS
)))
973 if(SUCCEEDED(document
->QueryInterface(IID_IMarkupContainer
, (void **)&pIMC
)))
975 BSTR attr_bstr
= SysAllocString(L
"style=\"background-color:#ffff00\"");
976 BSTR text_bstr
= SysAllocString(text
.wc_str());
977 pIMS
->CreateMarkupPointer(&ptrBegin
);
978 pIMS
->CreateMarkupPointer(&ptrEnd
);
980 ptrBegin
->SetGravity(POINTER_GRAVITY_Right
);
981 ptrBegin
->MoveToContainer(pIMC
, TRUE
);
982 //Create the find flag from the wx one.
983 if(flags
& wxWEB_VIEW_FIND_ENTIRE_WORD
)
985 find_flag
|= FINDTEXT_WHOLEWORD
;
987 if(flags
& wxWEB_VIEW_FIND_MATCH_CASE
)
989 find_flag
|= FINDTEXT_MATCHCASE
;
992 //A little speed-up to avoid to re-alloc in the positions vector.
993 if(text
.Len() < 3 && m_findPointers
.capacity() < 500)
995 m_findPointers
.reserve(text
.Len() == 1 ?
1000 : 500);
998 while(ptrBegin
->FindText(text_bstr
, find_flag
, ptrEnd
, NULL
) == S_OK
)
1000 if(ptrBegin
->CurrentScope(&elm
) == S_OK
)
1002 if(IsElementVisible(elm
))
1004 //Highlight the word if the flag was set.
1005 if(flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
1007 IHTMLElement
* pFontEl
;
1008 pIMS
->CreateElement(TAGID_FONT
, attr_bstr
, &pFontEl
);
1009 pIMS
->InsertElement(pFontEl
, ptrBegin
, ptrEnd
);
1011 if(internal_flag
& wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
)
1013 IHTMLElement
* pFontEl
;
1014 ptrBegin
->CurrentScope(&pFontEl
);
1015 pIMS
->RemoveElement(pFontEl
);
1018 if(internal_flag
& wxWEB_VIEW_FIND_ADD_POINTERS
)
1020 IMarkupPointer
*cptrBegin
, *cptrEnd
;
1021 pIMS
->CreateMarkupPointer(&cptrBegin
);
1022 pIMS
->CreateMarkupPointer(&cptrEnd
);
1023 cptrBegin
->MoveToPointer(ptrBegin
);
1024 cptrEnd
->MoveToPointer(ptrEnd
);
1025 m_findPointers
.push_back(wxFindPointers(cptrBegin
,cptrEnd
));
1030 ptrBegin
->MoveToPointer(ptrEnd
);
1033 SysFreeString(text_bstr
);
1034 SysFreeString(attr_bstr
);
1036 ptrBegin
->Release();
1041 document
->Release();
1044 long wxWebViewIE
::FindNext(int direction
)
1046 //Don't bother if we have no pointers set.
1047 if(m_findPointers
.empty())
1051 //Manage the find position and do some checks.
1061 if(m_findPosition
>= (signed)m_findPointers
.size())
1063 if(m_findFlags
& wxWEB_VIEW_FIND_WRAP
)
1073 else if(m_findPosition
< 0)
1075 if(m_findFlags
& wxWEB_VIEW_FIND_WRAP
)
1077 m_findPosition
= m_findPointers
.size()-1;
1085 //some variables to use later on.
1086 IHTMLElement
*body_element
;
1087 IHTMLBodyElement
*body
;
1088 IHTMLTxtRange
*range
= NULL
;
1089 IMarkupServices
*pIMS
;
1090 IHTMLDocument2
*document
= GetDocument();
1092 //Now try to create a range from the body.
1093 if(SUCCEEDED(document
->get_body(&body_element
)))
1095 if(SUCCEEDED(body_element
->QueryInterface(IID_IHTMLBodyElement
,(void**)&body
)))
1097 if(SUCCEEDED(body
->createTextRange(&range
)))
1099 //So far so good, now we try to position our find pointers.
1100 if(SUCCEEDED(document
->QueryInterface(IID_IMarkupServices
,(void **)&pIMS
)))
1102 IMarkupPointer
*begin
= m_findPointers
[m_findPosition
].begin
, *end
= m_findPointers
[m_findPosition
].end
;
1103 if(pIMS
->MoveRangeToPointers(begin
,end
,range
) == S_OK
&& range
->select() == S_OK
)
1105 ret
= m_findPosition
;
1113 body_element
->Release();
1115 document
->Release();
1119 void wxWebViewIE
::FindClear()
1121 //Reset find variables.
1123 m_findFlags
= wxWEB_VIEW_FIND_DEFAULT
;
1124 m_findPosition
= -1;
1126 //The m_findPointers contains pointers for the found text.
1127 //Since it uses ref counting we call release on the pointers first
1128 //before we remove them from the vector. In other words do not just
1129 //remove elements from m_findPointers without calling release first
1130 //or you will get a memory leak.
1131 size_t count
= m_findPointers
.size();
1132 for(size_t i
= 0; i
< count
; i
++)
1134 m_findPointers
[i
].begin
->Release();
1135 m_findPointers
[i
].end
->Release();
1137 m_findPointers
.clear();
1140 bool wxWebViewIE
::EnableControlFeature(long flag
, bool enable
)
1142 #if wxUSE_DYNLIB_CLASS
1144 wxDynamicLibrary
urlMon(wxT("urlmon.dll"));
1145 if( urlMon
.IsLoaded() &&
1146 urlMon
.HasSymbol("CoInternetSetFeatureEnabled") &&
1147 urlMon
.HasSymbol("CoInternetIsFeatureEnabled"))
1149 typedef HRESULT (WINAPI
*CoInternetSetFeatureEnabled_t
)(DWORD
, DWORD
, BOOL
);
1150 typedef HRESULT (WINAPI
*CoInternetIsFeatureEnabled_t
)(DWORD
, DWORD
);
1152 wxDYNLIB_FUNCTION(CoInternetSetFeatureEnabled_t
, CoInternetSetFeatureEnabled
, urlMon
);
1153 wxDYNLIB_FUNCTION(CoInternetIsFeatureEnabled_t
, CoInternetIsFeatureEnabled
, urlMon
);
1155 HRESULT hr
= (*pfnCoInternetIsFeatureEnabled
)(flag
,
1156 0x2 /* SET_FEATURE_ON_PROCESS */);
1157 if((hr
== S_OK
&& enable
) || (hr
== S_FALSE
&& !enable
))
1160 hr
= (*pfnCoInternetSetFeatureEnabled
)(flag
,
1161 0x2/* SET_FEATURE_ON_PROCESS */,
1162 (enable ? TRUE
: FALSE
));
1165 wxLogApiError(wxT("CoInternetSetFeatureEnabled"), hr
);
1173 wxUnusedVar(enable
);
1175 #endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
1178 void wxWebViewIE
::onActiveXEvent(wxActiveXEvent
& evt
)
1180 if (m_webBrowser
== NULL
) return;
1182 switch (evt
.GetDispatchId())
1184 case DISPID_BEFORENAVIGATE2
:
1188 wxString url
= evt
[1].GetString();
1189 wxString target
= evt
[3].GetString();
1191 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING
,
1192 GetId(), url
, target
);
1194 //skip empty javascript events.
1195 if(url
== "javascript:\"\"" && target
.IsEmpty())
1201 event
.SetEventObject(this);
1202 HandleWindowEvent(event
);
1205 if (!event
.IsAllowed())
1207 wxActiveXEventNativeMSW
* nativeParams
=
1208 evt
.GetNativeParameters();
1209 *V_BOOLREF(&nativeParams
->pDispParams
->rgvarg
[0]) = VARIANT_TRUE
;
1212 // at this point, either the navigation event has been cancelled
1213 // and we're not busy, either it was accepted and IWebBrowser2's
1214 // Busy property will be true; so we don't need our override
1221 case DISPID_NAVIGATECOMPLETE2
:
1223 wxString url
= evt
[1].GetString();
1224 // TODO: set target parameter if possible
1225 wxString target
= wxEmptyString
;
1226 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED
,
1227 GetId(), url
, target
);
1228 event
.SetEventObject(this);
1229 HandleWindowEvent(event
);
1233 case DISPID_PROGRESSCHANGE
:
1235 // download progress
1239 case DISPID_DOCUMENTCOMPLETE
:
1241 //Only send a complete even if we are actually finished, this brings
1242 //the event in to line with webkit
1244 m_webBrowser
->get_ReadyState( &rs
);
1245 if(rs
!= READYSTATE_COMPLETE
)
1248 wxString url
= evt
[1].GetString();
1250 //As we are complete we also add to the history list, but not if the
1251 //page is not the main page, ie it is a subframe
1252 //We also have to check if we are loading a file:// url, if so we
1253 //need to change the comparison as ie passes back a different style
1255 if(m_historyEnabled
&& !m_historyLoadingFromList
&&
1256 (url
== GetCurrentURL() ||
1257 (GetCurrentURL().substr(0, 4) == "file" &&
1258 wxFileSystem
::URLToFileName(GetCurrentURL()).GetFullPath() == url
)))
1260 //If we are not at the end of the list, then erase everything
1261 //between us and the end before adding the new page
1262 if(m_historyPosition
!= static_cast<int>(m_historyList
.size()) - 1)
1264 m_historyList
.erase(m_historyList
.begin() + m_historyPosition
+ 1,
1265 m_historyList
.end());
1267 wxSharedPtr
<wxWebViewHistoryItem
> item(new wxWebViewHistoryItem(url
, GetCurrentTitle()));
1268 m_historyList
.push_back(item
);
1269 m_historyPosition
++;
1271 //Reset as we are done now
1272 m_historyLoadingFromList
= false;
1273 //Reset the find values.
1275 // TODO: set target parameter if possible
1276 wxString target
= wxEmptyString
;
1277 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_LOADED
, GetId(),
1279 event
.SetEventObject(this);
1280 HandleWindowEvent(event
);
1284 case DISPID_STATUSTEXTCHANGE
:
1289 case DISPID_TITLECHANGE
:
1291 wxString title
= evt
[0].GetString();
1293 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED
,
1294 GetId(), GetCurrentURL(), "");
1295 event
.SetString(title
);
1296 event
.SetEventObject(this);
1297 HandleWindowEvent(event
);
1301 case DISPID_NAVIGATEERROR
:
1303 wxWebViewNavigationError errorType
= wxWEB_NAV_ERR_OTHER
;
1304 wxString errorCode
= "?";
1305 switch (evt
[3].GetLong())
1307 case INET_E_INVALID_URL
: // (0x800C0002L or -2146697214)
1308 errorCode
= "INET_E_INVALID_URL";
1309 errorType
= wxWEB_NAV_ERR_REQUEST
;
1311 case INET_E_NO_SESSION
: // (0x800C0003L or -2146697213)
1312 errorCode
= "INET_E_NO_SESSION";
1313 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1315 case INET_E_CANNOT_CONNECT
: // (0x800C0004L or -2146697212)
1316 errorCode
= "INET_E_CANNOT_CONNECT";
1317 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1319 case INET_E_RESOURCE_NOT_FOUND
: // (0x800C0005L or -2146697211)
1320 errorCode
= "INET_E_RESOURCE_NOT_FOUND";
1321 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1323 case INET_E_OBJECT_NOT_FOUND
: // (0x800C0006L or -2146697210)
1324 errorCode
= "INET_E_OBJECT_NOT_FOUND";
1325 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1327 case INET_E_DATA_NOT_AVAILABLE
: // (0x800C0007L or -2146697209)
1328 errorCode
= "INET_E_DATA_NOT_AVAILABLE";
1329 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1331 case INET_E_DOWNLOAD_FAILURE
: // (0x800C0008L or -2146697208)
1332 errorCode
= "INET_E_DOWNLOAD_FAILURE";
1333 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1335 case INET_E_AUTHENTICATION_REQUIRED
: // (0x800C0009L or -2146697207)
1336 errorCode
= "INET_E_AUTHENTICATION_REQUIRED";
1337 errorType
= wxWEB_NAV_ERR_AUTH
;
1339 case INET_E_NO_VALID_MEDIA
: // (0x800C000AL or -2146697206)
1340 errorCode
= "INET_E_NO_VALID_MEDIA";
1341 errorType
= wxWEB_NAV_ERR_REQUEST
;
1343 case INET_E_CONNECTION_TIMEOUT
: // (0x800C000BL or -2146697205)
1344 errorCode
= "INET_E_CONNECTION_TIMEOUT";
1345 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1347 case INET_E_INVALID_REQUEST
: // (0x800C000CL or -2146697204)
1348 errorCode
= "INET_E_INVALID_REQUEST";
1349 errorType
= wxWEB_NAV_ERR_REQUEST
;
1351 case INET_E_UNKNOWN_PROTOCOL
: // (0x800C000DL or -2146697203)
1352 errorCode
= "INET_E_UNKNOWN_PROTOCOL";
1353 errorType
= wxWEB_NAV_ERR_REQUEST
;
1355 case INET_E_SECURITY_PROBLEM
: // (0x800C000EL or -2146697202)
1356 errorCode
= "INET_E_SECURITY_PROBLEM";
1357 errorType
= wxWEB_NAV_ERR_SECURITY
;
1359 case INET_E_CANNOT_LOAD_DATA
: // (0x800C000FL or -2146697201)
1360 errorCode
= "INET_E_CANNOT_LOAD_DATA";
1361 errorType
= wxWEB_NAV_ERR_OTHER
;
1363 case INET_E_CANNOT_INSTANTIATE_OBJECT
:
1364 // CoCreateInstance will return an error code if this happens,
1365 // we'll handle this above.
1368 case INET_E_REDIRECT_FAILED
: // (0x800C0014L or -2146697196)
1369 errorCode
= "INET_E_REDIRECT_FAILED";
1370 errorType
= wxWEB_NAV_ERR_OTHER
;
1372 case INET_E_REDIRECT_TO_DIR
: // (0x800C0015L or -2146697195)
1373 errorCode
= "INET_E_REDIRECT_TO_DIR";
1374 errorType
= wxWEB_NAV_ERR_REQUEST
;
1376 case INET_E_CANNOT_LOCK_REQUEST
: // (0x800C0016L or -2146697194)
1377 errorCode
= "INET_E_CANNOT_LOCK_REQUEST";
1378 errorType
= wxWEB_NAV_ERR_OTHER
;
1380 case INET_E_USE_EXTEND_BINDING
: // (0x800C0017L or -2146697193)
1381 errorCode
= "INET_E_USE_EXTEND_BINDING";
1382 errorType
= wxWEB_NAV_ERR_OTHER
;
1384 case INET_E_TERMINATED_BIND
: // (0x800C0018L or -2146697192)
1385 errorCode
= "INET_E_TERMINATED_BIND";
1386 errorType
= wxWEB_NAV_ERR_OTHER
;
1388 case INET_E_INVALID_CERTIFICATE
: // (0x800C0019L or -2146697191)
1389 errorCode
= "INET_E_INVALID_CERTIFICATE";
1390 errorType
= wxWEB_NAV_ERR_CERTIFICATE
;
1392 case INET_E_CODE_DOWNLOAD_DECLINED
: // (0x800C0100L or -2146696960)
1393 errorCode
= "INET_E_CODE_DOWNLOAD_DECLINED";
1394 errorType
= wxWEB_NAV_ERR_USER_CANCELLED
;
1396 case INET_E_RESULT_DISPATCHED
: // (0x800C0200L or -2146696704)
1397 // cancel request cancelled...
1398 errorCode
= "INET_E_RESULT_DISPATCHED";
1399 errorType
= wxWEB_NAV_ERR_OTHER
;
1401 case INET_E_CANNOT_REPLACE_SFP_FILE
: // (0x800C0300L or -2146696448)
1402 errorCode
= "INET_E_CANNOT_REPLACE_SFP_FILE";
1403 errorType
= wxWEB_NAV_ERR_SECURITY
;
1405 case INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY
:
1406 errorCode
= "INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY";
1407 errorType
= wxWEB_NAV_ERR_SECURITY
;
1409 case INET_E_CODE_INSTALL_SUPPRESSED
:
1410 errorCode
= "INET_E_CODE_INSTALL_SUPPRESSED";
1411 errorType
= wxWEB_NAV_ERR_SECURITY
;
1415 wxString url
= evt
[1].GetString();
1416 wxString target
= evt
[2].GetString();
1417 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_ERROR
, GetId(),
1419 event
.SetEventObject(this);
1420 event
.SetInt(errorType
);
1421 event
.SetString(errorCode
);
1422 HandleWindowEvent(event
);
1425 case DISPID_NEWWINDOW3
:
1427 wxString url
= evt
[4].GetString();
1429 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW
,
1430 GetId(), url
, wxEmptyString
);
1431 event
.SetEventObject(this);
1432 HandleWindowEvent(event
);
1434 //We always cancel this event otherwise an Internet Exporer window
1435 //is opened for the url
1436 wxActiveXEventNativeMSW
* nativeParams
= evt
.GetNativeParameters();
1437 *V_BOOLREF(&nativeParams
->pDispParams
->rgvarg
[3]) = VARIANT_TRUE
;
1445 VirtualProtocol
::VirtualProtocol(wxSharedPtr
<wxWebViewHandler
> handler
)
1448 m_handler
= handler
;
1451 BEGIN_IID_TABLE(VirtualProtocol
)
1453 ADD_RAW_IID(wxIID_IInternetProtocolRoot
)
1454 ADD_RAW_IID(wxIID_IInternetProtocol
)
1457 IMPLEMENT_IUNKNOWN_METHODS(VirtualProtocol
)
1459 HRESULT STDMETHODCALLTYPE VirtualProtocol
::Start(LPCWSTR szUrl
, wxIInternetProtocolSink
*pOIProtSink
,
1460 wxIInternetBindInfo
*pOIBindInfo
, DWORD grfPI
,
1461 HANDLE_PTR dwReserved
)
1464 wxUnusedVar(pOIBindInfo
);
1466 wxUnusedVar(dwReserved
);
1467 m_protocolSink
= pOIProtSink
;
1469 //We get the file itself from the protocol handler
1470 m_file
= m_handler
->GetFile(szUrl
);
1474 return INET_E_RESOURCE_NOT_FOUND
;
1476 //We return the stream length for current and total size as we can always
1477 //read the whole file from the stream
1478 wxFileOffset length
= m_file
->GetStream()->GetLength();
1479 m_protocolSink
->ReportData(wxBSCF_FIRSTDATANOTIFICATION
|
1480 wxBSCF_DATAFULLYAVAILABLE
|
1481 wxBSCF_LASTDATANOTIFICATION
,
1486 HRESULT STDMETHODCALLTYPE VirtualProtocol
::Read(void *pv
, ULONG cb
, ULONG
*pcbRead
)
1488 //If the file is null we return false to indicte it is finished
1492 wxStreamError err
= m_file
->GetStream()->Read(pv
, cb
).GetLastError();
1493 *pcbRead
= m_file
->GetStream()->LastRead();
1495 if(err
== wxSTREAM_NO_ERROR
)
1500 m_protocolSink
->ReportResult(S_OK
, 0, NULL
);
1502 //As we are not eof there is more data
1505 else if(err
== wxSTREAM_EOF
)
1508 m_protocolSink
->ReportResult(S_OK
, 0, NULL
);
1509 //We are eof and so finished
1512 else if(err
== wxSTREAM_READ_ERROR
)
1515 return INET_E_DOWNLOAD_FAILURE
;
1519 //Dummy return to surpress a compiler warning
1521 return INET_E_DOWNLOAD_FAILURE
;
1525 BEGIN_IID_TABLE(ClassFactory
)
1527 ADD_IID(ClassFactory
)
1530 IMPLEMENT_IUNKNOWN_METHODS(ClassFactory
)
1532 HRESULT STDMETHODCALLTYPE ClassFactory
::CreateInstance(IUnknown
* pUnkOuter
, REFIID riid
,
1536 return CLASS_E_NOAGGREGATION
;
1537 VirtualProtocol
* vp
= new VirtualProtocol(m_handler
);
1539 HRESULT hr
= vp
->QueryInterface(riid
, ppvObject
);
1545 STDMETHODIMP ClassFactory
::LockServer(BOOL fLock
)
1551 wxIEContainer
::wxIEContainer(wxWindow
*parent
, REFIID iid
, IUnknown
*pUnk
,
1552 DocHostUIHandler
* uiHandler
) :
1553 wxActiveXContainer(parent
,iid
,pUnk
)
1555 m_uiHandler
= uiHandler
;
1558 wxIEContainer
::~wxIEContainer()
1562 bool wxIEContainer
::QueryClientSiteInterface(REFIID iid
, void **_interface
,
1565 if (m_uiHandler
&& IsEqualIID(iid
, wxIID_IDocHostUIHandler
))
1567 *_interface
= (IUnknown
*) (wxIDocHostUIHandler
*) m_uiHandler
;
1568 desc
= "IDocHostUIHandler";
1574 HRESULT wxSTDCALL DocHostUIHandler
::ShowContextMenu(DWORD dwID
, POINT
*ppt
,
1575 IUnknown
*pcmdtReserved
,
1576 IDispatch
*pdispReserved
)
1580 wxUnusedVar(pcmdtReserved
);
1581 wxUnusedVar(pdispReserved
);
1585 HRESULT wxSTDCALL DocHostUIHandler
::GetHostInfo(DOCHOSTUIINFO
*pInfo
)
1587 //don't show 3d border and enable themes.
1588 pInfo
->dwFlags
= pInfo
->dwFlags
| DOCHOSTUIFLAG_NO3DBORDER
| DOCHOSTUIFLAG_THEME
;
1592 HRESULT wxSTDCALL DocHostUIHandler
::ShowUI(DWORD dwID
,
1593 IOleInPlaceActiveObject
*pActiveObject
,
1594 IOleCommandTarget
*pCommandTarget
,
1595 IOleInPlaceFrame
*pFrame
,
1596 IOleInPlaceUIWindow
*pDoc
)
1599 wxUnusedVar(pActiveObject
);
1600 wxUnusedVar(pCommandTarget
);
1601 wxUnusedVar(pFrame
);
1606 HRESULT wxSTDCALL DocHostUIHandler
::HideUI(void)
1611 HRESULT wxSTDCALL DocHostUIHandler
::UpdateUI(void)
1616 HRESULT wxSTDCALL DocHostUIHandler
::EnableModeless(BOOL fEnable
)
1618 wxUnusedVar(fEnable
);
1622 HRESULT wxSTDCALL DocHostUIHandler
::OnDocWindowActivate(BOOL fActivate
)
1624 wxUnusedVar(fActivate
);
1628 HRESULT wxSTDCALL DocHostUIHandler
::OnFrameWindowActivate(BOOL fActivate
)
1630 wxUnusedVar(fActivate
);
1634 HRESULT wxSTDCALL DocHostUIHandler
::ResizeBorder(LPCRECT prcBorder
,
1635 IOleInPlaceUIWindow
*pUIWindow
,
1638 wxUnusedVar(prcBorder
);
1639 wxUnusedVar(pUIWindow
);
1640 wxUnusedVar(fFrameWindow
);
1644 HRESULT wxSTDCALL DocHostUIHandler
::TranslateAccelerator(LPMSG lpMsg
,
1645 const GUID
*pguidCmdGroup
,
1648 if(lpMsg
&& lpMsg
->message
== WM_KEYDOWN
)
1651 if((GetKeyState(VK_CONTROL
) & 0x8000 ))
1653 //skip the accelerators used by the control
1654 switch(lpMsg
->wParam
)
1665 if(lpMsg
->wParam
== VK_F5
)
1671 wxUnusedVar(pguidCmdGroup
);
1672 wxUnusedVar(nCmdID
);
1676 HRESULT wxSTDCALL DocHostUIHandler
::GetOptionKeyPath(LPOLESTR
*pchKey
,DWORD dw
)
1678 wxUnusedVar(pchKey
);
1683 HRESULT wxSTDCALL DocHostUIHandler
::GetDropTarget(IDropTarget
*pDropTarget
,
1684 IDropTarget
**ppDropTarget
)
1686 wxUnusedVar(pDropTarget
);
1687 wxUnusedVar(ppDropTarget
);
1691 HRESULT wxSTDCALL DocHostUIHandler
::GetExternal(IDispatch
**ppDispatch
)
1693 wxUnusedVar(ppDispatch
);
1697 HRESULT wxSTDCALL DocHostUIHandler
::TranslateUrl(DWORD dwTranslate
,
1699 OLECHAR
**ppchURLOut
)
1701 wxUnusedVar(dwTranslate
);
1702 wxUnusedVar(pchURLIn
);
1703 wxUnusedVar(ppchURLOut
);
1707 HRESULT wxSTDCALL DocHostUIHandler
::FilterDataObject(IDataObject
*pDO
, IDataObject
**ppDORet
)
1710 wxUnusedVar(ppDORet
);
1714 BEGIN_IID_TABLE(DocHostUIHandler
)
1716 ADD_RAW_IID(wxIID_IDocHostUIHandler
)
1719 IMPLEMENT_IUNKNOWN_METHODS(DocHostUIHandler
)
1721 #endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE