r18824 by fschmid - ODG-Importer: improved text import for older odg files.

scribus-commit scribus-commit at lists.scribus.net
Tue Feb 18 21:38:05 UTC 2014


Author: fschmid
Date: Tue Feb 18 21:38:04 2014
New Revision: 18824

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18824
Log:
ODG-Importer: improved text import for older odg files.

Modified:
    trunk/Scribus/scribus/plugins/import/odg/importodg.cpp

Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18824&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Tue Feb 18 21:38:04 2014
@@ -1144,22 +1144,41 @@
 			tmpStyle.setGapAfter(pStyle.margin_bottom);
 			tmpStyle.setGapBefore(pStyle.margin_top);
 			double maxFsize = 0.0;
-			for(QDomElement sp = para.firstChildElement(); !sp.isNull(); sp = sp.nextSiblingElement())
-			{
-				ObjStyle cStyle;
-				resovleStyle(cStyle, sp.attribute("text:style-name"));
+			if (para.firstChildElement().isNull())
+			{
 				CharStyle tmpCStyle = tmpStyle.charStyle();
-				tmpCStyle.setFont((*m_Doc->AllFonts)[cStyle.fontName]);
-				tmpCStyle.setFontSize(cStyle.fontSize * 10);
-				tmpCStyle.setFillColor(cStyle.CurrColorText);
-				maxFsize = qMax(maxFsize, cStyle.fontSize);
-				QString txt = sp.text().trimmed();
+				tmpCStyle.setFont((*m_Doc->AllFonts)[tmpOStyle.fontName]);
+				tmpCStyle.setFontSize(tmpOStyle.fontSize * 10);
+				tmpCStyle.setFillColor(tmpOStyle.CurrColorText);
+				maxFsize = qMax(maxFsize, tmpOStyle.fontSize);
+				QString txt = para.text().trimmed();
 				if (txt.length() > 0)
 				{
 					item->itemText.insertChars(posC, txt);
 					item->itemText.applyStyle(posC, tmpStyle);
 					item->itemText.applyCharStyle(posC, txt.length(), tmpCStyle);
 					posC = item->itemText.length();
+				}
+			}
+			else
+			{
+				for(QDomElement sp = para.firstChildElement(); !sp.isNull(); sp = sp.nextSiblingElement())
+				{
+					ObjStyle cStyle;
+					resovleStyle(cStyle, sp.attribute("text:style-name"));
+					CharStyle tmpCStyle = tmpStyle.charStyle();
+					tmpCStyle.setFont((*m_Doc->AllFonts)[cStyle.fontName]);
+					tmpCStyle.setFontSize(cStyle.fontSize * 10);
+					tmpCStyle.setFillColor(cStyle.CurrColorText);
+					maxFsize = qMax(maxFsize, cStyle.fontSize);
+					QString txt = sp.text().trimmed();
+					if (txt.length() > 0)
+					{
+						item->itemText.insertChars(posC, txt);
+						item->itemText.applyStyle(posC, tmpStyle);
+						item->itemText.applyCharStyle(posC, txt.length(), tmpCStyle);
+						posC = item->itemText.length();
+					}
 				}
 			}
 			if (pStyle.lineHeight < 0.0)




More information about the scribus-commit mailing list