added wxHtmlWindow::ToText
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28261 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -253,13 +253,18 @@ protected:
|
|||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
// Convert selection to text:
|
// Convert selection to text:
|
||||||
wxString SelectionToText();
|
wxString SelectionToText() { return DoSelectionToText(m_selection); }
|
||||||
|
|
||||||
|
// Converts current page to text:
|
||||||
|
wxString ToText();
|
||||||
|
|
||||||
// Automatic scrolling during selection:
|
// Automatic scrolling during selection:
|
||||||
void StopAutoScrolling();
|
void StopAutoScrolling();
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
wxString DoSelectionToText(wxHtmlSelection *sel);
|
||||||
|
|
||||||
// This is pointer to the first cell in parsed data. (Note: the first cell
|
// This is pointer to the first cell in parsed data. (Note: the first cell
|
||||||
// is usually top one = all other cells are sub-cells of this one)
|
// is usually top one = all other cells are sub-cells of this one)
|
||||||
wxHtmlContainerCell *m_Cell;
|
wxHtmlContainerCell *m_Cell;
|
||||||
|
@@ -728,19 +728,19 @@ bool wxHtmlWindow::IsSelectionEnabled() const
|
|||||||
|
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
wxString wxHtmlWindow::SelectionToText()
|
wxString wxHtmlWindow::DoSelectionToText(wxHtmlSelection *sel)
|
||||||
{
|
{
|
||||||
if ( !m_selection )
|
if ( !sel )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
|
|
||||||
const wxHtmlCell *end = m_selection->GetToCell();
|
const wxHtmlCell *end = sel->GetToCell();
|
||||||
wxString text;
|
wxString text;
|
||||||
wxHtmlTerminalCellsInterator i(m_selection->GetFromCell(), end);
|
wxHtmlTerminalCellsInterator i(sel->GetFromCell(), end);
|
||||||
if ( i )
|
if ( i )
|
||||||
{
|
{
|
||||||
text << i->ConvertToText(m_selection);
|
text << i->ConvertToText(sel);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
const wxHtmlCell *prev = *i;
|
const wxHtmlCell *prev = *i;
|
||||||
@@ -748,13 +748,25 @@ wxString wxHtmlWindow::SelectionToText()
|
|||||||
{
|
{
|
||||||
if ( prev->GetParent() != i->GetParent() )
|
if ( prev->GetParent() != i->GetParent() )
|
||||||
text << _T('\n');
|
text << _T('\n');
|
||||||
text << i->ConvertToText(*i == end ? m_selection : NULL);
|
text << i->ConvertToText(*i == end ? sel : NULL);
|
||||||
prev = *i;
|
prev = *i;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString wxHtmlWindow::ToText()
|
||||||
|
{
|
||||||
|
if (m_Cell)
|
||||||
|
{
|
||||||
|
wxHtmlSelection sel;
|
||||||
|
sel.Set(m_Cell->GetFirstTerminal(), m_Cell->GetLastTerminal());
|
||||||
|
return DoSelectionToText(&sel);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CLIPBOARD
|
#endif // wxUSE_CLIPBOARD
|
||||||
|
|
||||||
bool wxHtmlWindow::CopySelection(ClipboardType t)
|
bool wxHtmlWindow::CopySelection(ClipboardType t)
|
||||||
|
Reference in New Issue
Block a user