r16385 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:25:24 CET 2011
Author: fschmid
Date: Sat Feb 19 10:25:24 2011
New Revision: 16385
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16385
Log:
When loading files check if a parent style exists before applying it, fixes Bug #9747
Modified:
branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
branches/Version135/Scribus/scribus/scribusdoc.cpp
branches/Version135/Scribus/scribus/scribusdoc.h
Modified: branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16385&path=/branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sat Feb 19 10:25:24 2011
@@ -1979,7 +1979,14 @@
vg.setDefaultStyle(true);
else
vg.setDefaultStyle(false);
- vg.setParent(pg.attribute("PARENT", ""));
+ QString parentStyle = pg.attribute("PARENT", "");
+ if (!parentStyle.isEmpty())
+ {
+ if (m_Doc->styleExists(parentStyle))
+ vg.setParent(parentStyle);
+ else
+ vg.setParent(CommonStrings::DefaultParagraphStyle);
+ }
if (pg.hasAttribute("LINESPMode"))
vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode").toInt()));
if (pg.hasAttribute("LINESP"))
Modified: branches/Version135/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16385&path=/branches/Version135/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version135/Scribus/scribus/scribusdoc.cpp Sat Feb 19 10:25:24 2011
@@ -908,6 +908,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)
{
Modified: branches/Version135/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16385&path=/branches/Version135/Scribus/scribus/scribusdoc.h
==============================================================================
--- branches/Version135/Scribus/scribus/scribusdoc.h (original)
+++ branches/Version135/Scribus/scribus/scribusdoc.h Sat Feb 19 10:25:24 2011
@@ -439,7 +439,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