r15361 by jghali - #9285 : copying objects between documents looses colours of frames

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 18 15:10:35 CEST 2010


Revision: 15361
Author: jghali
Date: 2010-07-18T13:03:16.886302Z
Commit message: #9285 : copying objects between documents looses colours of frames

Changeset: 
M  /trunk/Scribus/scribus/serializer.cpp

Diffs:
Index: scribus/serializer.cpp
===================================================================
--- scribus/serializer.cpp	(revision 15360)
+++ scribus/serializer.cpp	(revision 15361)
@@ -124,18 +124,34 @@
 class CollectSingleLine : public MakeAction<CollectSingleLine_body>
 {};
 
+class MergeColors_body : public Action_body
+{
+	void end (const Xml_string& tagname)
+	{
+//		qDebug() << QString("collect %1").arg(tagname);
+		Collection* coll = this->dig->lookup<Collection>("<collection>");
+		ScribusDoc* doc  = this->dig->lookup<ScribusDoc>("<scribusdoc>");
+		doc->PageColors.addColors(coll->colors, false);
+	}
+};
+
+class MergeColors : public MakeAction<MergeColors_body>
+{};
+
 Serializer::Serializer(ScribusDoc& doc) : Digester(), m_Doc(doc)
 {
 	// register desaxe rules for styles, colors and elems
 	addRule("/SCRIBUSFRAGMENT", Factory<Collection>());
 	addRule("/SCRIBUSFRAGMENT", Store<Collection>("<collection>"));
+
+	addRule("/SCRIBUSFRAGMENT/colors", MergeColors());
 	
-	addRule("/SCRIBUSFRAGMENT/color", Factory<ScColor>());
-	addRule("/SCRIBUSFRAGMENT/color", SetAttribute<ScColor, QString>( &ScColor::setNamedColor, "RGB" ));
-	addRule("/SCRIBUSFRAGMENT/color", SetAttribute<ScColor, QString>( &ScColor::setNamedColor, "CMYK" ));
-	addRule("/SCRIBUSFRAGMENT/color", SetAttributeWithConversion<ScColor, bool>( &ScColor::setSpotColor, "Spot", &parseBool ));
-	addRule("/SCRIBUSFRAGMENT/color", SetAttributeWithConversion<ScColor, bool>( &ScColor::setRegistrationColor, "Register", &parseBool ));
-	addRule("/SCRIBUSFRAGMENT/color", CollectColor());
+	addRule("/SCRIBUSFRAGMENT/colors/color", Factory<ScColor>());
+	addRule("/SCRIBUSFRAGMENT/colors/color", SetAttribute<ScColor, QString>( &ScColor::setNamedColor, "RGB" ));
+	addRule("/SCRIBUSFRAGMENT/colors/color", SetAttribute<ScColor, QString>( &ScColor::setNamedColor, "CMYK" ));
+	addRule("/SCRIBUSFRAGMENT/colors/color", SetAttributeWithConversion<ScColor, bool>( &ScColor::setSpotColor, "Spot", &parseBool ));
+	addRule("/SCRIBUSFRAGMENT/colors/color", SetAttributeWithConversion<ScColor, bool>( &ScColor::setRegistrationColor, "Register", &parseBool ));
+	addRule("/SCRIBUSFRAGMENT/colors/color", CollectColor());
 
 	CharStyle::desaxeRules("/SCRIBUSFRAGMENT/", *this);
 	addRule("/SCRIBUSFRAGMENT/charstyle", SetterP<Collection, CharStyle>( & Collection::collectCharStyle ));




More information about the scribus-commit mailing list