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 !defined(__MINGW32__) && !defined(__VISUALC6__)
605 //If the text is empty then we clear.
609 if(m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
611 FindInternal(m_findText
, (m_findFlags
&~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
);
616 //Have we done this search before?
617 if(m_findText
== text
)
619 //Just do a highlight?
620 if((flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
) != (m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
))
623 if(!m_findPointers
.empty())
625 FindInternal(m_findText
, m_findFlags
, ((flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
) == 0 ? wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
: 0));
627 return m_findPosition
;
629 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
)))
632 return FindNext(((flags
& wxWEB_VIEW_FIND_BACKWARDS
) ? -1 : 1));
635 //Remove old highlight if any.
636 if(m_findFlags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
638 FindInternal(m_findText
, (m_findFlags
&~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
);
640 //Reset find variables.
645 //find the text and return count.
646 FindInternal(text
, flags
, wxWEB_VIEW_FIND_ADD_POINTERS
);
647 return m_findPointers
.empty() ? wxNOT_FOUND
: m_findPointers
.size();
653 void wxWebViewIE::SetEditable(bool enable
)
655 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
660 document
->put_designMode(SysAllocString(L
"On"));
662 document
->put_designMode(SysAllocString(L
"Off"));
667 bool wxWebViewIE::IsEditable() const
669 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
674 document
->get_designMode(&mode
);
675 if(wxString(mode
) == "On")
686 void wxWebViewIE::SelectAll()
688 ExecCommand("SelectAll");
691 bool wxWebViewIE::HasSelection() const
693 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
697 wxCOMPtr
<IHTMLSelectionObject
> selection
;
699 HRESULT hr
= document
->get_selection(&selection
);
703 selection
->get_type(&type
);
704 sel
= wxString(type
);
706 return sel
!= "None";
714 void wxWebViewIE::DeleteSelection()
716 ExecCommand("Delete");
719 wxString
wxWebViewIE::GetSelectedText() const
721 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
725 wxCOMPtr
<IHTMLSelectionObject
> selection
;
727 HRESULT hr
= document
->get_selection(&selection
);
730 wxCOMPtr
<IDispatch
> disrange
;
731 hr
= selection
->createRange(&disrange
);
734 wxCOMPtr
<IHTMLTxtRange
> range
;
735 hr
= disrange
->QueryInterface(IID_IHTMLTxtRange
, (void**)&range
);
739 range
->get_text(&text
);
740 selected
= wxString(text
);
752 wxString
wxWebViewIE::GetSelectedSource() const
754 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
758 wxCOMPtr
<IHTMLSelectionObject
> selection
;
760 HRESULT hr
= document
->get_selection(&selection
);
763 wxCOMPtr
<IDispatch
> disrange
;
764 hr
= selection
->createRange(&disrange
);
767 wxCOMPtr
<IHTMLTxtRange
> range
;
768 hr
= disrange
->QueryInterface(IID_IHTMLTxtRange
, (void**)&range
);
772 range
->get_htmlText(&text
);
773 selected
= wxString(text
);
785 void wxWebViewIE::ClearSelection()
787 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
791 wxCOMPtr
<IHTMLSelectionObject
> selection
;
793 HRESULT hr
= document
->get_selection(&selection
);
801 wxString
wxWebViewIE::GetPageText() const
803 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
808 wxCOMPtr
<IHTMLElement
> body
;
809 HRESULT hr
= document
->get_body(&body
);
813 body
->get_innerText(&out
);
814 text
= wxString(out
);
824 void wxWebViewIE::RunScript(const wxString
& javascript
)
826 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
830 wxCOMPtr
<IHTMLWindow2
> window
;
831 wxString language
= "javascript";
832 HRESULT hr
= document
->get_parentWindow(&window
);
837 V_VT(&level
) = VT_EMPTY
;
838 window
->execScript(SysAllocString(javascript
.wc_str()),
839 SysAllocString(language
.wc_str()),
845 void wxWebViewIE::RegisterHandler(wxSharedPtr
<wxWebViewHandler
> handler
)
847 wxDynamicLibrary
urlMon(wxT("urlmon.dll"));
848 if(urlMon
.HasSymbol(wxT("CoInternetGetSession")))
850 typedef HRESULT (WINAPI
*CoInternetGetSession_t
)(DWORD
, wxIInternetSession
**, DWORD
);
851 wxDYNLIB_FUNCTION(CoInternetGetSession_t
, CoInternetGetSession
, urlMon
);
853 ClassFactory
* cf
= new ClassFactory(handler
);
854 wxIInternetSession
* session
;
855 HRESULT res
= (*pfnCoInternetGetSession
)(0, &session
, 0);
858 wxFAIL_MSG("Could not retrive internet session");
861 HRESULT hr
= session
->RegisterNameSpace(cf
, CLSID_FileProtocol
,
862 handler
->GetName().wc_str(),
866 wxFAIL_MSG("Could not register protocol");
868 m_factories
.push_back(cf
);
872 wxFAIL_MSG("urlmon does not contain CoInternetGetSession");
876 bool wxWebViewIE::CanExecCommand(wxString command
) const
878 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
882 VARIANT_BOOL enabled
;
884 document
->queryCommandEnabled(SysAllocString(command
.wc_str()), &enabled
);
886 return (enabled
== VARIANT_TRUE
);
895 void wxWebViewIE::ExecCommand(wxString command
)
897 wxCOMPtr
<IHTMLDocument2
> document(GetDocument());
901 document
->execCommand(SysAllocString(command
.wc_str()), VARIANT_FALSE
, VARIANT(), NULL
);
905 wxCOMPtr
<IHTMLDocument2
> wxWebViewIE::GetDocument() const
907 wxCOMPtr
<IDispatch
> dispatch
;
908 wxCOMPtr
<IHTMLDocument2
> document
;
909 HRESULT result
= m_webBrowser
->get_Document(&dispatch
);
910 if(dispatch
&& SUCCEEDED(result
))
912 //document is set to null automatically if the interface isn't supported
913 dispatch
->QueryInterface(IID_IHTMLDocument2
, (void**)&document
);
918 bool wxWebViewIE::IsElementVisible(IHTMLElement
* elm
)
920 #if !defined(__MINGW32__) && !defined(__VISUALC6__)
921 IHTMLCurrentStyle
* style
;
922 IHTMLElement
*elm1
= elm
;
925 bool is_visible
= true;
926 //This method is not perfect but it does discover most of the hidden elements.
927 //so if a better solution is found, then please do improve.
930 if(SUCCEEDED(elm1
->QueryInterface(IID_IHTMLElement2
, (void**) &elm2
)))
932 if(SUCCEEDED(elm2
->get_currentStyle(&style
)))
934 //Check if the object has the style display:none.
935 if((style
->get_display(&tmp_bstr
) != S_OK
) ||
936 (tmp_bstr
!= NULL
&& (_wcsicmp(tmp_bstr
, L
"none") == 0)))
940 //Check if the object has the style visibility:hidden.
941 if(is_visible
&& (style
->get_visibility(&tmp_bstr
) != S_OK
) ||
942 (tmp_bstr
!= NULL
&& _wcsicmp(tmp_bstr
, L
"hidden") == 0))
951 //Lets check the object's parent element.
952 IHTMLElement
* parent
;
953 if(is_visible
&& SUCCEEDED(elm1
->get_parentElement(&parent
)))
970 void wxWebViewIE::FindInternal(const wxString
& text
, int flags
, int internal_flag
)
972 #if !defined(__MINGW32__) && !defined(__VISUALC6__)
973 IMarkupServices
*pIMS
;
974 IMarkupContainer
*pIMC
;
975 IMarkupPointer
*ptrBegin
, *ptrEnd
;
978 IHTMLDocument2
*document
= GetDocument();
979 //This function does the acutal work.
980 if(SUCCEEDED(document
->QueryInterface(IID_IMarkupServices
, (void **)&pIMS
)))
982 if(SUCCEEDED(document
->QueryInterface(IID_IMarkupContainer
, (void **)&pIMC
)))
984 BSTR attr_bstr
= SysAllocString(L
"style=\"background-color:#ffff00\"");
985 BSTR text_bstr
= SysAllocString(text
.wc_str());
986 pIMS
->CreateMarkupPointer(&ptrBegin
);
987 pIMS
->CreateMarkupPointer(&ptrEnd
);
989 ptrBegin
->SetGravity(POINTER_GRAVITY_Right
);
990 ptrBegin
->MoveToContainer(pIMC
, TRUE
);
991 //Create the find flag from the wx one.
992 if(flags
& wxWEB_VIEW_FIND_ENTIRE_WORD
)
994 find_flag
|= FINDTEXT_WHOLEWORD
;
996 if(flags
& wxWEB_VIEW_FIND_MATCH_CASE
)
998 find_flag
|= FINDTEXT_MATCHCASE
;
1001 //A little speed-up to avoid to re-alloc in the positions vector.
1002 if(text
.Len() < 3 && m_findPointers
.capacity() < 500)
1004 m_findPointers
.reserve(text
.Len() == 1 ? 1000 : 500);
1007 while(ptrBegin
->FindText(text_bstr
, find_flag
, ptrEnd
, NULL
) == S_OK
)
1009 if(ptrBegin
->CurrentScope(&elm
) == S_OK
)
1011 if(IsElementVisible(elm
))
1013 //Highlight the word if the flag was set.
1014 if(flags
& wxWEB_VIEW_FIND_HIGHLIGHT_RESULT
)
1016 IHTMLElement
* pFontEl
;
1017 pIMS
->CreateElement(TAGID_FONT
, attr_bstr
, &pFontEl
);
1018 pIMS
->InsertElement(pFontEl
, ptrBegin
, ptrEnd
);
1020 if(internal_flag
& wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT
)
1022 IHTMLElement
* pFontEl
;
1023 ptrBegin
->CurrentScope(&pFontEl
);
1024 pIMS
->RemoveElement(pFontEl
);
1027 if(internal_flag
& wxWEB_VIEW_FIND_ADD_POINTERS
)
1029 IMarkupPointer
*cptrBegin
, *cptrEnd
;
1030 pIMS
->CreateMarkupPointer(&cptrBegin
);
1031 pIMS
->CreateMarkupPointer(&cptrEnd
);
1032 cptrBegin
->MoveToPointer(ptrBegin
);
1033 cptrEnd
->MoveToPointer(ptrEnd
);
1034 m_findPointers
.push_back(wxFindPointers(cptrBegin
,cptrEnd
));
1039 ptrBegin
->MoveToPointer(ptrEnd
);
1042 SysFreeString(text_bstr
);
1043 SysFreeString(attr_bstr
);
1045 ptrBegin
->Release();
1050 document
->Release();
1054 long wxWebViewIE::FindNext(int direction
)
1056 #if !defined(__MINGW32__) && !defined(__VISUALC6__)
1057 //Don't bother if we have no pointers set.
1058 if(m_findPointers
.empty())
1062 //Manage the find position and do some checks.
1072 if(m_findPosition
>= (signed)m_findPointers
.size())
1074 if(m_findFlags
& wxWEB_VIEW_FIND_WRAP
)
1084 else if(m_findPosition
< 0)
1086 if(m_findFlags
& wxWEB_VIEW_FIND_WRAP
)
1088 m_findPosition
= m_findPointers
.size()-1;
1096 //some variables to use later on.
1097 IHTMLElement
*body_element
;
1098 IHTMLBodyElement
*body
;
1099 IHTMLTxtRange
*range
= NULL
;
1100 IMarkupServices
*pIMS
;
1101 IHTMLDocument2
*document
= GetDocument();
1103 //Now try to create a range from the body.
1104 if(SUCCEEDED(document
->get_body(&body_element
)))
1106 if(SUCCEEDED(body_element
->QueryInterface(IID_IHTMLBodyElement
,(void**)&body
)))
1108 if(SUCCEEDED(body
->createTextRange(&range
)))
1110 //So far so good, now we try to position our find pointers.
1111 if(SUCCEEDED(document
->QueryInterface(IID_IMarkupServices
,(void **)&pIMS
)))
1113 IMarkupPointer
*begin
= m_findPointers
[m_findPosition
].begin
, *end
= m_findPointers
[m_findPosition
].end
;
1114 if(pIMS
->MoveRangeToPointers(begin
,end
,range
) == S_OK
&& range
->select() == S_OK
)
1116 ret
= m_findPosition
;
1124 body_element
->Release();
1126 document
->Release();
1133 void wxWebViewIE::FindClear()
1135 #if !defined(__MINGW32__) && !defined(__VISUALC6__)
1136 //Reset find variables.
1138 m_findFlags
= wxWEB_VIEW_FIND_DEFAULT
;
1139 m_findPosition
= -1;
1141 //The m_findPointers contains pointers for the found text.
1142 //Since it uses ref counting we call release on the pointers first
1143 //before we remove them from the vector. In other words do not just
1144 //remove elements from m_findPointers without calling release first
1145 //or you will get a memory leak.
1146 size_t count
= m_findPointers
.size();
1147 for(size_t i
= 0; i
< count
; i
++)
1149 m_findPointers
[i
].begin
->Release();
1150 m_findPointers
[i
].end
->Release();
1152 m_findPointers
.clear();
1156 bool wxWebViewIE::EnableControlFeature(long flag
, bool enable
)
1158 #if wxUSE_DYNLIB_CLASS
1160 wxDynamicLibrary
urlMon(wxT("urlmon.dll"));
1161 if( urlMon
.IsLoaded() &&
1162 urlMon
.HasSymbol("CoInternetSetFeatureEnabled") &&
1163 urlMon
.HasSymbol("CoInternetIsFeatureEnabled"))
1165 typedef HRESULT (WINAPI
*CoInternetSetFeatureEnabled_t
)(DWORD
, DWORD
, BOOL
);
1166 typedef HRESULT (WINAPI
*CoInternetIsFeatureEnabled_t
)(DWORD
, DWORD
);
1168 wxDYNLIB_FUNCTION(CoInternetSetFeatureEnabled_t
, CoInternetSetFeatureEnabled
, urlMon
);
1169 wxDYNLIB_FUNCTION(CoInternetIsFeatureEnabled_t
, CoInternetIsFeatureEnabled
, urlMon
);
1171 HRESULT hr
= (*pfnCoInternetIsFeatureEnabled
)(flag
,
1172 0x2 /* SET_FEATURE_ON_PROCESS */);
1173 if((hr
== S_OK
&& enable
) || (hr
== S_FALSE
&& !enable
))
1176 hr
= (*pfnCoInternetSetFeatureEnabled
)(flag
,
1177 0x2/* SET_FEATURE_ON_PROCESS */,
1178 (enable
? TRUE
: FALSE
));
1181 wxLogApiError(wxT("CoInternetSetFeatureEnabled"), hr
);
1189 wxUnusedVar(enable
);
1191 #endif // wxUSE_DYNLIB_CLASS/!wxUSE_DYNLIB_CLASS
1194 void wxWebViewIE::onActiveXEvent(wxActiveXEvent
& evt
)
1196 if (m_webBrowser
== NULL
) return;
1198 switch (evt
.GetDispatchId())
1200 case DISPID_BEFORENAVIGATE2
:
1204 wxString url
= evt
[1].GetString();
1205 wxString target
= evt
[3].GetString();
1207 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATING
,
1208 GetId(), url
, target
);
1210 //skip empty javascript events.
1211 if(url
== "javascript:\"\"" && target
.IsEmpty())
1217 event
.SetEventObject(this);
1218 HandleWindowEvent(event
);
1221 if (!event
.IsAllowed())
1223 wxActiveXEventNativeMSW
* nativeParams
=
1224 evt
.GetNativeParameters();
1225 *V_BOOLREF(&nativeParams
->pDispParams
->rgvarg
[0]) = VARIANT_TRUE
;
1228 // at this point, either the navigation event has been cancelled
1229 // and we're not busy, either it was accepted and IWebBrowser2's
1230 // Busy property will be true; so we don't need our override
1237 case DISPID_NAVIGATECOMPLETE2
:
1239 wxString url
= evt
[1].GetString();
1240 // TODO: set target parameter if possible
1241 wxString target
= wxEmptyString
;
1242 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NAVIGATED
,
1243 GetId(), url
, target
);
1244 event
.SetEventObject(this);
1245 HandleWindowEvent(event
);
1249 case DISPID_PROGRESSCHANGE
:
1251 // download progress
1255 case DISPID_DOCUMENTCOMPLETE
:
1257 //Only send a complete even if we are actually finished, this brings
1258 //the event in to line with webkit
1260 m_webBrowser
->get_ReadyState( &rs
);
1261 if(rs
!= READYSTATE_COMPLETE
)
1264 wxString url
= evt
[1].GetString();
1266 //As we are complete we also add to the history list, but not if the
1267 //page is not the main page, ie it is a subframe
1268 //We also have to check if we are loading a file:// url, if so we
1269 //need to change the comparison as ie passes back a different style
1271 if(m_historyEnabled
&& !m_historyLoadingFromList
&&
1272 (url
== GetCurrentURL() ||
1273 (GetCurrentURL().substr(0, 4) == "file" &&
1274 wxFileSystem::URLToFileName(GetCurrentURL()).GetFullPath() == url
)))
1276 //If we are not at the end of the list, then erase everything
1277 //between us and the end before adding the new page
1278 if(m_historyPosition
!= static_cast<int>(m_historyList
.size()) - 1)
1280 m_historyList
.erase(m_historyList
.begin() + m_historyPosition
+ 1,
1281 m_historyList
.end());
1283 wxSharedPtr
<wxWebViewHistoryItem
> item(new wxWebViewHistoryItem(url
, GetCurrentTitle()));
1284 m_historyList
.push_back(item
);
1285 m_historyPosition
++;
1287 //Reset as we are done now
1288 m_historyLoadingFromList
= false;
1289 //Reset the find values.
1291 // TODO: set target parameter if possible
1292 wxString target
= wxEmptyString
;
1293 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_LOADED
, GetId(),
1295 event
.SetEventObject(this);
1296 HandleWindowEvent(event
);
1300 case DISPID_STATUSTEXTCHANGE
:
1305 case DISPID_TITLECHANGE
:
1307 wxString title
= evt
[0].GetString();
1309 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_TITLE_CHANGED
,
1310 GetId(), GetCurrentURL(), "");
1311 event
.SetString(title
);
1312 event
.SetEventObject(this);
1313 HandleWindowEvent(event
);
1317 case DISPID_NAVIGATEERROR
:
1319 wxWebViewNavigationError errorType
= wxWEB_NAV_ERR_OTHER
;
1320 wxString errorCode
= "?";
1321 switch (evt
[3].GetLong())
1323 case INET_E_INVALID_URL
: // (0x800C0002L or -2146697214)
1324 errorCode
= "INET_E_INVALID_URL";
1325 errorType
= wxWEB_NAV_ERR_REQUEST
;
1327 case INET_E_NO_SESSION
: // (0x800C0003L or -2146697213)
1328 errorCode
= "INET_E_NO_SESSION";
1329 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1331 case INET_E_CANNOT_CONNECT
: // (0x800C0004L or -2146697212)
1332 errorCode
= "INET_E_CANNOT_CONNECT";
1333 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1335 case INET_E_RESOURCE_NOT_FOUND
: // (0x800C0005L or -2146697211)
1336 errorCode
= "INET_E_RESOURCE_NOT_FOUND";
1337 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1339 case INET_E_OBJECT_NOT_FOUND
: // (0x800C0006L or -2146697210)
1340 errorCode
= "INET_E_OBJECT_NOT_FOUND";
1341 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1343 case INET_E_DATA_NOT_AVAILABLE
: // (0x800C0007L or -2146697209)
1344 errorCode
= "INET_E_DATA_NOT_AVAILABLE";
1345 errorType
= wxWEB_NAV_ERR_NOT_FOUND
;
1347 case INET_E_DOWNLOAD_FAILURE
: // (0x800C0008L or -2146697208)
1348 errorCode
= "INET_E_DOWNLOAD_FAILURE";
1349 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1351 case INET_E_AUTHENTICATION_REQUIRED
: // (0x800C0009L or -2146697207)
1352 errorCode
= "INET_E_AUTHENTICATION_REQUIRED";
1353 errorType
= wxWEB_NAV_ERR_AUTH
;
1355 case INET_E_NO_VALID_MEDIA
: // (0x800C000AL or -2146697206)
1356 errorCode
= "INET_E_NO_VALID_MEDIA";
1357 errorType
= wxWEB_NAV_ERR_REQUEST
;
1359 case INET_E_CONNECTION_TIMEOUT
: // (0x800C000BL or -2146697205)
1360 errorCode
= "INET_E_CONNECTION_TIMEOUT";
1361 errorType
= wxWEB_NAV_ERR_CONNECTION
;
1363 case INET_E_INVALID_REQUEST
: // (0x800C000CL or -2146697204)
1364 errorCode
= "INET_E_INVALID_REQUEST";
1365 errorType
= wxWEB_NAV_ERR_REQUEST
;
1367 case INET_E_UNKNOWN_PROTOCOL
: // (0x800C000DL or -2146697203)
1368 errorCode
= "INET_E_UNKNOWN_PROTOCOL";
1369 errorType
= wxWEB_NAV_ERR_REQUEST
;
1371 case INET_E_SECURITY_PROBLEM
: // (0x800C000EL or -2146697202)
1372 errorCode
= "INET_E_SECURITY_PROBLEM";
1373 errorType
= wxWEB_NAV_ERR_SECURITY
;
1375 case INET_E_CANNOT_LOAD_DATA
: // (0x800C000FL or -2146697201)
1376 errorCode
= "INET_E_CANNOT_LOAD_DATA";
1377 errorType
= wxWEB_NAV_ERR_OTHER
;
1379 case INET_E_CANNOT_INSTANTIATE_OBJECT
:
1380 // CoCreateInstance will return an error code if this happens,
1381 // we'll handle this above.
1384 case INET_E_REDIRECT_FAILED
: // (0x800C0014L or -2146697196)
1385 errorCode
= "INET_E_REDIRECT_FAILED";
1386 errorType
= wxWEB_NAV_ERR_OTHER
;
1388 case INET_E_REDIRECT_TO_DIR
: // (0x800C0015L or -2146697195)
1389 errorCode
= "INET_E_REDIRECT_TO_DIR";
1390 errorType
= wxWEB_NAV_ERR_REQUEST
;
1392 case INET_E_CANNOT_LOCK_REQUEST
: // (0x800C0016L or -2146697194)
1393 errorCode
= "INET_E_CANNOT_LOCK_REQUEST";
1394 errorType
= wxWEB_NAV_ERR_OTHER
;
1396 case INET_E_USE_EXTEND_BINDING
: // (0x800C0017L or -2146697193)
1397 errorCode
= "INET_E_USE_EXTEND_BINDING";
1398 errorType
= wxWEB_NAV_ERR_OTHER
;
1400 case INET_E_TERMINATED_BIND
: // (0x800C0018L or -2146697192)
1401 errorCode
= "INET_E_TERMINATED_BIND";
1402 errorType
= wxWEB_NAV_ERR_OTHER
;
1404 case INET_E_INVALID_CERTIFICATE
: // (0x800C0019L or -2146697191)
1405 errorCode
= "INET_E_INVALID_CERTIFICATE";
1406 errorType
= wxWEB_NAV_ERR_CERTIFICATE
;
1408 case INET_E_CODE_DOWNLOAD_DECLINED
: // (0x800C0100L or -2146696960)
1409 errorCode
= "INET_E_CODE_DOWNLOAD_DECLINED";
1410 errorType
= wxWEB_NAV_ERR_USER_CANCELLED
;
1412 case INET_E_RESULT_DISPATCHED
: // (0x800C0200L or -2146696704)
1413 // cancel request cancelled...
1414 errorCode
= "INET_E_RESULT_DISPATCHED";
1415 errorType
= wxWEB_NAV_ERR_OTHER
;
1417 case INET_E_CANNOT_REPLACE_SFP_FILE
: // (0x800C0300L or -2146696448)
1418 errorCode
= "INET_E_CANNOT_REPLACE_SFP_FILE";
1419 errorType
= wxWEB_NAV_ERR_SECURITY
;
1421 case INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY
:
1422 errorCode
= "INET_E_CODE_INSTALL_BLOCKED_BY_HASH_POLICY";
1423 errorType
= wxWEB_NAV_ERR_SECURITY
;
1425 case INET_E_CODE_INSTALL_SUPPRESSED
:
1426 errorCode
= "INET_E_CODE_INSTALL_SUPPRESSED";
1427 errorType
= wxWEB_NAV_ERR_SECURITY
;
1431 wxString url
= evt
[1].GetString();
1432 wxString target
= evt
[2].GetString();
1433 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_ERROR
, GetId(),
1435 event
.SetEventObject(this);
1436 event
.SetInt(errorType
);
1437 event
.SetString(errorCode
);
1438 HandleWindowEvent(event
);
1441 case DISPID_NEWWINDOW3
:
1443 wxString url
= evt
[4].GetString();
1445 wxWebViewEvent
event(wxEVT_COMMAND_WEB_VIEW_NEWWINDOW
,
1446 GetId(), url
, wxEmptyString
);
1447 event
.SetEventObject(this);
1448 HandleWindowEvent(event
);
1450 //We always cancel this event otherwise an Internet Exporer window
1451 //is opened for the url
1452 wxActiveXEventNativeMSW
* nativeParams
= evt
.GetNativeParameters();
1453 *V_BOOLREF(&nativeParams
->pDispParams
->rgvarg
[3]) = VARIANT_TRUE
;
1461 VirtualProtocol::VirtualProtocol(wxSharedPtr
<wxWebViewHandler
> handler
)
1464 m_handler
= handler
;
1467 BEGIN_IID_TABLE(VirtualProtocol
)
1469 ADD_RAW_IID(wxIID_IInternetProtocolRoot
)
1470 ADD_RAW_IID(wxIID_IInternetProtocol
)
1473 IMPLEMENT_IUNKNOWN_METHODS(VirtualProtocol
)
1475 HRESULT STDMETHODCALLTYPE
VirtualProtocol::Start(LPCWSTR szUrl
, wxIInternetProtocolSink
*pOIProtSink
,
1476 wxIInternetBindInfo
*pOIBindInfo
, DWORD grfPI
,
1477 HANDLE_PTR dwReserved
)
1480 wxUnusedVar(pOIBindInfo
);
1482 wxUnusedVar(dwReserved
);
1483 m_protocolSink
= pOIProtSink
;
1485 //We get the file itself from the protocol handler
1486 m_file
= m_handler
->GetFile(szUrl
);
1490 return INET_E_RESOURCE_NOT_FOUND
;
1492 //We return the stream length for current and total size as we can always
1493 //read the whole file from the stream
1494 wxFileOffset length
= m_file
->GetStream()->GetLength();
1495 m_protocolSink
->ReportData(wxBSCF_FIRSTDATANOTIFICATION
|
1496 wxBSCF_DATAFULLYAVAILABLE
|
1497 wxBSCF_LASTDATANOTIFICATION
,
1502 HRESULT STDMETHODCALLTYPE
VirtualProtocol::Read(void *pv
, ULONG cb
, ULONG
*pcbRead
)
1504 //If the file is null we return false to indicte it is finished
1508 wxStreamError err
= m_file
->GetStream()->Read(pv
, cb
).GetLastError();
1509 *pcbRead
= m_file
->GetStream()->LastRead();
1511 if(err
== wxSTREAM_NO_ERROR
)
1516 m_protocolSink
->ReportResult(S_OK
, 0, NULL
);
1518 //As we are not eof there is more data
1521 else if(err
== wxSTREAM_EOF
)
1524 m_protocolSink
->ReportResult(S_OK
, 0, NULL
);
1525 //We are eof and so finished
1528 else if(err
== wxSTREAM_READ_ERROR
)
1531 return INET_E_DOWNLOAD_FAILURE
;
1535 //Dummy return to surpress a compiler warning
1537 return INET_E_DOWNLOAD_FAILURE
;
1541 BEGIN_IID_TABLE(ClassFactory
)
1543 ADD_IID(ClassFactory
)
1546 IMPLEMENT_IUNKNOWN_METHODS(ClassFactory
)
1548 HRESULT STDMETHODCALLTYPE
ClassFactory::CreateInstance(IUnknown
* pUnkOuter
, REFIID riid
,
1552 return CLASS_E_NOAGGREGATION
;
1553 VirtualProtocol
* vp
= new VirtualProtocol(m_handler
);
1555 HRESULT hr
= vp
->QueryInterface(riid
, ppvObject
);
1561 STDMETHODIMP
ClassFactory::LockServer(BOOL fLock
)
1567 wxIEContainer::wxIEContainer(wxWindow
*parent
, REFIID iid
, IUnknown
*pUnk
,
1568 DocHostUIHandler
* uiHandler
) :
1569 wxActiveXContainer(parent
,iid
,pUnk
)
1571 m_uiHandler
= uiHandler
;
1574 wxIEContainer::~wxIEContainer()
1578 bool wxIEContainer::QueryClientSiteInterface(REFIID iid
, void **_interface
,
1581 if (m_uiHandler
&& IsEqualIID(iid
, wxIID_IDocHostUIHandler
))
1583 *_interface
= (IUnknown
*) (wxIDocHostUIHandler
*) m_uiHandler
;
1584 desc
= "IDocHostUIHandler";
1590 HRESULT wxSTDCALL
DocHostUIHandler::ShowContextMenu(DWORD dwID
, POINT
*ppt
,
1591 IUnknown
*pcmdtReserved
,
1592 IDispatch
*pdispReserved
)
1596 wxUnusedVar(pcmdtReserved
);
1597 wxUnusedVar(pdispReserved
);
1601 HRESULT wxSTDCALL
DocHostUIHandler::GetHostInfo(DOCHOSTUIINFO
*pInfo
)
1603 //don't show 3d border and enable themes.
1604 pInfo
->dwFlags
= pInfo
->dwFlags
| DOCHOSTUIFLAG_NO3DBORDER
| DOCHOSTUIFLAG_THEME
;
1608 HRESULT wxSTDCALL
DocHostUIHandler::ShowUI(DWORD dwID
,
1609 IOleInPlaceActiveObject
*pActiveObject
,
1610 IOleCommandTarget
*pCommandTarget
,
1611 IOleInPlaceFrame
*pFrame
,
1612 IOleInPlaceUIWindow
*pDoc
)
1615 wxUnusedVar(pActiveObject
);
1616 wxUnusedVar(pCommandTarget
);
1617 wxUnusedVar(pFrame
);
1622 HRESULT wxSTDCALL
DocHostUIHandler::HideUI(void)
1627 HRESULT wxSTDCALL
DocHostUIHandler::UpdateUI(void)
1632 HRESULT wxSTDCALL
DocHostUIHandler::EnableModeless(BOOL fEnable
)
1634 wxUnusedVar(fEnable
);
1638 HRESULT wxSTDCALL
DocHostUIHandler::OnDocWindowActivate(BOOL fActivate
)
1640 wxUnusedVar(fActivate
);
1644 HRESULT wxSTDCALL
DocHostUIHandler::OnFrameWindowActivate(BOOL fActivate
)
1646 wxUnusedVar(fActivate
);
1650 HRESULT wxSTDCALL
DocHostUIHandler::ResizeBorder(LPCRECT prcBorder
,
1651 IOleInPlaceUIWindow
*pUIWindow
,
1654 wxUnusedVar(prcBorder
);
1655 wxUnusedVar(pUIWindow
);
1656 wxUnusedVar(fFrameWindow
);
1660 HRESULT wxSTDCALL
DocHostUIHandler::TranslateAccelerator(LPMSG lpMsg
,
1661 const GUID
*pguidCmdGroup
,
1664 if(lpMsg
&& lpMsg
->message
== WM_KEYDOWN
)
1667 if((GetKeyState(VK_CONTROL
) & 0x8000 ))
1669 //skip the accelerators used by the control
1670 switch(lpMsg
->wParam
)
1681 if(lpMsg
->wParam
== VK_F5
)
1687 wxUnusedVar(pguidCmdGroup
);
1688 wxUnusedVar(nCmdID
);
1692 HRESULT wxSTDCALL
DocHostUIHandler::GetOptionKeyPath(LPOLESTR
*pchKey
,DWORD dw
)
1694 wxUnusedVar(pchKey
);
1699 HRESULT wxSTDCALL
DocHostUIHandler::GetDropTarget(IDropTarget
*pDropTarget
,
1700 IDropTarget
**ppDropTarget
)
1702 wxUnusedVar(pDropTarget
);
1703 wxUnusedVar(ppDropTarget
);
1707 HRESULT wxSTDCALL
DocHostUIHandler::GetExternal(IDispatch
**ppDispatch
)
1709 wxUnusedVar(ppDispatch
);
1713 HRESULT wxSTDCALL
DocHostUIHandler::TranslateUrl(DWORD dwTranslate
,
1715 OLECHAR
**ppchURLOut
)
1717 wxUnusedVar(dwTranslate
);
1718 wxUnusedVar(pchURLIn
);
1719 wxUnusedVar(ppchURLOut
);
1723 HRESULT wxSTDCALL
DocHostUIHandler::FilterDataObject(IDataObject
*pDO
, IDataObject
**ppDORet
)
1726 wxUnusedVar(ppDORet
);
1730 BEGIN_IID_TABLE(DocHostUIHandler
)
1732 ADD_RAW_IID(wxIID_IDocHostUIHandler
)
1735 IMPLEMENT_IUNKNOWN_METHODS(DocHostUIHandler
)
1737 #endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_IE