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:
Václav Slavík
2004-07-16 17:19:17 +00:00
parent 051aa330fe
commit 977b867e72
2 changed files with 24 additions and 7 deletions

View File

@@ -728,19 +728,19 @@ bool wxHtmlWindow::IsSelectionEnabled() const
#if wxUSE_CLIPBOARD
wxString wxHtmlWindow::SelectionToText()
wxString wxHtmlWindow::DoSelectionToText(wxHtmlSelection *sel)
{
if ( !m_selection )
if ( !sel )
return wxEmptyString;
wxClientDC dc(this);
const wxHtmlCell *end = m_selection->GetToCell();
const wxHtmlCell *end = sel->GetToCell();
wxString text;
wxHtmlTerminalCellsInterator i(m_selection->GetFromCell(), end);
wxHtmlTerminalCellsInterator i(sel->GetFromCell(), end);
if ( i )
{
text << i->ConvertToText(m_selection);
text << i->ConvertToText(sel);
++i;
}
const wxHtmlCell *prev = *i;
@@ -748,13 +748,25 @@ wxString wxHtmlWindow::SelectionToText()
{
if ( prev->GetParent() != i->GetParent() )
text << _T('\n');
text << i->ConvertToText(*i == end ? m_selection : NULL);
text << i->ConvertToText(*i == end ? sel : NULL);
prev = *i;
++i;
}
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
bool wxHtmlWindow::CopySelection(ClipboardType t)