r18400 by fschmid - IDML Importer: MasterSpreads Part 2

scribus-commit scribus-commit at lists.scribus.net
Sat Jul 27 09:23:02 UTC 2013


Author: fschmid
Date: Sat Jul 27 09:23:02 2013
New Revision: 18400

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18400
Log:
IDML Importer: MasterSpreads Part 2

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=18400&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 Jul 27 09:23:02 2013
@@ -1533,7 +1533,26 @@
 					baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
 					firstPage = false;
 					if ((importerFlags & LoadSavePlugin::lfCreateDoc) && spe.hasAttribute("AppliedMaster"))
-						m_Doc->applyMasterPage(spe.attribute("AppliedMaster"), m_Doc->currentPageNumber());
+					{
+						QString mSpr = spe.attribute("AppliedMaster");
+						if (masterSpreads.contains(mSpr))
+						{
+							QString mp = CommonStrings::trMasterPageNormal;
+							if (facingPages)
+							{
+								if ((pagecount % 2 == 0) && (masterSpreads[mSpr].count() > 0))
+									mp = mSpr + "_" + masterSpreads[mSpr][0];
+								if ((pagecount % 2 == 1) && (masterSpreads[mSpr].count() > 1))
+									mp = mSpr + "_" + masterSpreads[mSpr][1];
+							}
+							else
+							{
+								if ((masterSpreads[mSpr].count() > 0))
+									mp = mSpr + "_" + masterSpreads[mSpr][0];
+							}
+							m_Doc->applyMasterPage(mp, m_Doc->currentPageNumber());
+						}
+					}
 				}
 			}
 			if ((facingPages) && (pagecount % 2 == 0))
@@ -1564,12 +1583,14 @@
 		{
 			m_Doc->setMasterPageMode(true);
 			QString pageNam = e.attribute("Self");
+			QStringList pages;
 			for(QDomNode sp = e.firstChild(); !sp.isNull(); sp = sp.nextSibling() )
 			{
 				QDomElement spe = sp.toElement();
 				if (spe.tagName() == "Page")
 				{
-					m_Doc->addMasterPage(mpagecount, pageNam);
+					m_Doc->addMasterPage(mpagecount, pageNam + "_" + spe.attribute("Self"));
+					pages.append(spe.attribute("Self"));
 					m_Doc->currentPage()->MPageNam = "";
 					m_Doc->view()->addPage(mpagecount, true);
 					mpagecount++;
@@ -1577,6 +1598,7 @@
 					baseY = m_Doc->currentPage()->yOffset() + m_Doc->currentPage()->height() / 2.0;
 				}
 			}
+			masterSpreads.insert(pageNam, pages);
 			if ((facingPages) && (mpagecount % 2 == 0))
 			{
 				baseX = m_Doc->currentPage()->xOffset() + m_Doc->currentPage()->width();

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18400&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 Jul 27 09:23:02 2013
@@ -148,6 +148,7 @@
 	QMap<QString, QStringList> styleParents;
 	QMap<QString, QString> charStyleTranslate;
 	QMap<QString, QMap<QString, QString> > fontTranslateMap;
+	QMap<QString, QStringList> masterSpreads;
 	QString def_fillColor;
 	QString def_fillGradient;
 	QString def_strokeColor;




More information about the scribus-commit mailing list