Add GetPageText to MSW IE and to GTK WebKit. Add stub for OSX and document.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68250 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -110,6 +110,7 @@ public:
|
||||
virtual wxString GetCurrentURL();
|
||||
virtual wxString GetCurrentTitle();
|
||||
virtual wxString GetPageSource();
|
||||
virtual wxString GetPageText();
|
||||
//We do not want to hide the other overloads
|
||||
using wxWebView::SetPage;
|
||||
virtual void SetPage(const wxString& html, const wxString& baseUrl);
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
|
||||
|
||||
virtual wxString GetPageSource();
|
||||
virtual wxString GetPageText();
|
||||
|
||||
virtual bool IsBusy();
|
||||
virtual wxString GetCurrentURL();
|
||||
|
@@ -56,6 +56,7 @@ public:
|
||||
virtual void Reload(wxWebViewReloadFlags flags = wxWEB_VIEW_RELOAD_DEFAULT);
|
||||
virtual void Stop();
|
||||
virtual wxString GetPageSource();
|
||||
virtual wxString GetPageText() { return ""; }
|
||||
virtual void SetPageTitle(const wxString& title) { m_pageTitle = title; }
|
||||
virtual wxString GetPageTitle(){ return m_pageTitle; }
|
||||
|
||||
|
@@ -222,6 +222,7 @@ public:
|
||||
* shown
|
||||
*/
|
||||
virtual wxString GetPageSource() = 0;
|
||||
virtual wxString GetPageText() = 0;
|
||||
|
||||
/**
|
||||
* Get the zoom factor of the page
|
||||
|
@@ -226,6 +226,11 @@ public:
|
||||
*/
|
||||
virtual wxString GetPageSource() = 0;
|
||||
|
||||
/**
|
||||
Get the text of the current page.
|
||||
*/
|
||||
virtual wxString GetPageText() = 0;
|
||||
|
||||
/**
|
||||
Returns whether the web control is currently busy (e.g. loading a page).
|
||||
*/
|
||||
|
@@ -768,6 +768,17 @@ wxString wxWebViewWebKit::GetSelectedSource()
|
||||
wxConvUTF8);
|
||||
}
|
||||
|
||||
wxString wxWebViewWebKit::GetPageText()
|
||||
{
|
||||
WebKitDOMDocument* doc;
|
||||
WebKitDOMHTMLElement* body;
|
||||
|
||||
doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view));
|
||||
body = webkit_dom_document_get_body(WEBKIT_DOM_DOCUMENT(doc));
|
||||
return wxString(webkit_dom_html_element_get_inner_text(WEBKIT_DOM_HTML_ELEMENT(body)),
|
||||
wxConvUTF8);
|
||||
}
|
||||
|
||||
// static
|
||||
wxVisualAttributes
|
||||
wxWebViewWebKit::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
||||
|
@@ -643,6 +643,21 @@ wxString wxWebViewIE::GetSelectedSource()
|
||||
return selected;
|
||||
}
|
||||
|
||||
wxString wxWebViewIE::GetPageText()
|
||||
{
|
||||
IHTMLDocument2* document = GetDocument();
|
||||
BSTR out;
|
||||
IHTMLElement* body;
|
||||
HRESULT hr = document->get_body(&body);
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
body->get_innerText(&out);
|
||||
body->Release();
|
||||
}
|
||||
document->Release();
|
||||
return wxString(out);
|
||||
}
|
||||
|
||||
bool wxWebViewIE::CanExecCommand(wxString command)
|
||||
{
|
||||
IHTMLDocument2* document = GetDocument();
|
||||
|
Reference in New Issue
Block a user