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);
41 DEFINE_GUID(wxIID_IHTMLElement2
,0x3050f434,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
42 DEFINE_GUID(wxIID_IMarkupServices
,0x3050f4a0,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
43 DEFINE_GUID(wxIID_IMarkupContainer
,0x3050f5f9,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
45 enum //Internal find flags
47 wxWEB_VIEW_FIND_ADD_POINTERS
= 0x0001,
48 wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
= 0x0002
53 wxIMPLEMENT_DYNAMIC_CLASS(wxWebViewIE
, wxWebView
);
55 BEGIN_EVENT_TABLE(wxWebViewIE
, wxControl
)
56 EVT_ACTIVEX(wxID_ANY
, wxWebViewIE::onActiveXEvent
)
57 EVT_ERASE_BACKGROUND(wxWebViewIE::onEraseBg
)
60 bool wxWebViewIE::Create(wxWindow
* parent
,
68 if (!wxControl::Create(parent
, id
, pos
, size
, style
,
69 wxDefaultValidator
, name
))
76 m_historyLoadingFromList
= false;
77 m_historyEnabled
= true;
78 m_historyPosition
= -1;
79 m_zoomType
= wxWEB_VIEW_ZOOM_TYPE_TEXT
;
82 if (::CoCreateInstance(CLSID_WebBrowser
, NULL
,
83 CLSCTX_INPROC_SERVER
, // CLSCTX_INPROC,
84 IID_IWebBrowser2
, (void**)&m_webBrowser
) != 0)
86 wxLogError("Failed to initialize IE, CoCreateInstance returned an error");
90 m_ie
.SetDispatchPtr(m_webBrowser
); // wxAutomationObject will release itself
92 m_webBrowser
->put_RegisterAsBrowser(VARIANT_TRUE
);
93 m_webBrowser
->put_RegisterAsDropTarget(VARIANT_TRUE
);
95 m_uiHandler
= new DocHostUIHandler
;
97 m_container
= new wxIEContainer(this, IID_IWebBrowser2
, m_webBrowser
, m_uiHandler
);
99 EnableControlFeature(21 /* FEATURE_DISABLE_NAVIGATION_SOUNDS */);
105 wxWebViewIE::~wxWebViewIE()
107 for(unsigned int i
= 0; i
< m_factories
.size(); i
++)
109 m_factories
[i
]->Release();
114 void wxWebViewIE::LoadURL(const wxString
& url
)
116 m_ie
.CallMethod("Navigate", wxConvertStringToOle(url
));
119 void wxWebViewIE::DoSetPage(const wxString
& html
, const wxString
& baseUrl
)
121 BSTR bstr
= SysAllocString(OLESTR(""));
122 SAFEARRAY
*psaStrings
= SafeArrayCreateVector(VT_VARIANT
, 0, 1);
123 if (psaStrings
!= NULL
)
126 HRESULT hr
= SafeArrayAccessData(psaStrings
, (LPVOID
*)¶m
);
128 param
->bstrVal
= bstr
;
130 hr
= SafeArrayUnaccessData(psaStrings
);
132 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
137 document
->write(psaStrings
);
140 SafeArrayDestroy(psaStrings
);
142 bstr
= SysAllocString(html
.wc_str());
144 // Creates a new one-dimensional array
145 psaStrings
= SafeArrayCreateVector(VT_VARIANT
, 0, 1);
146 if (psaStrings
!= NULL
)
148 hr
= SafeArrayAccessData(psaStrings
, (LPVOID
*)¶m
);
150 param
->bstrVal
= bstr
;
151 hr
= SafeArrayUnaccessData(psaStrings
);
153 document
= GetDocument();
158 document
->write(psaStrings
);
160 // SafeArrayDestroy calls SysFreeString for each BSTR
161 SafeArrayDestroy(psaStrings
);
163 //We send the events when we are done to mimic webkit
165 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED
,
166 GetId(), baseUrl
, "");
167 event
.SetEventObject(this);
168 HandleWindowEvent(event
);
170 //Document complete event
171 event
.SetEventType(wxEVT_COMMAND_WEB_VIEW_LOADED
);
172 event
.SetEventObject(this);
173 HandleWindowEvent(event
);
177 wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL");
182 wxLogError("wxWebViewIE::SetPage() : psaStrings is NULL during clear");
186 wxString
wxWebViewIE::GetPageSource() const
188 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
192 wxCOMPtr
<IHTMLElement
> bodyTag
;
193 wxCOMPtr
<IHTMLElement
> htmlTag
;
195 HRESULT hr
= document
->get_body(&bodyTag
);
198 hr
= bodyTag
->get_parentElement(&htmlTag
);
202 htmlTag
->get_outerHTML(&bstr
);
203 source
= wxString(bstr
);
214 wxWebViewZoom
wxWebViewIE::GetZoom() const
218 case wxWEB_VIEW_ZOOM_TYPE_LAYOUT
:
219 return GetIEOpticalZoom();
220 case wxWEB_VIEW_ZOOM_TYPE_TEXT
:
221 return GetIETextZoom();
226 //Dummy return to stop compiler warnings
227 return wxWEB_VIEW_ZOOM_MEDIUM
;
231 void wxWebViewIE::SetZoom(wxWebViewZoom zoom
)
235 case wxWEB_VIEW_ZOOM_TYPE_LAYOUT
:
236 SetIEOpticalZoom(zoom
);
238 case wxWEB_VIEW_ZOOM_TYPE_TEXT
:
246 void wxWebViewIE::SetIETextZoom(wxWebViewZoom level
)
248 //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
249 //is 0 to 4 so the check is unnecessary, these match exactly with the
252 VariantInit (&zoomVariant
);
253 V_VT(&zoomVariant
) = VT_I4
;
254 V_I4(&zoomVariant
) = level
;
259 m_webBrowser
->ExecWB(OLECMDID_ZOOM
,
260 OLECMDEXECOPT_DONTPROMPTUSER
,
262 wxASSERT(result
== S_OK
);
265 wxWebViewZoom
wxWebViewIE::GetIETextZoom() const
268 VariantInit (&zoomVariant
);
269 V_VT(&zoomVariant
) = VT_I4
;
274 m_webBrowser
->ExecWB(OLECMDID_ZOOM
,
275 OLECMDEXECOPT_DONTPROMPTUSER
,
277 wxASSERT(result
== S_OK
);
279 //We can safely cast here as we know that the range matches our enum
280 return static_cast<wxWebViewZoom
>(V_I4(&zoomVariant
));
283 void wxWebViewIE::SetIEOpticalZoom(wxWebViewZoom level
)
285 //We do not use OLECMDID_OPTICAL_GETZOOMRANGE as the docs say the range
286 //is 10 to 1000 so the check is unnecessary
288 VariantInit (&zoomVariant
);
289 V_VT(&zoomVariant
) = VT_I4
;
291 //We make a somewhat arbitray map here, taken from values used by webkit
294 case wxWEB_VIEW_ZOOM_TINY
:
295 V_I4(&zoomVariant
) = 60;
297 case wxWEB_VIEW_ZOOM_SMALL
:
298 V_I4(&zoomVariant
) = 80;
300 case wxWEB_VIEW_ZOOM_MEDIUM
:
301 V_I4(&zoomVariant
) = 100;
303 case wxWEB_VIEW_ZOOM_LARGE
:
304 V_I4(&zoomVariant
) = 130;
306 case wxWEB_VIEW_ZOOM_LARGEST
:
307 V_I4(&zoomVariant
) = 160;
316 m_webBrowser
->ExecWB((OLECMDID
)63 /*OLECMDID_OPTICAL_ZOOM*/,
317 OLECMDEXECOPT_DODEFAULT
,
320 wxASSERT(result
== S_OK
);
323 wxWebViewZoom
wxWebViewIE::GetIEOpticalZoom() const
326 VariantInit (&zoomVariant
);
327 V_VT(&zoomVariant
) = VT_I4
;
332 m_webBrowser
->ExecWB((OLECMDID
)63 /*OLECMDID_OPTICAL_ZOOM*/,
333 OLECMDEXECOPT_DODEFAULT
, NULL
,
335 wxASSERT(result
== S_OK
);
337 const int zoom
= V_I4(&zoomVariant
);
339 //We make a somewhat arbitray map here, taken from values used by webkit
342 return wxWEB_VIEW_ZOOM_TINY
;
344 else if (zoom
> 65 && zoom
<= 90)
346 return wxWEB_VIEW_ZOOM_SMALL
;
348 else if (zoom
> 90 && zoom
<= 115)
350 return wxWEB_VIEW_ZOOM_MEDIUM
;
352 else if (zoom
> 115 && zoom
<= 145)
354 return wxWEB_VIEW_ZOOM_LARGE
;
356 else /*if (zoom > 145) */ //Using else removes a compiler warning
358 return wxWEB_VIEW_ZOOM_LARGEST
;
362 void wxWebViewIE::SetZoomType(wxWebViewZoomType type
)
367 wxWebViewZoomType
wxWebViewIE::GetZoomType() const
372 bool wxWebViewIE::CanSetZoomType(wxWebViewZoomType type
) const
374 //IE 6 and below only support text zoom, so check the registry to see what
375 //version we actually have
376 wxRegKey
key(wxRegKey::HKLM
, "Software\\Microsoft\\Internet Explorer");
378 key
.QueryValue("Version", value
);
380 long version
= wxAtoi(value
.Left(1));
381 if(version
<= 6 && type
== wxWEB_VIEW_ZOOM_TYPE_LAYOUT
)
387 void wxWebViewIE::Print()
389 m_webBrowser
->ExecWB(OLECMDID_PRINTPREVIEW
,
390 OLECMDEXECOPT_DODEFAULT
, NULL
, NULL
);
393 bool wxWebViewIE::CanGoBack() const
396 return m_historyPosition
> 0;
401 bool wxWebViewIE::CanGoForward() const
404 return m_historyPosition
!= static_cast<int>(m_historyList
.size()) - 1;
409 void wxWebViewIE::LoadHistoryItem(wxSharedPtr
<wxWebViewHistoryItem
> item
)
412 for(unsigned int i
= 0; i
< m_historyList
.size(); i
++)
414 //We compare the actual pointers to find the correct item
415 if(m_historyList
[i
].get() == item
.get())
418 wxASSERT_MSG(pos
!= static_cast<int>(m_historyList
.size()),
419 "invalid history item");
420 m_historyLoadingFromList
= true;
421 LoadURL(item
->GetUrl());
422 m_historyPosition
= pos
;
425 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > wxWebViewIE::GetBackwardHistory()
427 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > backhist
;
428 //As we don't have std::copy or an iterator constructor in the wxwidgets
429 //native vector we construct it by hand
430 for(int i
= 0; i
< m_historyPosition
; i
++)
432 backhist
.push_back(m_historyList
[i
]);
437 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > wxWebViewIE::GetForwardHistory()
439 wxVector
<wxSharedPtr
<wxWebViewHistoryItem
> > forwardhist
;
440 //As we don't have std::copy or an iterator constructor in the wxwidgets
441 //native vector we construct it by hand
442 for(int i
= m_historyPosition
+ 1; i
< static_cast<int>(m_historyList
.size()); i
++)
444 forwardhist
.push_back(m_historyList
[i
]);
449 void wxWebViewIE::GoBack()
451 LoadHistoryItem(m_historyList
[m_historyPosition
- 1]);
454 void wxWebViewIE::GoForward()
456 LoadHistoryItem(m_historyList
[m_historyPosition
+ 1]);
459 void wxWebViewIE::Stop()
461 m_ie
.CallMethod("Stop");
464 void wxWebViewIE::ClearHistory()
466 m_historyList
.clear();
467 m_historyPosition
= -1;
470 void wxWebViewIE::EnableHistory(bool enable
)
472 m_historyEnabled
= enable
;
473 m_historyList
.clear();
474 m_historyPosition
= -1;
477 void wxWebViewIE::Reload(wxWebViewReloadFlags flags
)
481 V_VT(&level
) = VT_I2
;
485 case wxWEB_VIEW_RELOAD_DEFAULT
:
486 V_I2(&level
) = REFRESH_NORMAL
;
488 case wxWEB_VIEW_RELOAD_NO_CACHE
:
489 V_I2(&level
) = REFRESH_COMPLETELY
;
492 wxFAIL_MSG("Unexpected reload type");
495 m_webBrowser
->Refresh2(&level
);
498 bool wxWebViewIE::IsOfflineMode()
500 wxVariant out
= m_ie
.GetProperty("Offline");
502 wxASSERT(out
.GetType() == "bool");
504 return out
.GetBool();
507 void wxWebViewIE::SetOfflineMode(bool offline
)
509 // FIXME: the wxWidgets docs do not really document what the return
510 // parameter of PutProperty is
514 m_ie
.PutProperty("Offline", (offline
?
520 bool wxWebViewIE::IsBusy() const
522 if (m_isBusy
) return true;
524 wxVariant out
= m_ie
.GetProperty("Busy");
526 wxASSERT(out
.GetType() == "bool");
528 return out
.GetBool();
531 wxString
wxWebViewIE::GetCurrentURL() const
533 wxVariant out
= m_ie
.GetProperty("LocationURL");
535 wxASSERT(out
.GetType() == "string");
536 return out
.GetString();
539 wxString
wxWebViewIE::GetCurrentTitle() const
541 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
546 document
->get_nameProp(&title
);
547 return wxString(title
);
555 bool wxWebViewIE::CanCut() const
557 return CanExecCommand("Cut");
560 bool wxWebViewIE::CanCopy() const
562 return CanExecCommand("Copy");
565 bool wxWebViewIE::CanPaste() const
567 return CanExecCommand("Paste");
570 void wxWebViewIE::Cut()
575 void wxWebViewIE::Copy()
580 void wxWebViewIE::Paste()
582 ExecCommand("Paste");
585 bool wxWebViewIE::CanUndo() const
587 return CanExecCommand("Undo");
590 bool wxWebViewIE::CanRedo() const
592 return CanExecCommand("Redo");
595 void wxWebViewIE::Undo()
600 void wxWebViewIE::Redo()
605 long wxWebViewIE::Find(const wxString
& text
, int flags
)
607 //If the text is empty then we clear.
611 if(m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
613 FindInternal(m_findText
, (m_findFlags
&~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
);
618 //Have we done this search before?
619 if(m_findText
== text
)
621 //Just do a highlight?
622 if((flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
) != (m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
))
625 if(!m_findPointers
.empty())
627 FindInternal(m_findText
, m_findFlags
, ((flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
) == 0 ? wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
: 0));
629 return m_findPosition
;
631 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
)))
634 return FindNext(((flags
& wxWEB_VIEW_FIND_BACKWARDS
) ? -1 : 1));
637 //Remove old highlight if any.
638 if(m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
640 FindInternal(m_findText
, (m_findFlags
&~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
);
642 //Reset find variables.
647 //find the text and return count.
648 FindInternal(text
, flags
, wxWEB_VIEW_FIND_ADD_POINTERS
);
649 return m_findPointers
.empty() ? wxNOT_FOUND
: m_findPointers
.size();
652 void wxWebViewIE::SetEditable(bool enable
)
654 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
659 document
->put_designMode(SysAllocString(L
"On"));
661 document
->put_designMode(SysAllocString(L
"Off"));
666 bool wxWebViewIE::IsEditable() const
668 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
673 document
->get_designMode(&mode
);
674 if(wxString(mode
) == "On")
685 void wxWebViewIE::SelectAll()
687 ExecCommand("SelectAll");
690 bool wxWebViewIE::HasSelection() const
692 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
696 wxCOMPtr
<IHTMLSelectionObject
> selection
;
698 HRESULT hr
= document
->get_selection(&selection
);
702 selection
->get_type(&type
);
703 sel
= wxString(type
);
705 return sel
!= "None";
713 void wxWebViewIE::DeleteSelection()
715 ExecCommand("Delete");
718 wxString
wxWebViewIE::GetSelectedText() const
720 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
724 wxCOMPtr
<IHTMLSelectionObject
> selection
;
726 HRESULT hr
= document
->get_selection(&selection
);
729 wxCOMPtr
<IDispatch
> disrange
;
730 hr
= selection
->createRange(&disrange
);
733 wxCOMPtr
<IHTMLTxtRange
> range
;
734 hr
= disrange
->QueryInterface(IID_IHTMLTxtRange
, (void**)&range
);
738 range
->get_text(&text
);
739 selected
= wxString(text
);
751 wxString
wxWebViewIE::GetSelectedSource() const
753 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
757 wxCOMPtr
<IHTMLSelectionObject
> selection
;
759 HRESULT hr
= document
->get_selection(&selection
);
762 wxCOMPtr
<IDispatch
> disrange
;
763 hr
= selection
->createRange(&disrange
);
766 wxCOMPtr
<IHTMLTxtRange
> range
;
767 hr
= disrange
->QueryInterface(IID_IHTMLTxtRange
, (void**)&range
);
771 range
->get_htmlText(&text
);
772 selected
= wxString(text
);
784 void wxWebViewIE::ClearSelection()
786 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
790 wxCOMPtr
<IHTMLSelectionObject
> selection
;
792 HRESULT hr
= document
->get_selection(&selection
);
800 wxString
wxWebViewIE::GetPageText() const
802 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
807 wxCOMPtr
<IHTMLElement
> body
;
808 HRESULT hr
= document
->get_body(&body
);
812 body
->get_innerText(&out
);
813 text
= wxString(out
);
823 void wxWebViewIE::RunScript(const wxString
& javascript
)
825 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
829 wxCOMPtr
<IHTMLWindow2
> window
;
830 wxString language
= "javascript";
831 HRESULT hr
= document
->get_parentWindow(&window
);
836 V_VT(&level
) = VT_EMPTY
;
837 window
->execScript(SysAllocString(javascript
.wc_str()),
838 SysAllocString(language
.wc_str()),
844 void wxWebViewIE::RegisterHandler(wxSharedPtr
<wxWebViewHandler
> handler
)
846 wxDynamicLibrary
urlMon(wxT("urlmon.dll"));
847 if(urlMon
.HasSymbol(wxT("CoInternetGetSession")))
849 typedef HRESULT (WINAPI
*CoInternetGetSession_t
)(DWORD
, wxIInternetSession
**, DWORD
);
850 wxDYNLIB_FUNCTION(CoInternetGetSession_t
, CoInternetGetSession
, urlMon
);
852 ClassFactory
* cf
= new ClassFactory(handler
);
853 wxIInternetSession
* session
;
854 HRESULT res
= (*pfnCoInternetGetSession
)(0, &session
, 0);
857 wxFAIL_MSG("Could not retrive internet session");
860 HRESULT hr
= session
->RegisterNameSpace(cf
, CLSID_FileProtocol
,
861 handler
->GetName().wc_str(),
865 wxFAIL_MSG("Could not register protocol");
867 m_factories
.push_back(cf
);
871 wxFAIL_MSG("urlmon does not contain CoInternetGetSession");
875 bool wxWebViewIE::CanExecCommand(wxString command
) const
877 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
881 VARIANT_BOOL enabled
;
883 document
->queryCommandEnabled(SysAllocString(command
.wc_str()), &enabled
);
885 return (enabled
== VARIANT_TRUE
);
894 void wxWebViewIE::ExecCommand(wxString command
)
896 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
900 document
->execCommand(SysAllocString(command
.wc_str()), VARIANT_FALSE
, VARIANT(), NULL
);
904 wxCOMPtr
<IHTMLDocument2
> wxWebViewIE::GetDocument() const
906 wxCOMPtr
<IDispatch
> dispatch
;
907 wxCOMPtr
<IHTMLDocument2
> document
;
908 HRESULT result
= m_webBrowser
->get_Document(&dispatch
);
909 if(dispatch
&& SUCCEEDED(result
))
911 //document is set to null automatically if the interface isn't supported
912 dispatch
->QueryInterface(IID_IHTMLDocument2
, (void**)&document
);
917 bool wxWebViewIE::IsElementVisible(IHTMLElement
* elm
)
919 wxIHTMLCurrentStyle
* style
;
920 IHTMLElement
*elm1
= elm
;
921 wxIHTMLElement2
*elm2
;
923 bool is_visible
= true;
924 //This method is not perfect but it does discover most of the hidden elements.
925 //so if a better solution is found, then please do improve.
928 if(SUCCEEDED(elm1
->QueryInterface(wxIID_IHTMLElement2
, (void**) &elm2
)))
930 if(SUCCEEDED(elm2
->get_currentStyle(&style
)))
932 //Check if the object has the style display:none.
933 if((style
->get_display(&tmp_bstr
) != S_OK
) ||
934 (tmp_bstr
!= NULL
&& (_wcsicmp(tmp_bstr
, L
"none") == 0)))
938 //Check if the object has the style visibility:hidden.
939 if(is_visible
&& (style
->get_visibility(&tmp_bstr
) != S_OK
) ||
940 (tmp_bstr
!= NULL
&& _wcsicmp(tmp_bstr
, L
"hidden") == 0))
949 //Lets check the object's parent element.
950 IHTMLElement
* parent
;
951 if(is_visible
&& SUCCEEDED(elm1
->get_parentElement(&parent
)))
965 void wxWebViewIE::FindInternal(const wxString
& text
, int flags
, int internal_flag
)
967 wxIMarkupServices
*pIMS
;
968 wxIMarkupContainer
*pIMC
;
969 wxIMarkupPointer
*ptrBegin
, *ptrEnd
;
972 IHTMLDocument2
*document
= GetDocument();
973 //This function does the acutal work.
974 if(SUCCEEDED(document
->QueryInterface(wxIID_IMarkupServices
, (void **)&pIMS
)))
976 if(SUCCEEDED(document
->QueryInterface(wxIID_IMarkupContainer
, (void **)&pIMC
)))
978 BSTR attr_bstr
= SysAllocString(L
"style=\"background-color:#ffff00\"");
979 BSTR text_bstr
= SysAllocString(text
.wc_str());
980 pIMS
->CreateMarkupPointer(&ptrBegin
);
981 pIMS
->CreateMarkupPointer(&ptrEnd
);
983 ptrBegin
->SetGravity(POINTER_GRAVITY_Right
);
984 ptrBegin
->MoveToContainer(pIMC
, TRUE
);
985 //Create the find flag from the wx one.
986 if(flags
& wxWEB_VIEW_FIND_ENTIRE_WORD
)
988 find_flag
|= FINDTEXT_WHOLEWORD
;
990 if(flags
& wxWEB_VIEW_FIND_MATCH_CASE
)
992 find_flag
|= FINDTEXT_MATCHCASE
;
995 //A little speed-up to avoid to re-alloc in the positions vector.
996 if(text
.Len() < 3 && m_findPointers
.capacity() < 500)
998 m_findPointers
.reserve(text
.Len() == 1 ? 1000 : 500);
1001 while(ptrBegin
->FindText(text_bstr
, find_flag
, ptrEnd
, NULL
) == S_OK
)
1003 if(ptrBegin
->CurrentScope(&elm
) == S_OK
)
1005 if(IsElementVisible(elm
))
1007 //Highlight the word if the flag was set.
1008 if(flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
1010 IHTMLElement
* pFontEl
;
1011 pIMS
->CreateElement(TAGID_FONT
, attr_bstr
, &pFontEl
);
1012 pIMS
->InsertElement(pFontEl
, ptrBegin
, ptrEnd
);
1014 if(internal_flag
& wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
)
1016 IHTMLElement
* pFontEl
;
1017 ptrBegin
->CurrentScope(&pFontEl
);
1018 pIMS
->RemoveElement(pFontEl
);
1021 if(internal_flag
& wxWEB_VIEW_FIND_ADD_POINTERS
)
1023 wxIMarkupPointer
*cptrBegin
, *cptrEnd
;
1024 pIMS
->CreateMarkupPointer(&cptrBegin
);
1025 pIMS
->CreateMarkupPointer(&cptrEnd
);
1026 cptrBegin
->MoveToPointer(ptrBegin
);
1027 cptrEnd
->MoveToPointer(ptrEnd
);
1028 m_findPointers
.push_back(wxFindPointers(cptrBegin
,cptrEnd
));
1033 ptrBegin
->MoveToPointer(ptrEnd
);
1036 SysFreeString(text_bstr
);
1037 SysFreeString(attr_bstr
);
1039 ptrBegin
->Release();
1044 document
->Release();
1047 long wxWebViewIE::FindNext(int direction
)
1049 //Don't bother if we have no pointers set.
1050 if(m_findPointers
.empty())
1054 //Manage the find position and do some checks.
1064 if(m_findPosition
>= (signed)m_findPointers
.size())
1066 if(m_findFlags
& wxWEB_VIEW_FIND_WRAP
)
1076 else if(m_findPosition
< 0)
1078 if(m_findFlags
& wxWEB_VIEW_FIND_WRAP
)
1080 m_findPosition
= m_findPointers
.size()-1;
1088 //some variables to use later on.
1089 IHTMLElement
*body_element
;
1090 IHTMLBodyElement
*body
;
1091 wxIHTMLTxtRange
*range
= NULL
;
1092 wxIMarkupServices
*pIMS
;
1093 IHTMLDocument2
*document
= GetDocument();
1095 //Now try to create a range from the body.
1096 if(SUCCEEDED(document
->get_body(&body_element
)))
1098 if(SUCCEEDED(body_element
->QueryInterface(IID_IHTMLBodyElement
,(void**)&body
)))
1100 if(SUCCEEDED(body
->createTextRange((IHTMLTxtRange
**)(&range
))))
1102 //So far so good, now we try to position our find pointers.
1103 if(SUCCEEDED(document
->QueryInterface(wxIID_IMarkupServices
,(void **)&pIMS
)))
1105 wxIMarkupPointer
*begin
= m_findPointers
[m_findPosition
].begin
, *end
= m_findPointers
[m_findPosition
].end
;
1106 if(pIMS
->MoveRangeToPointers(begin
,end
,range
) == S_OK
&& range
->select() == S_OK
)
1108 ret
= m_findPosition
;
1116 body_element
->Release();
1118 document
->Release();
1122 void wxWebViewIE::FindClear()
1124 //Reset find variables.
1126 m_findFlags
= wxWEB_VIEW_FIND_DEFAULT
;
1127 m_findPosition
= -1;
1129 //The m_findPointers contains pointers for the found text.
1130 //Since it uses ref counting we call release on the pointers first
1131 //before we remove them from the vector. In other words do not just
1132 //remove elements from m_findPointers without calling release first
1133 //or you will get a memory leak.
1134 size_t count
= m_findPointers
.size();
1135 for(size_t i
= 0; i
< count
; i
++)
1137 m_findPointers
[i
].begin
->Release();
1138 m_findPointers
[i
].end
->Release();
1140 m_findPointers
.clear();
1143 bool wxWebViewIE::EnableControlFeature(long flag
, bool enable
)
1145 #if wxUSE_DYNLIB_CLASS
1147 wxDynamicLibrary
urlMon(wxT("urlmon.dll"));
1148 if( urlMon
.IsLoaded() &&
1149 urlMon
.HasSymbol("CoInternetSetFeatureEnabled") &&
1150 urlMon
.HasSymbol("CoInternetIsFeatureEnabled"))
1152 typedef HRESULT (WINAPI
*CoInternetSetFeatureEnabled_t
)(DWORD
, DWORD
, BOOL
);
1153 typedef HRESULT (WINAPI
*CoInternetIsFeatureEnabled_t
)(DWORD
, DWORD
);
1155 wxDYNLIB_FUNCTION(CoInternetSetFeatureEnabled_t
, CoInternetSetFeatureEnabled
, urlMon
);
1156 wxDYNLIB_FUNCTION(CoInternetIsFeatureEnabled_t
, CoInternetIsFeatureEnabled
, urlMon
);
1158 HRESULT hr
= (*pfnCoInternetIsFeatureEnabled
)(flag
,
1159 0x2 /* SET_FEATURE_ON_PROCESS */);
1160 if((hr
== S_OK
&& enable
) || (hr
== S_FALSE
&& !enable
))
1163 hr
= (*pfnCoInternetSetFeatureEnabled
)(flag
,
1164 0x2/* SET_FEATURE_ON_PROCESS */,
1165 (enable
? TRUE
: FALSE
));
1168 wxLogApiError(wxT("CoInternetSetFeatureEnabled"), hr
);
1176 wxUnusedVar(enable
);
1178 #endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
1181 void wxWebViewIE::onActiveXEvent(wxActiveXEvent
& evt
)
1183 if (m_webBrowser
== NULL
) return;
1185 switch (evt
.GetDispatchId())
1187 case DISPID_BEFORENAVIGATE2
:
1191 wxString url
= evt
[1].GetString();
1192 wxString target
= evt
[3].GetString();
1194 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING
,
1195 GetId(), url
, target
);
1197 //skip empty javascript events.
1198 if(url
== "javascript:\"\"" && target
.IsEmpty())
1204 event
.SetEventObject(this);
1205 HandleWindowEvent(event
);
1208 if (!event
.IsAllowed())
1210 wxActiveXEventNativeMSW
* nativeParams
=
1211 evt
.GetNativeParameters();
1212 *V_BOOLREF(&nativeParams
->pDispParams
->rgvarg
[0]) = VARIANT_TRUE
;
1215 // at this point, either the navigation event has been cancelled
1216 // and we're not busy, either it was accepted and IWebBrowser2's
1217 // Busy property will be true; so we don't need our override
1224 case DISPID_NAVIGATECOMPLETE2
:
1226 wxString url
= evt
[1].GetString();
1227 // TODO: set target parameter if possible
1228 wxString target
= wxEmptyString
;
1229 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED
,
1230 GetId(), url
, target
);
1231 event
.SetEventObject(this);
1232 HandleWindowEvent(event
);
1236 case DISPID_PROGRESSCHANGE
:
1238 // download progress
1242 case DISPID_DOCUMENTCOMPLETE
:
1244 //Only send a complete even if we are actually finished, this brings
1245 //the event in to line with webkit
1247 m_webBrowser
->get_ReadyState( &rs
);
1248 if(rs
!= READYSTATE_COMPLETE
)
1251 wxString url
= evt
[1].GetString();
1253 //As we are complete we also add to the history list, but not if the
1254 //page is not the main page, ie it is a subframe
1255 //We also have to check if we are loading a file:// url, if so we
1256 //need to change the comparison as ie passes back a different style
1258 if(m_historyEnabled
&& !m_historyLoadingFromList
&&
1259 (url
== GetCurrentURL() ||
1260 (GetCurrentURL().substr(0, 4) == "file" &&
1261 wxFileSystem::URLToFileName(GetCurrentURL()).GetFullPath() == url
)))
1263 //If we are not at the end of the list, then erase everything
1264 //between us and the end before adding the new page
1265 if(m_historyPosition
!= static_cast<int>(m_historyList
.size()) - 1)
1267 m_historyList
.erase(m_historyList
.begin() + m_historyPosition
+ 1,
1268 m_historyList
.end());
1270 wxSharedPtr
<wxWebViewHistoryItem
> item(new wxWebViewHistoryItem(url
, GetCurrentTitle()));
1271 m_historyList
.push_back(item
);
1272 m_historyPosition
++;
1274 //Reset as we are done now
1275 m_historyLoadingFromList
= false;
1276 //Reset the find values.
1278 // TODO: set target parameter if possible
1279 wxString target
= wxEmptyString
;
1280 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_LOADED
, GetId(),
1282 event
.SetEventObject(this);
1283 HandleWindowEvent(event
);
1287 case DISPID_STATUSTEXTCHANGE
:
1292 case DISPID_TITLECHANGE
:
1294 wxString title
= evt
[0].GetString();
1296 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED
,
1297 GetId(), GetCurrentURL(), "");
1298 event
.SetString(title
);
1299 event
.SetEventObject(this);
1300 HandleWindowEvent(event
);
1304 case DISPID_NAVIGATEERROR
:
1306 wxWebViewNavigationError errorType
= wxWEB_NAV_ERR_OTHER
;
1307 wxString errorCode
= "?";
1308 switch (evt
[3].GetLong())
1310 case INET_E_INVALID_URL
: // (0x800C0002L or -2146697214)
1311 errorCode
= "INET_E_INVALID_URL";
1312 errorType
= wxWEB_NAV_ERR_REQUEST
;
1314 case INET_E_NO_SESSION
: // (0x800C0003L or -2146697213)
1315 errorCode
= "INET_E_NO_SESSION";
1316 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1318 case INET_E_CANNOT_CONNECT
: // (0x800C0004L or -2146697212)
1319 errorCode
= "INET_E_CANNOT_CONNECT";
1320 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1322 case INET_E_RESOURCE_NOT_FOUND
: // (0x800C0005L or -2146697211)
1323 errorCode
= "INET_E_RESOURCE_NOT_FOUND";
1324 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1326 case INET_E_OBJECT_NOT_FOUND
: // (0x800C0006L or -2146697210)
1327 errorCode
= "INET_E_OBJECT_NOT_FOUND";
1328 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1330 case INET_E_DATA_NOT_AVAILABLE
: // (0x800C0007L or -2146697209)
1331 errorCode
= "INET_E_DATA_NOT_AVAILABLE";
1332 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1334 case INET_E_DOWNLOAD_FAILURE
: // (0x800C0008L or -2146697208)
1335 errorCode
= "INET_E_DOWNLOAD_FAILURE";
1336 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1338 case INET_E_AUTHENTICATION_REQUIRED
: // (0x800C0009L or -2146697207)
1339 errorCode
= "INET_E_AUTHENTICATION_REQUIRED";
1340 errorType
= wxWEB_NAV_ERR_AUTH
;
1342 case INET_E_NO_VALID_MEDIA
: // (0x800C000AL or -2146697206)
1343 errorCode
= "INET_E_NO_VALID_MEDIA";
1344 errorType
= wxWEB_NAV_ERR_REQUEST
;
1346 case INET_E_CONNECTION_TIMEOUT
: // (0x800C000BL or -2146697205)
1347 errorCode
= "INET_E_CONNECTION_TIMEOUT";
1348 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1350 case INET_E_INVALID_REQUEST
: // (0x800C000CL or -2146697204)
1351 errorCode
= "INET_E_INVALID_REQUEST";
1352 errorType
= wxWEB_NAV_ERR_REQUEST
;
1354 case INET_E_UNKNOWN_PROTOCOL
: // (0x800C000DL or -2146697203)
1355 errorCode
= "INET_E_UNKNOWN_PROTOCOL";
1356 errorType
= wxWEB_NAV_ERR_REQUEST
;
1358 case INET_E_SECURITY_PROBLEM
: // (0x800C000EL or -2146697202)
1359 errorCode
= "INET_E_SECURITY_PROBLEM";
1360 errorType
= wxWEB_NAV_ERR_SECURITY
;
1362 case INET_E_CANNOT_LOAD_DATA
: // (0x800C000FL or -2146697201)
1363 errorCode
= "INET_E_CANNOT_LOAD_DATA";
1364 errorType
= wxWEB_NAV_ERR_OTHER
;
1366 case INET_E_CANNOT_INSTANTIATE_OBJECT
:
1367 // CoCreateInstance will return an error code if this happens,
1368 // we'll handle this above.
1371 case INET_E_REDIRECT_FAILED
: // (0x800C0014L or -2146697196)
1372 errorCode
= "INET_E_REDIRECT_FAILED";
1373 errorType
= wxWEB_NAV_ERR_OTHER
;
1375 case INET_E_REDIRECT_TO_DIR
: // (0x800C0015L or -2146697195)
1376 errorCode
= "INET_E_REDIRECT_TO_DIR";
1377 errorType
= wxWEB_NAV_ERR_REQUEST
;
1379 case INET_E_CANNOT_LOCK_REQUEST
: // (0x800C0016L or -2146697194)
1380 errorCode
= "INET_E_CANNOT_LOCK_REQUEST";
1381 errorType
= wxWEB_NAV_ERR_OTHER
;
1383 case INET_E_USE_EXTEND_BINDING
: // (0x800C0017L or -2146697193)
1384 errorCode
= "INET_E_USE_EXTEND_BINDING";
1385 errorType
= wxWEB_NAV_ERR_OTHER
;
1387 case INET_E_TERMINATED_BIND
: // (0x800C0018L or -2146697192)
1388 errorCode
= "INET_E_TERMINATED_BIND";
1389 errorType
= wxWEB_NAV_ERR_OTHER
;
1391 case INET_E_INVALID_CERTIFICATE
: // (0x800C0019L or -2146697191)
1392 errorCode
= "INET_E_INVALID_CERTIFICATE";
1393 errorType
= wxWEB_NAV_ERR_CERTIFICATE
;
1395 case INET_E_CODE_DOWNLOAD_DECLINED
: // (0x800C0100L or -2146696960)
1396 errorCode
= "INET_E_CODE_DOWNLOAD_DECLINED";
1397 errorType
= wxWEB_NAV_ERR_USER_CANCELLED
;
1399 case INET_E_RESULT_DISPATCHED
: // (0x800C0200L or -2146696704)
1400 // cancel request cancelled...
1401 errorCode
= "INET_E_RESULT_DISPATCHED";
1402 errorType
= wxWEB_NAV_ERR_OTHER
;
1404 case INET_E_CANNOT_REPLACE_SFP_FILE
: // (0x800C0300L or -2146696448)
1405 errorCode
= "INET_E_CANNOT_REPLACE_SFP_FILE";
1406 errorType
= wxWEB_NAV_ERR_SECURITY
;
1408 case INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY
:
1409 errorCode
= "INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY";
1410 errorType
= wxWEB_NAV_ERR_SECURITY
;
1412 case INET_E_CODE_INSTALL_SUPPRESSED
:
1413 errorCode
= "INET_E_CODE_INSTALL_SUPPRESSED";
1414 errorType
= wxWEB_NAV_ERR_SECURITY
;
1418 wxString url
= evt
[1].GetString();
1419 wxString target
= evt
[2].GetString();
1420 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_ERROR
, GetId(),
1422 event
.SetEventObject(this);
1423 event
.SetInt(errorType
);
1424 event
.SetString(errorCode
);
1425 HandleWindowEvent(event
);
1428 case DISPID_NEWWINDOW3
:
1430 wxString url
= evt
[4].GetString();
1432 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW
,
1433 GetId(), url
, wxEmptyString
);
1434 event
.SetEventObject(this);
1435 HandleWindowEvent(event
);
1437 //We always cancel this event otherwise an Internet Exporer window
1438 //is opened for the url
1439 wxActiveXEventNativeMSW
* nativeParams
= evt
.GetNativeParameters();
1440 *V_BOOLREF(&nativeParams
->pDispParams
->rgvarg
[3]) = VARIANT_TRUE
;
1448 VirtualProtocol::VirtualProtocol(wxSharedPtr
<wxWebViewHandler
> handler
)
1451 m_handler
= handler
;
1454 BEGIN_IID_TABLE(VirtualProtocol
)
1456 ADD_RAW_IID(wxIID_IInternetProtocolRoot
)
1457 ADD_RAW_IID(wxIID_IInternetProtocol
)
1460 IMPLEMENT_IUNKNOWN_METHODS(VirtualProtocol
)
1462 HRESULT STDMETHODCALLTYPE
VirtualProtocol::Start(LPCWSTR szUrl
, wxIInternetProtocolSink
*pOIProtSink
,
1463 wxIInternetBindInfo
*pOIBindInfo
, DWORD grfPI
,
1464 HANDLE_PTR dwReserved
)
1467 wxUnusedVar(pOIBindInfo
);
1469 wxUnusedVar(dwReserved
);
1470 m_protocolSink
= pOIProtSink
;
1472 //We get the file itself from the protocol handler
1473 m_file
= m_handler
->GetFile(szUrl
);
1477 return INET_E_RESOURCE_NOT_FOUND
;
1479 //We return the stream length for current and total size as we can always
1480 //read the whole file from the stream
1481 wxFileOffset length
= m_file
->GetStream()->GetLength();
1482 m_protocolSink
->ReportData(wxBSCF_FIRSTDATANOTIFICATION
|
1483 wxBSCF_DATAFULLYAVAILABLE
|
1484 wxBSCF_LASTDATANOTIFICATION
,
1489 HRESULT STDMETHODCALLTYPE
VirtualProtocol::Read(void *pv
, ULONG cb
, ULONG
*pcbRead
)
1491 //If the file is null we return false to indicte it is finished
1495 wxStreamError err
= m_file
->GetStream()->Read(pv
, cb
).GetLastError();
1496 *pcbRead
= m_file
->GetStream()->LastRead();
1498 if(err
== wxSTREAM_NO_ERROR
)
1503 m_protocolSink
->ReportResult(S_OK
, 0, NULL
);
1505 //As we are not eof there is more data
1508 else if(err
== wxSTREAM_EOF
)
1511 m_protocolSink
->ReportResult(S_OK
, 0, NULL
);
1512 //We are eof and so finished
1515 else if(err
== wxSTREAM_READ_ERROR
)
1518 return INET_E_DOWNLOAD_FAILURE
;
1522 //Dummy return to surpress a compiler warning
1524 return INET_E_DOWNLOAD_FAILURE
;
1528 BEGIN_IID_TABLE(ClassFactory
)
1530 ADD_IID(ClassFactory
)
1533 IMPLEMENT_IUNKNOWN_METHODS(ClassFactory
)
1535 HRESULT STDMETHODCALLTYPE
ClassFactory::CreateInstance(IUnknown
* pUnkOuter
, REFIID riid
,
1539 return CLASS_E_NOAGGREGATION
;
1540 VirtualProtocol
* vp
= new VirtualProtocol(m_handler
);
1542 HRESULT hr
= vp
->QueryInterface(riid
, ppvObject
);
1548 STDMETHODIMP
ClassFactory::LockServer(BOOL fLock
)
1554 wxIEContainer::wxIEContainer(wxWindow
*parent
, REFIID iid
, IUnknown
*pUnk
,
1555 DocHostUIHandler
* uiHandler
) :
1556 wxActiveXContainer(parent
,iid
,pUnk
)
1558 m_uiHandler
= uiHandler
;
1561 wxIEContainer::~wxIEContainer()
1565 bool wxIEContainer::QueryClientSiteInterface(REFIID iid
, void **_interface
,
1568 if (m_uiHandler
&& IsEqualIID(iid
, wxIID_IDocHostUIHandler
))
1570 *_interface
= (IUnknown
*) (wxIDocHostUIHandler
*) m_uiHandler
;
1571 desc
= "IDocHostUIHandler";
1577 HRESULT wxSTDCALL
DocHostUIHandler::ShowContextMenu(DWORD dwID
, POINT
*ppt
,
1578 IUnknown
*pcmdtReserved
,
1579 IDispatch
*pdispReserved
)
1583 wxUnusedVar(pcmdtReserved
);
1584 wxUnusedVar(pdispReserved
);
1588 HRESULT wxSTDCALL
DocHostUIHandler::GetHostInfo(DOCHOSTUIINFO
*pInfo
)
1590 //don't show 3d border and enable themes.
1591 pInfo
->dwFlags
= pInfo
->dwFlags
| DOCHOSTUIFLAG_NO3DBORDER
| DOCHOSTUIFLAG_THEME
;
1595 HRESULT wxSTDCALL
DocHostUIHandler::ShowUI(DWORD dwID
,
1596 IOleInPlaceActiveObject
*pActiveObject
,
1597 IOleCommandTarget
*pCommandTarget
,
1598 IOleInPlaceFrame
*pFrame
,
1599 IOleInPlaceUIWindow
*pDoc
)
1602 wxUnusedVar(pActiveObject
);
1603 wxUnusedVar(pCommandTarget
);
1604 wxUnusedVar(pFrame
);
1609 HRESULT wxSTDCALL
DocHostUIHandler::HideUI(void)
1614 HRESULT wxSTDCALL
DocHostUIHandler::UpdateUI(void)
1619 HRESULT wxSTDCALL
DocHostUIHandler::EnableModeless(BOOL fEnable
)
1621 wxUnusedVar(fEnable
);
1625 HRESULT wxSTDCALL
DocHostUIHandler::OnDocWindowActivate(BOOL fActivate
)
1627 wxUnusedVar(fActivate
);
1631 HRESULT wxSTDCALL
DocHostUIHandler::OnFrameWindowActivate(BOOL fActivate
)
1633 wxUnusedVar(fActivate
);
1637 HRESULT wxSTDCALL
DocHostUIHandler::ResizeBorder(LPCRECT prcBorder
,
1638 IOleInPlaceUIWindow
*pUIWindow
,
1641 wxUnusedVar(prcBorder
);
1642 wxUnusedVar(pUIWindow
);
1643 wxUnusedVar(fFrameWindow
);
1647 HRESULT wxSTDCALL
DocHostUIHandler::TranslateAccelerator(LPMSG lpMsg
,
1648 const GUID
*pguidCmdGroup
,
1651 if(lpMsg
&& lpMsg
->message
== WM_KEYDOWN
)
1654 if((GetKeyState(VK_CONTROL
) & 0x8000 ))
1656 //skip the accelerators used by the control
1657 switch(lpMsg
->wParam
)
1668 if(lpMsg
->wParam
== VK_F5
)
1674 wxUnusedVar(pguidCmdGroup
);
1675 wxUnusedVar(nCmdID
);
1679 HRESULT wxSTDCALL
DocHostUIHandler::GetOptionKeyPath(LPOLESTR
*pchKey
,DWORD dw
)
1681 wxUnusedVar(pchKey
);
1686 HRESULT wxSTDCALL
DocHostUIHandler::GetDropTarget(IDropTarget
*pDropTarget
,
1687 IDropTarget
**ppDropTarget
)
1689 wxUnusedVar(pDropTarget
);
1690 wxUnusedVar(ppDropTarget
);
1694 HRESULT wxSTDCALL
DocHostUIHandler::GetExternal(IDispatch
**ppDispatch
)
1696 wxUnusedVar(ppDispatch
);
1700 HRESULT wxSTDCALL
DocHostUIHandler::TranslateUrl(DWORD dwTranslate
,
1702 OLECHAR
**ppchURLOut
)
1704 wxUnusedVar(dwTranslate
);
1705 wxUnusedVar(pchURLIn
);
1706 wxUnusedVar(ppchURLOut
);
1710 HRESULT wxSTDCALL
DocHostUIHandler::FilterDataObject(IDataObject
*pDO
, IDataObject
**ppDORet
)
1713 wxUnusedVar(ppDORet
);
1717 BEGIN_IID_TABLE(DocHostUIHandler
)
1719 ADD_RAW_IID(wxIID_IDocHostUIHandler
)
1722 IMPLEMENT_IUNKNOWN_METHODS(DocHostUIHandler
)
1724 #endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE