r24270 by jghali - Use new copy/paste code also when cutting text

scribus-commit scribus-commit at lists.scribus.net
Sat Nov 21 17:42:45 UTC 2020


Author: jghali
Date: Sat Nov 21 17:42:45 2020
New Revision: 24270

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24270
Log:
Use new copy/paste code also when cutting text

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24270&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sat Nov 21 17:42:45 2020
@@ -4426,21 +4426,21 @@
 			StoryText itemText(doc);
 			itemText.setDefaultStyle(cItem->itemText.defaultStyle());
 			itemText.insert(0, cItem->itemText, true);
-			std::ostringstream xmlString;
-			SaxXML xmlStream(xmlString);
-			xmlStream.beginDoc();
-			itemText.saxx(xmlStream, "SCRIBUSTEXT");
-			xmlStream.endDoc();
-			std::string xml(xmlString.str());
-			ScTextMimeData* mimeData = new ScTextMimeData();
-			mimeData->setScribusText (QByteArray(xml.c_str(), xml.length()));
-			mimeData->setText( itemText.text(0, itemText.length()) ) ;
-			QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
-			cItem->deleteSelectedTextFromFrame();
-			if (doc->appMode == modeEditTable)
-				currItem->asTable()->update();
-			else
-				cItem->update();
+
+			QByteArray storyData;
+			QScopedPointer<StoryLoader> storyLoader(new StoryLoader());
+			if (storyLoader->saveStory(storyData, *doc, itemText))
+			{
+				ScTextMimeData* mimeData = new ScTextMimeData();
+				mimeData->setScribusText(storyData);
+				mimeData->setText(itemText.text(0, itemText.length()));
+				QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
+				cItem->deleteSelectedTextFromFrame();
+				if (doc->appMode == modeEditTable)
+					currItem->asTable()->update();
+				else
+					cItem->update();
+			}
 		}
 	}
 	else




More information about the scribus-commit mailing list