r16386 by fschmid - When loading files check if a parent style exists before applying it, fixes Bug #9747
scribus-commit
scribus-commit at lists.scribus.net
Sat Feb 19 11:26:20 CET 2011
Author: fschmid
Date: Sat Feb 19 10:26:20 2011
New Revision: 16386
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16386
Log:
When loading files check if a parent style exists before applying it, fixes Bug #9747
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.info/websvn/diff.php?repname=Scribus&rev=16386&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 Feb 19 10:26:20 2011
@@ -1234,7 +1234,14 @@
newStyle.setDefaultStyle(true);
else
newStyle.setDefaultStyle(false);
- newStyle.setParent(attrs.valueAsString("PARENT", ""));
+ QString parentStyle = attrs.valueAsString("PARENT", "");
+ if (!parentStyle.isEmpty())
+ {
+ if (m_Doc->styleExists(parentStyle))
+ newStyle.setParent(parentStyle);
+ else
+ newStyle.setParent(CommonStrings::DefaultParagraphStyle);
+ }
static const QString LINESPMode("LINESPMode");
if (attrs.hasAttribute(LINESPMode))
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16386&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 Feb 19 10:26:20 2011
@@ -2023,7 +2023,15 @@
newStyle.setDefaultStyle(true);
else
newStyle.setDefaultStyle(false);
- newStyle.setParent(attrs.valueAsString("PARENT", ""));
+
+ QString parentStyle = attrs.valueAsString("PARENT", "");
+ if (!parentStyle.isEmpty())
+ {
+ if (m_Doc->styleExists(parentStyle))
+ newStyle.setParent(parentStyle);
+ else
+ newStyle.setParent(CommonStrings::DefaultParagraphStyle);
+ }
static const QString LINESPMode("LINESPMode");
if (attrs.hasAttribute(LINESPMode))
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16386&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Feb 19 10:26:20 2011
@@ -986,6 +986,16 @@
}
}
+bool ScribusDoc::styleExists(QString styleName)
+{
+ for (int ff = 0; ff < paragraphStyles().count(); ++ff)
+ {
+ if (paragraphStyles()[ff].name() == styleName)
+ return true;
+ }
+ return false;
+}
+
void ScribusDoc::replaceStyles(const QMap<QString,QString>& newNameForOld)
{
@@ -1163,7 +1173,6 @@
}
docParagraphStyles.invalidate();
}
-
void ScribusDoc::redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused)
{
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16386&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Feb 19 10:26:20 2011
@@ -517,7 +517,8 @@
// bool isDefaultStyle( LineStyle& l ) const { return MLineStyles......; }
void getNamedResources(ResourceCollection& lists) const;
- void replaceNamedResources(ResourceCollection& newNames);
+ void replaceNamedResources(ResourceCollection& newNames);
+ bool styleExists(QString styleName);
void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
/**
More information about the scribus-commit
mailing list