/branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp |
---|
1572,6 → 1572,11 |
m_Doc->reformPages(); |
m_Doc->refreshGuides(); |
// #12282 : some docs have language dependent style names specified in style properties |
// #14129 : some docs reference deleted character styles |
m_Doc->fixCharacterStyles(); |
m_Doc->fixParagraphStyles(); |
// Some old long doc may have page owner somewhat broken |
m_Doc->fixItemPageOwner(); |
/branches/Version14x/Scribus/scribus/scribusdoc.cpp |
---|
4533,7 → 4533,39 |
} |
} |
void ScribusDoc::fixCharacterStyles() |
{ |
for (int i = 0; i < docCharStyles.count(); ++i) |
{ |
CharStyle& charStyle = docCharStyles[i]; |
QString parentName = charStyle.parent(); |
if (parentName.isEmpty()) |
continue; |
if (!docCharStyles.contains(parentName)) |
charStyle.setParent(QString()); |
} |
} |
void ScribusDoc::fixParagraphStyles() |
{ |
for (int i = 0; i < docParagraphStyles.count(); ++i) |
{ |
ParagraphStyle& parStyle = docParagraphStyles[i]; |
QString parentName = parStyle.parent(); |
if (!parentName.isEmpty()) |
{ |
if (!docParagraphStyles.contains(parentName)) |
parStyle.setParent(QString()); |
} |
QString charStyleName = parStyle.charStyle().parent(); |
if (!charStyleName.isEmpty()) |
{ |
if (!docCharStyles.contains(charStyleName)) |
parStyle.charStyle().setParent(QString()); |
} |
} |
} |
struct oldPageVar |
{ |
uint newPg; |
/branches/Version14x/Scribus/scribus/scribusdoc.h |
---|
705,6 → 705,10 |
void refreshGuides(); |
/** @brief Check and fix if needed PageItem OwnPage member */ |
void fixItemPageOwner(); |
/** @brief Fix paragraph styles */ |
void fixCharacterStyles(); |
/** @brief Fix paragraph styles */ |
void fixParagraphStyles(); |
/** |
* @brief Return the x or y offset for a page on the canvas |
/branches/Version14x/Scribus/scribus/styles/styleset.h |
---|
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; |
113,6 → 115,15 |
} |
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> |
inline int StyleSet<STYLE>::find(const QString& name) const |
{ |
for (int i=0; i < styles.count(); ++i) |