r18347 by fschmid - IDML Importer: Parse Paragraph Style inheritence correctly.

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 29 10:56:18 UTC 2013


Author: fschmid
Date: Sat Jun 29 10:56:18 2013
New Revision: 18347

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18347
Log:
IDML Importer: Parse Paragraph Style inheritence correctly.

Modified:
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
    trunk/Scribus/scribus/plugins/import/idml/importidml.h

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18347&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Sat Jun 29 10:56:18 2013
@@ -1116,6 +1116,14 @@
 					QString parentStyle = i.text().remove("$ID/");
 					if (styleTranslate.contains(parentStyle))
 						parentStyle = styleTranslate[parentStyle];
+					else
+					{
+						QString pSty = parentStyle.remove("ParagraphStyle/");
+						if (styleParents.contains(pSty))
+							styleParents[pSty].append(newStyle.name());
+						else
+							styleParents.insert(pSty, QStringList() << newStyle.name());
+					}
 					if (m_Doc->styleExists(parentStyle))
 						newStyle.setParent(parentStyle);
 				}
@@ -1193,6 +1201,18 @@
 	tmp.create(newStyle);
 	m_Doc->redefineStyles(tmp, false);
 	styleTranslate.insert(styleElem.attribute("Self").remove("$ID/"), styleElem.attribute("Name").remove("$ID/"));
+	if (styleParents.contains(newStyle.name()))
+	{
+		QStringList desList = styleParents[newStyle.name()];
+		for (int a = 0; a < desList.count(); a++)
+		{
+			ParagraphStyle old = m_Doc->paragraphStyle(desList[a]);
+			old.setParent(newStyle.name());
+			StyleSet<ParagraphStyle>tmp2;
+			tmp2.create(old);
+			m_Doc->redefineStyles(tmp2, false);
+		}
+	}
 }
 
 bool IdmlPlug::parsePreferencesXML(const QDomElement& prElem)

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18347&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.h (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.h Sat Jun 29 10:56:18 2013
@@ -143,6 +143,7 @@
 	QMap<QString, QString> layerTranslate;
 	QMap<QString, PageItem*> storyMap;
 	QMap<QString, QString> styleTranslate;
+	QMap<QString, QStringList> styleParents;
 	QMap<QString, QString> charStyleTranslate;
 	QString def_fillColor;
 	QString def_fillGradient;




More information about the scribus-commit mailing list