Use style sheet when copying to the clipboard if available

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2014-03-31 16:11:08 +00:00
parent 174faa04aa
commit 9ab80ed818

View File

@@ -8768,6 +8768,11 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
container->InsertParagraphsWithUndo(this, position+1, *richTextBuffer, GetRichTextCtrl(), 0);
if (GetRichTextCtrl())
GetRichTextCtrl()->ShowPosition(position + richTextBuffer->GetOwnRange().GetEnd());
if (richTextBuffer->GetStyleSheet())
{
delete richTextBuffer->GetStyleSheet();
richTextBuffer->SetStyleSheet(NULL);
}
delete richTextBuffer;
}
}
@@ -13138,6 +13143,7 @@ size_t wxRichTextBufferDataObject::GetDataSize() const
{
wxStringOutputStream stream(& bufXML);
m_richTextBuffer->SetHandlerFlags(wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET);
if (!m_richTextBuffer->SaveFile(stream, wxRICHTEXT_TYPE_XML))
{
wxLogError(wxT("Could not write the buffer to an XML stream.\nYou may have forgotten to add the XML file handler."));
@@ -13162,6 +13168,7 @@ bool wxRichTextBufferDataObject::GetDataHere(void *pBuf) const
{
wxStringOutputStream stream(& bufXML);
m_richTextBuffer->SetHandlerFlags(wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET);
if (!m_richTextBuffer->SaveFile(stream, wxRICHTEXT_TYPE_XML))
{
wxLogError(wxT("Could not write the buffer to an XML stream.\nYou may have forgotten to add the XML file handler."));
@@ -13192,6 +13199,7 @@ bool wxRichTextBufferDataObject::SetData(size_t WXUNUSED(len), const void *buf)
m_richTextBuffer = new wxRichTextBuffer;
wxStringInputStream stream(bufXML);
m_richTextBuffer->SetHandlerFlags(wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET);
if (!m_richTextBuffer->LoadFile(stream, wxRICHTEXT_TYPE_XML))
{
wxLogError(wxT("Could not read the buffer from an XML stream.\nYou may have forgotten to add the XML file handler."));