+ if (m_isBusy) return true;
+
+ wxVariant out = m_ie.GetProperty("Busy");
+
+ wxASSERT(out.GetType() == "bool");
+
+ return out.GetBool();
+}
+
+wxString wxWebViewIE::GetCurrentURL() const
+{
+ wxVariant out = m_ie.GetProperty("LocationURL");
+
+ wxASSERT(out.GetType() == "string");
+ return out.GetString();
+}
+
+wxString wxWebViewIE::GetCurrentTitle() const
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ BSTR title;
+ document->get_nameProp(&title);
+ return wxString(title);
+ }
+ else
+ {
+ return "";
+ }
+}
+
+bool wxWebViewIE::CanCut() const
+{
+ return CanExecCommand("Cut");
+}
+
+bool wxWebViewIE::CanCopy() const
+{
+ return CanExecCommand("Copy");
+}
+
+bool wxWebViewIE::CanPaste() const
+{
+ return CanExecCommand("Paste");
+}
+
+void wxWebViewIE::Cut()
+{
+ ExecCommand("Cut");
+}
+
+void wxWebViewIE::Copy()
+{
+ ExecCommand("Copy");
+}
+
+void wxWebViewIE::Paste()
+{
+ ExecCommand("Paste");
+}
+
+bool wxWebViewIE::CanUndo() const
+{
+ return CanExecCommand("Undo");
+}
+
+bool wxWebViewIE::CanRedo() const
+{
+ return CanExecCommand("Redo");
+}
+
+void wxWebViewIE::Undo()
+{
+ ExecCommand("Undo");
+}
+
+void wxWebViewIE::Redo()
+{
+ ExecCommand("Redo");
+}
+
+long wxWebViewIE::Find(const wxString& text, int flags)
+{
+ //If the text is empty then we clear.
+ if(text.IsEmpty())
+ {
+ ClearSelection();
+ if(m_findFlags & wxWEB_VIEW_FIND_HIGHLIGHT_RESULT)
+ {
+ FindInternal(m_findText, (m_findFlags &~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT);
+ }
+ FindClear();
+ return wxNOT_FOUND;
+ }
+ //Have we done this search before?
+ if(m_findText == text)
+ {
+ //Just do a highlight?
+ if((flags & wxWEB_VIEW_FIND_HIGHLIGHT_RESULT) != (m_findFlags & wxWEB_VIEW_FIND_HIGHLIGHT_RESULT))
+ {
+ m_findFlags = flags;
+ if(!m_findPointers.empty())
+ {
+ FindInternal(m_findText, m_findFlags, ((flags & wxWEB_VIEW_FIND_HIGHLIGHT_RESULT) == 0 ? wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT : 0));
+ }
+ return m_findPosition;
+ }
+ 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)))
+ {
+ m_findFlags = flags;
+ return FindNext(((flags & wxWEB_VIEW_FIND_BACKWARDS) ? -1 : 1));
+ }
+ }
+ //Remove old highlight if any.
+ if(m_findFlags & wxWEB_VIEW_FIND_HIGHLIGHT_RESULT)
+ {
+ FindInternal(m_findText, (m_findFlags &~ wxWEB_VIEW_FIND_HIGHLIGHT_RESULT), wxWEB_VIEW_FIND_REMOVE_HIGHLIGHT);
+ }
+ //Reset find variables.
+ FindClear();
+ ClearSelection();
+ m_findText = text;
+ m_findFlags = flags;
+ //find the text and return count.
+ FindInternal(text, flags, wxWEB_VIEW_FIND_ADD_POINTERS);
+ return m_findPointers.empty() ? wxNOT_FOUND : m_findPointers.size();
+}
+
+void wxWebViewIE::SetEditable(bool enable)
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ if( enable )
+ document->put_designMode(SysAllocString(L"On"));
+ else
+ document->put_designMode(SysAllocString(L"Off"));
+
+ }
+}
+
+bool wxWebViewIE::IsEditable() const
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ BSTR mode;
+ document->get_designMode(&mode);
+ if(wxString(mode) == "On")
+ return true;
+ else
+ return false;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void wxWebViewIE::SelectAll()
+{
+ ExecCommand("SelectAll");
+}
+
+bool wxWebViewIE::HasSelection() const
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ wxCOMPtr<IHTMLSelectionObject> selection;
+ wxString sel;
+ HRESULT hr = document->get_selection(&selection);
+ if(SUCCEEDED(hr))
+ {
+ BSTR type;
+ selection->get_type(&type);
+ sel = wxString(type);
+ }
+ return sel != "None";
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void wxWebViewIE::DeleteSelection()
+{
+ ExecCommand("Delete");
+}
+
+wxString wxWebViewIE::GetSelectedText() const
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ wxCOMPtr<IHTMLSelectionObject> selection;
+ wxString selected;
+ HRESULT hr = document->get_selection(&selection);
+ if(SUCCEEDED(hr))
+ {
+ wxCOMPtr<IDispatch> disrange;
+ hr = selection->createRange(&disrange);
+ if(SUCCEEDED(hr))
+ {
+ wxCOMPtr<IHTMLTxtRange> range;
+ hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
+ if(SUCCEEDED(hr))
+ {
+ BSTR text;
+ range->get_text(&text);
+ selected = wxString(text);
+ }
+ }
+ }
+ return selected;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+wxString wxWebViewIE::GetSelectedSource() const
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ wxCOMPtr<IHTMLSelectionObject> selection;
+ wxString selected;
+ HRESULT hr = document->get_selection(&selection);
+ if(SUCCEEDED(hr))
+ {
+ wxCOMPtr<IDispatch> disrange;
+ hr = selection->createRange(&disrange);
+ if(SUCCEEDED(hr))
+ {
+ wxCOMPtr<IHTMLTxtRange> range;
+ hr = disrange->QueryInterface(IID_IHTMLTxtRange, (void**)&range);
+ if(SUCCEEDED(hr))
+ {
+ BSTR text;
+ range->get_htmlText(&text);
+ selected = wxString(text);
+ }
+ }
+ }
+ return selected;
+ }
+ else
+ {
+ return "";
+ }
+}
+
+void wxWebViewIE::ClearSelection()
+{
+ wxCOMPtr<IHTMLDocument2> document(GetDocument());
+
+ if(document)
+ {
+ wxCOMPtr<IHTMLSelectionObject> selection;
+ wxString selected;
+ HRESULT hr = document->get_selection(&selection);
+ if(SUCCEEDED(hr))
+ {
+ selection->empty();
+ }
+ }