r22554 by jghali - #15334: Creating master page from a page that already has a master page assigned generates garbage master page

scribus-commit scribus-commit at lists.scribus.net
Thu May 24 18:28:27 UTC 2018


Author: jghali
Date: Thu May 24 18:28:27 2018
New Revision: 22554

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22554
Log:
#15334: Creating master page from a page that already has a master page assigned generates garbage master page

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22554&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Thu May 24 18:28:27 2018
@@ -5301,7 +5301,7 @@
 	{
 		if (!sourcePage->MPageNam.isEmpty() && MasterNames.contains(sourcePage->MPageNam))
 		{
-			ScPage* pageMaster=nullptr;
+			ScPage* pageMaster = nullptr;
 			for (int i=0; i < MasterPages.count(); ++i )
 			{
 				pageMaster=MasterPages[i];
@@ -5324,10 +5324,12 @@
 					{
 						ScriXmlDoc ss;
 						setMasterPageMode(true);
+						setCurrentPage(pageMaster); // Needed for WriteElem to write proper page relative coordinates
 						QString dataS = ss.WriteElem(this, &tempSelection);
 						setCurrentPage(targetPage);
 						ss.ReadElemToLayer(dataS, m_appPrefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, m_appPrefsData.fontPrefs.GFontSub, it->ID);
 						setMasterPageMode(false);
+						setCurrentPage(oldCurrentPage);
 					}
 					tempSelection.clear();
 				}
@@ -5351,11 +5353,13 @@
 			if (tempSelection.count() != 0)
 			{
 				ScriXmlDoc ss;
+				setCurrentPage(sourcePage); // Needed for WriteElem to write proper page relative coordinates
 				QString dataS = ss.WriteElem(this, &tempSelection);
 				setMasterPageMode(true);
 				setCurrentPage(targetPage);
 				ss.ReadElemToLayer(dataS, m_appPrefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, m_appPrefsData.fontPrefs.GFontSub, it->ID);
 				setMasterPageMode(false);
+				setCurrentPage(oldCurrentPage);
 			}
 			tempSelection.clear();
 		}
@@ -5368,7 +5372,7 @@
 		PageItem *newItem = MasterItems.at(a);
 		newItem->setMasterPage(MasterNames[masterPageName], masterPageName);
 	}
-	targetPage->MPageNam = "";
+	targetPage->MPageNam.clear();
 	setLoading(false);
 	GroupCounter = GrMax + 1;
 	//Reset the current page..




More information about the scribus-commit mailing list