r19089 by jghali - #12282: Same .sla file cannot be loaded with different GUI languages
scribus-commit
scribus-commit at lists.scribus.net
Sat Apr 26 00:01:02 UTC 2014
Author: jghali
Date: Sat Apr 26 00:01:02 2014
New Revision: 19089
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19089
Log:
#12282: Same .sla file cannot be loaded with different GUI languages
Modified:
trunk/Scribus/scribus/pageitem_textframe.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/styles/styleset.h
trunk/Scribus/scribus/ui/smtextstyles.cpp
trunk/Scribus/scribus/ui/smtextstyles.h
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sat Apr 26 00:01:02 2014
@@ -1543,7 +1543,7 @@
Q_ASSERT(nStyle != NULL);
QString chsName = nStyle->marksChStyle();
CharStyle currStyle(itemText.charStyle(a));
- if ((chsName != "") && (chsName != tr("No Style")))
+ if (!chsName.isEmpty())
{
CharStyle marksStyle(m_Doc->charStyle(chsName));
if (!currStyle.equiv(marksStyle))
@@ -1627,7 +1627,7 @@
{
const QString& curParent(style.hasParent() ? style.parent() : style.name());
CharStyle newStyle;
- if (style.peCharStyleName() == tr("No Style") || style.peCharStyleName().isEmpty())
+ if (style.peCharStyleName().isEmpty())
newStyle.setParent(m_Doc->paragraphStyle(curParent).charStyle().name());
else if (charStyle.name() != style.peCharStyleName())
newStyle.setParent(m_Doc->charStyle(style.peCharStyleName()).name());
@@ -1635,7 +1635,7 @@
charStyle.setStyle(newStyle);
itemText.setCharStyle(a, 1 , charStyle);
}
- else if (style.peCharStyleName() != tr("No Style") && !style.peCharStyleName().isEmpty())
+ else if (!style.peCharStyleName().isEmpty())
//par effect is cleared but is set dcCharStyleName = clear drop cap char style
{
const QString& curParent(style.hasParent() ? style.parent() : style.name());
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&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 Apr 26 00:01:02 2014
@@ -1787,6 +1787,10 @@
m_Doc->setMasterPageMode(false);
m_Doc->reformPages();
m_Doc->refreshGuides();
+
+ // #12282 : some docs have language dependent style names specified in style properties
+ m_Doc->fixParagraphStyles();
+ m_Doc->fixNotesStyles();
if (m_Doc->Layers.count() == 0)
m_Doc->Layers.newLayer( QObject::tr("Background") );
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Apr 26 00:01:02 2014
@@ -6081,6 +6081,32 @@
}
}
+void ScribusDoc::fixParagraphStyles()
+{
+ for (int i = 0; i < docParagraphStyles.count(); ++i)
+ {
+ ParagraphStyle& parStyle = docParagraphStyles[i];
+ QString peStyleName = parStyle.peCharStyleName();
+ if (peStyleName.isEmpty())
+ continue;
+ if (!docCharStyles.contains(peStyleName))
+ parStyle.resetPeCharStyleName();
+ }
+}
+
+void ScribusDoc::fixNotesStyles()
+{
+ for (int i = 0; i < m_docNotesStylesList.count(); ++i)
+ {
+ NotesStyle* noteStyle = m_docNotesStylesList[i];
+ QString markChStyle = noteStyle->marksChStyle();
+ if (!markChStyle.isEmpty() && !docCharStyles.contains(markChStyle))
+ noteStyle->setMarksCharStyle(QString());
+ QString noteParStyle = noteStyle->notesParStyle();
+ if (!noteParStyle.isEmpty() && !docParagraphStyles.contains(noteParStyle))
+ noteStyle->setNotesParStyle(QString());
+ }
+}
struct oldPageVar
{
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Apr 26 00:01:02 2014
@@ -877,8 +877,13 @@
void reformPages(bool moveObjects = true);
/** @brief Refresh automatic guides once Margin struct has been properly configure by reformPages() */
void refreshGuides();
+
/** @brief Check and fix if needed PageItem OwnPage member */
void fixItemPageOwner();
+ /** @brief Fix paragraph styles */
+ void fixParagraphStyles();
+ /** @brief Fix notes styles */
+ void fixNotesStyles();
/**
* @brief Return the x or y offset for a page on the canvas
Modified: trunk/Scribus/scribus/styles/styleset.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&path=/trunk/Scribus/scribus/styles/styleset.h
==============================================================================
--- trunk/Scribus/scribus/styles/styleset.h (original)
+++ trunk/Scribus/scribus/styles/styleset.h Sat Apr 26 00:01:02 2014
@@ -28,6 +28,8 @@
return * styles[index];
}
+ inline bool contains(const QString& name) const;
+
inline int find(const QString& name) const;
inline const Style* resolve(const QString& name) const;
@@ -116,6 +118,15 @@
// delete (*it);
// styles.erase(it);
styles.removeAt(index);
+}
+
+template<class STYLE>
+inline bool StyleSet<STYLE>::contains(const QString& name) const
+{
+ for (int i=0; i < styles.count(); ++i)
+ if (styles[i]->name() == name)
+ return true;
+ return false;
}
template<class STYLE>
Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp Sat Apr 26 00:01:02 2014
@@ -519,7 +519,7 @@
connect(m_pwidget->dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int)));
connect(m_pwidget->parEffectOffset, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset()));
connect(m_pwidget->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool)));
- connect(m_pwidget->parEffectCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParEffectCharStyle(const QString&)));
+ connect(m_pwidget->parEffectCharStyleCombo, SIGNAL(activated(int)), this, SLOT(slotParEffectCharStyle(int)));
connect(m_pwidget->bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullet(bool)));
connect(m_pwidget->bulletStrEdit, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString)));
@@ -604,7 +604,7 @@
disconnect(m_pwidget->dropCapLines, SIGNAL(valueChanged(int)), this, SLOT(slotDropCapLines(int)));
disconnect(m_pwidget->parEffectOffset, SIGNAL(valueChanged(double)), this, SLOT(slotParEffectOffset()));
disconnect(m_pwidget->parEffectIndentBox, SIGNAL(toggled(bool)), this, SLOT(slotParEffectIndent(bool)));
- disconnect(m_pwidget->parEffectCharStyleCombo, SIGNAL(activated(const QString&)), this, SLOT(slotParEffectCharStyle(const QString&)));
+ disconnect(m_pwidget->parEffectCharStyleCombo, SIGNAL(activated(int)), this, SLOT(slotParEffectCharStyle(int)));
disconnect(m_pwidget->bulletBox, SIGNAL(toggled(bool)), this, SLOT(slotBullet(bool)));
disconnect(m_pwidget->bulletStrEdit, SIGNAL(editTextChanged(QString)), this, SLOT(slotBulletStr(QString)));
@@ -959,9 +959,14 @@
}
}
-void SMParagraphStyle::slotParEffectCharStyle(const QString& name)
-{
- if (m_pwidget->parEffectCharStyleCombo->useParentValue())
+void SMParagraphStyle::slotParEffectCharStyle(int index)
+{
+ QString name;
+
+ if (index > 0)
+ name = m_pwidget->parEffectCharStyleCombo->itemText(index);
+
+ if (name.isEmpty() || m_pwidget->parEffectCharStyleCombo->useParentValue())
for (int i = 0; i < m_selection.count(); ++i)
m_selection[i]->resetPeCharStyleName();
else
Modified: trunk/Scribus/scribus/ui/smtextstyles.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19089&path=/trunk/Scribus/scribus/ui/smtextstyles.h
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.h (original)
+++ trunk/Scribus/scribus/ui/smtextstyles.h Sat Apr 26 00:01:02 2014
@@ -76,7 +76,7 @@
void slotDropCapLines(int lines);
void slotParEffectOffset();
void slotParEffectIndent(bool);
- void slotParEffectCharStyle(const QString &name);
+ void slotParEffectCharStyle(int);
void slotBullet(bool isOn);
void slotBulletStr(const QString &str);
void slotNumeration(bool isOn);
More information about the scribus-commit
mailing list