r21365 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 4 23:55:19 UTC 2016


Author: jghali
Date: Sat Jun  4 23:55:19 2016
New Revision: 21365

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21365
Log:
#14129: fix reference to deleted styles when loading documents

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21365&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	Sat Jun  4 23:55:19 2016
@@ -575,6 +575,11 @@
 	m_Doc->setMasterPageMode(false);
 	m_Doc->reformPages();
 	m_Doc->refreshGuides();
+
+	// #12282 : some docs have language dependent style names specified in style properties
+	// #14129 : some others reference deleted character styles
+	m_Doc->fixCharacterStyles();
+	m_Doc->fixParagraphStyles();
 
 	// #9969 : Some old long doc may have page owner somewhat broken
 	m_Doc->fixItemPageOwner();

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21365&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	Sat Jun  4 23:55:19 2016
@@ -1802,6 +1802,8 @@
 	m_Doc->refreshGuides();
 
 	// #12282 : some docs have language dependent style names specified in style properties
+	// #14129 : some others reference deleted character styles
+	m_Doc->fixCharacterStyles();
 	m_Doc->fixParagraphStyles();
 	m_Doc->fixNotesStyles();
 

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21365&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sat Jun  4 23:55:19 2016
@@ -6067,11 +6067,36 @@
 	}
 }
 
+void ScribusDoc::fixCharacterStyles()
+{
+	for (int i = 0; i < m_docCharStyles.count(); ++i)
+	{
+		CharStyle& charStyle = m_docCharStyles[i];
+		QString parentName = charStyle.parent();
+		if (parentName.isEmpty())
+			continue;
+		if (!m_docCharStyles.contains(parentName))
+			charStyle.setParent(QString());
+	}
+}
+
 void ScribusDoc::fixParagraphStyles()
 {
 	for (int i = 0; i < m_docParagraphStyles.count(); ++i)
 	{
 		ParagraphStyle& parStyle = m_docParagraphStyles[i];
+		QString parentName = parStyle.parent();
+		if (!parentName.isEmpty())
+		{
+			if (!m_docParagraphStyles.contains(parentName))
+				parStyle.setParent(QString());
+		}
+		QString charStyleName = parStyle.charStyle().parent();
+		if (!charStyleName.isEmpty())
+		{
+			if (!m_docCharStyles.contains(charStyleName))
+				parStyle.charStyle().setParent(QString());
+		}
 		QString peStyleName = parStyle.peCharStyleName();
 		if (peStyleName.isEmpty())
 			continue;

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21365&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h	(original)
+++ trunk/Scribus/scribus/scribusdoc.h	Sat Jun  4 23:55:19 2016
@@ -871,6 +871,8 @@
 
 	/** @brief Check and fix if needed PageItem OwnPage member */
 	void fixItemPageOwner();
+	/** @brief Fix character styles */
+	void fixCharacterStyles();
 	/** @brief Fix paragraph styles */
 	void fixParagraphStyles();
 	/** @brief Fix notes styles */




More information about the scribus-commit mailing list