Apply previous paragraph style if pasting plain text, but not if pasting rich text.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2008-05-09 08:46:55 +00:00
parent 554ddc6197
commit ca8eed8584

View File

@@ -5351,6 +5351,15 @@ bool wxRichTextBuffer::InsertParagraphsWithUndo(long pos, const wxRichTextParagr
action->GetNewParagraphs() = paragraphs;
if (p && !p->IsDefault())
{
for (wxRichTextObjectList::compatibility_iterator node = action->GetNewParagraphs().GetChildren().GetFirst(); node; node = node->GetNext())
{
wxRichTextObject* child = node->GetData();
child->SetAttributes(*p);
}
}
action->SetPosition(pos);
wxRichTextRange range = wxRichTextRange(pos, pos + paragraphs.GetRange().GetEnd() - 1);
@@ -6225,7 +6234,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
wxRichTextBuffer* richTextBuffer = data.GetRichTextBuffer();
if (richTextBuffer)
{
InsertParagraphsWithUndo(position+1, *richTextBuffer, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
InsertParagraphsWithUndo(position+1, *richTextBuffer, GetRichTextCtrl(), 0);
if (GetRichTextCtrl())
GetRichTextCtrl()->ShowPosition(position + richTextBuffer->GetRange().GetEnd());
delete richTextBuffer;
@@ -6249,7 +6258,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
#else
wxString text2 = text;
#endif
InsertTextWithUndo(position+1, text2, GetRichTextCtrl());
InsertTextWithUndo(position+1, text2, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
if (GetRichTextCtrl())
GetRichTextCtrl()->ShowPosition(position + text2.Length());