r18875 by fschmid - Viva-Importer: Partly fixed Bug #12120, gives better results for most of these files

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 5 20:31:19 UTC 2014


Author: fschmid
Date: Wed Mar  5 20:31:19 2014
New Revision: 18875

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18875
Log:
Viva-Importer: Partly fixed Bug #12120, gives better results for most of these files

Modified:
    trunk/Scribus/scribus/plugins/import/viva/importviva.cpp

Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18875&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.cpp Wed Mar  5 20:31:19 2014
@@ -438,6 +438,7 @@
 		double pgGap = m_Doc->PageSpa;
 		papersize = "Custom";
 		QString paperOrien = "portrait";
+		bool hasPageSize = false;
 		for (QDomNode n = grNode.firstChild(); !n.isNull(); n = n.nextSibling() )
 		{
 			QDomElement e = n.toElement();
@@ -459,17 +460,35 @@
 				papersize = e.text();
 			else if (e.tagName() == "vd:pageOrientation")
 				paperOrien = e.text();
+			else if (e.tagName() == "vd:pageSize")
+			{
+				docWidth = parseUnit(e.attribute("vd:width", "0"));
+				docHeight = parseUnit(e.attribute("vd:height", "0"));
+				hasPageSize = true;
+			}
 		}
 		PageSize ps(papersize);
-		if (paperOrien.startsWith("portrait"))
-		{
-			docWidth = ps.width();
-			docHeight = ps.height();
+		if (hasPageSize)
+		{
+			if (!paperOrien.startsWith("portrait"))
+			{
+				double tmp = docWidth;
+				docWidth = docHeight;
+				docHeight = tmp;
+			}
 		}
 		else
 		{
-			docHeight = ps.width();
-			docWidth = ps.height();
+			if (paperOrien.startsWith("portrait"))
+			{
+				docWidth = ps.width();
+				docHeight = ps.height();
+			}
+			else
+			{
+				docHeight = ps.width();
+				docWidth = ps.height();
+			}
 		}
 		m_Doc->setPage(docWidth, docHeight, topMargin, leftMargin, rightMargin, bottomMargin, pgCols, pgGap, false, facingPages);
 		m_Doc->setPageSize(papersize);




More information about the scribus-commit mailing list