r14445 by fschmid - Follow-up to patch from Bug #8657: cleaned up the xml representation a bit.

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 21 22:10:30 CET 2009


Revision: 14445
Author: fschmid
Date: 2009-12-21T09:18:54.823196Z
Commit message: Follow-up to patch from Bug #8657: cleaned up the xml representation a bit.

Changeset: 
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M  /trunk/Scribus/scribus/scribusXml.cpp
M  /trunk/Scribus/scribus/pageitem_desaxe.cpp
M  /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp

Diffs:
Index: scribus/scribusXml.cpp
===================================================================
--- scribus/scribusXml.cpp	(revision 14444)
+++ scribus/scribusXml.cpp	(revision 14445)
@@ -343,10 +343,10 @@
 	OB->EmProfile  = attrAsString(attrs, "EPROF","");
 	OB->IRender    = (eRenderIntent) attrAsInt (attrs, "IRENDER", (int) Intent_Relative_Colorimetric);
 	OB->UseEmbedded= attrAsInt (attrs, "EMBEDDED", 1);
-	OB->OverrideCompressionMethod = attrAsBool(attrs, "COMPRESSIONMETHODOVER", false);
-	OB->OverrideCompressionQuality = attrAsBool(attrs, "COMPRESSIONQUALITYOVER", false);
-	OB->CompressionMethodIndex = attrAsInt (attrs, "COMPRESSIONMETHOD", 0);
-	OB->CompressionQualityIndex = attrAsInt (attrs, "COMPRESSIONQUALITY", 0);
+	if ((OB->OverrideCompressionMethod = attrHasValue(attrs, "COMPRESSIONMETHOD")))
+		OB->CompressionMethodIndex = attrAsInt(attrs, "COMPRESSIONMETHOD", 0);
+	if ((OB->OverrideCompressionQuality = attrHasValue(attrs, "COMPRESSIONQUALITY")))
+		OB->CompressionQualityIndex = attrAsInt(attrs, "COMPRESSIONQUALITY", 0);
 	OB->Locked       = attrAsBool(attrs, "LOCK", false);
 	OB->LockRes      = attrAsBool(attrs, "LOCKR", false);
 	OB->Reverse      = attrAsBool(attrs, "REVERS", false);
@@ -746,10 +746,10 @@
 	writer.writeAttribute("EMBEDDED"   , item->UseEmbedded ? "1" : "0");
 	if (item->asImageFrame())
 	{
-		writer.writeAttribute("COMPRESSIONMETHODOVER", item->OverrideCompressionMethod ? 1 : 0);
-		writer.writeAttribute("COMPRESSIONMETHOD", item->CompressionMethodIndex);
-		writer.writeAttribute("COMPRESSIONQUALITYOVER", item->OverrideCompressionQuality ? 1 : 0);
-		writer.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
+		if (item->OverrideCompressionMethod)
+			writer.writeAttribute("COMPRESSIONMETHOD", item->CompressionMethodIndex);
+		if (item->OverrideCompressionQuality)
+			writer.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
 	}
 	writer.writeAttribute("LOCK"       , item->locked() ? "1" : "0");
 	writer.writeAttribute("LOCKR"      , item->sizeLocked() ? "1" : "0");
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 14444)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 14445)
@@ -1664,10 +1664,10 @@
 	docu.writeAttribute("EMBEDDED", item->UseEmbedded ? 1 : 0);
 	if (item->asImageFrame())
 	{
-		docu.writeAttribute("COMPRESSIONMETHODOVER", item->OverrideCompressionMethod ? 1 : 0);
-		docu.writeAttribute("COMPRESSIONMETHOD", item->CompressionMethodIndex);
-		docu.writeAttribute("COMPRESSIONQUALITYOVER", item->OverrideCompressionQuality ? 1 : 0);
-		docu.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
+		if (item->OverrideCompressionMethod)
+			docu.writeAttribute("COMPRESSIONMETHOD", item->CompressionMethodIndex);
+		if (item->OverrideCompressionQuality)
+			docu.writeAttribute("COMPRESSIONQUALITY", item->CompressionQualityIndex);
 	}
 	docu.writeAttribute("LOCK", item->locked() ? 1 : 0);
 	docu.writeAttribute("LOCKR", item->sizeLocked() ? 1 : 0);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14444)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 14445)
@@ -2348,10 +2348,10 @@
 		currItem->UseEmbedded = attrs.valueAsInt("EMBEDDED", 1);
 		currItem->pixm.imgInfo.lowResType = attrs.valueAsInt("ImageRes", 1);
 		currItem->pixm.imgInfo.actualPageNumber = attrs.valueAsInt("Pagenumber", 0);
-		currItem->OverrideCompressionMethod = attrs.valueAsBool("COMPRESSIONMETHODOVER", false);
-		currItem->CompressionMethodIndex = attrs.valueAsInt("COMPRESSIONMETHOD", 0);
-		currItem->OverrideCompressionQuality = attrs.valueAsBool("COMPRESSIONQUALITYOVER", false);
-		currItem->CompressionQualityIndex = attrs.valueAsInt("COMPRESSIONQUALITY");
+		if ((currItem->OverrideCompressionMethod = attrs.hasAttribute("COMPRESSIONMETHOD")))
+			currItem->CompressionMethodIndex = attrs.valueAsInt("COMPRESSIONMETHOD", 0);
+		if ((currItem->OverrideCompressionQuality = attrs.hasAttribute("COMPRESSIONQUALITY")))
+			currItem->CompressionQualityIndex = attrs.valueAsInt("COMPRESSIONQUALITY");
 		if (currItem->asLatexFrame())
 		{
 			currItem->setImageXYOffset(attrs.valueAsDouble("LOCALX") * scx, attrs.valueAsDouble("LOCALY") * scy);
Index: scribus/pageitem_desaxe.cpp
===================================================================
--- scribus/pageitem_desaxe.cpp	(revision 14444)
+++ scribus/pageitem_desaxe.cpp	(revision 14445)
@@ -127,9 +127,15 @@
 	result.insert("image-x-position", toXMLString(item->imageXOffset()));
 	result.insert("image-y-position", toXMLString(item->imageYOffset()));
 	if (item->OverrideCompressionMethod)
+	{
+		result.insert("COMPRESSIONMETHODOVER", toXMLString(item->OverrideCompressionMethod));
 		result.insert("COMPRESSIONMETHOD", toXMLString(item->CompressionMethodIndex));
+	}
 	if (item->OverrideCompressionQuality)
+	{
+		result.insert("COMPRESSIONQUALITYOVER", toXMLString(item->OverrideCompressionQuality));
 		result.insert("COMPRESSIONQUALITY", toXMLString(item->CompressionQualityIndex));
+	}
 	//	result.insert("image-x-dpi", toXMLString(item->imageXDpi()));
 	//	result.insert("image-y-dpi", toXMLString(item->imageYDpi()));
 	result.insert("image-shown", toXMLString(item->imageShown()));




More information about the scribus-commit mailing list