+ m_zoomType = type;
+}
+
+wxWebViewZoomType wxWebViewIE::GetZoomType() const
+{
+ return m_zoomType;
+}
+
+bool wxWebViewIE::CanSetZoomType(wxWebViewZoomType type) const
+{
+ //IE 6 and below only support text zoom, so check the registry to see what
+ //version we actually have
+ wxRegKey key(wxRegKey::HKLM, "Software\\Microsoft\\Internet Explorer");
+ wxString value;
+ key.QueryValue("Version", value);
+
+ long version = wxAtoi(value.Left(1));
+ if(version <= 6 && type == wxWEB_VIEW_ZOOM_TYPE_LAYOUT)
+ return false;
+ else
+ return true;
+}
+
+void wxWebViewIE::Print()
+{
+ m_webBrowser->ExecWB(OLECMDID_PRINTPREVIEW,
+ OLECMDEXECOPT_DODEFAULT, NULL, NULL);
+}
+
+bool wxWebViewIE::CanGoBack() const
+{
+ if(m_historyEnabled)
+ return m_historyPosition > 0;
+ else
+ return false;
+}
+
+bool wxWebViewIE::CanGoForward() const
+{
+ if(m_historyEnabled)
+ return m_historyPosition != static_cast<int>(m_historyList.size()) - 1;
+ else
+ return false;
+}
+
+void wxWebViewIE::LoadHistoryItem(wxSharedPtr<wxWebViewHistoryItem> item)
+{
+ int pos = -1;
+ for(unsigned int i = 0; i < m_historyList.size(); i++)
+ {
+ //We compare the actual pointers to find the correct item
+ if(m_historyList[i].get() == item.get())
+ pos = i;
+ }
+ wxASSERT_MSG(pos != static_cast<int>(m_historyList.size()),
+ "invalid history item");
+ m_historyLoadingFromList = true;
+ LoadURL(item->GetUrl());
+ m_historyPosition = pos;
+}
+
+wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewIE::GetBackwardHistory()
+{
+ wxVector<wxSharedPtr<wxWebViewHistoryItem> > backhist;
+ //As we don't have std::copy or an iterator constructor in the wxwidgets
+ //native vector we construct it by hand
+ for(int i = 0; i < m_historyPosition; i++)
+ {
+ backhist.push_back(m_historyList[i]);
+ }
+ return backhist;
+}
+
+wxVector<wxSharedPtr<wxWebViewHistoryItem> > wxWebViewIE::GetForwardHistory()
+{
+ wxVector<wxSharedPtr<wxWebViewHistoryItem> > forwardhist;
+ //As we don't have std::copy or an iterator constructor in the wxwidgets
+ //native vector we construct it by hand
+ for(int i = m_historyPosition + 1; i < static_cast<int>(m_historyList.size()); i++)
+ {
+ forwardhist.push_back(m_historyList[i]);
+ }
+ return forwardhist;
+}
+
+void wxWebViewIE::GoBack()
+{
+ LoadHistoryItem(m_historyList[m_historyPosition - 1]);
+}
+
+void wxWebViewIE::GoForward()
+{
+ LoadHistoryItem(m_historyList[m_historyPosition + 1]);
+}
+
+void wxWebViewIE::Stop()
+{
+ m_ie.CallMethod("Stop");
+}
+
+void wxWebViewIE::ClearHistory()
+{
+ m_historyList.clear();
+ m_historyPosition = -1;
+}
+
+void wxWebViewIE::EnableHistory(bool enable)
+{
+ m_historyEnabled = enable;
+ m_historyList.clear();
+ m_historyPosition = -1;
+}
+
+void wxWebViewIE::Reload(wxWebViewReloadFlags flags)
+{
+ VARIANTARG level;
+ VariantInit(&level);
+ V_VT(&level) = VT_I2;
+
+ switch(flags)
+ {
+ case wxWEB_VIEW_RELOAD_DEFAULT:
+ V_I2(&level) = REFRESH_NORMAL;
+ break;
+ case wxWEB_VIEW_RELOAD_NO_CACHE:
+ V_I2(&level) = REFRESH_COMPLETELY;
+ break;
+ default:
+ wxFAIL_MSG("Unexpected reload type");
+ }
+
+ m_webBrowser->Refresh2(&level);
+}
+
+bool wxWebViewIE::IsOfflineMode()
+{
+ wxVariant out = m_ie.GetProperty("Offline");
+
+ wxASSERT(out.GetType() == "bool");
+
+ return out.GetBool();
+}
+
+void wxWebViewIE::SetOfflineMode(bool offline)
+{
+ // FIXME: the wxWidgets docs do not really document what the return
+ // parameter of PutProperty is
+#if wxDEBUG_LEVEL
+ const bool success =
+#endif
+ m_ie.PutProperty("Offline", (offline ?
+ VARIANT_TRUE :
+ VARIANT_FALSE));
+ wxASSERT(success);
+}
+
+bool wxWebViewIE::IsBusy() const
+{
+ 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());