Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 16394 → Rev 16396

/trunk/Scribus/scribus/scribusdoc.cpp
996,7 → 996,80
return false;
}
 
QList<int> ScribusDoc::getSortedStyleList()
{
QList<int> retList;
for (int ff = 0; ff < paragraphStyles().count(); ++ff)
{
if (paragraphStyles()[ff].parent().isEmpty())
{
if (!retList.contains(ff))
retList.append(ff);
}
else
{
QList<int> retList2;
QString par = paragraphStyles()[ff].parent();
retList2.prepend(ff);
while (!par.isEmpty())
{
for (int pp = 0; pp < paragraphStyles().count(); ++pp)
{
if (paragraphStyles()[pp].name() == par)
{
if (!retList2.contains(pp))
retList2.prepend(pp);
par = paragraphStyles()[pp].parent();
}
}
}
for (int r = 0; r < retList2.count(); ++r)
{
if (!retList.contains(retList2[r]))
retList.append(retList2[r]);
}
}
}
return retList;
}
 
QList<int> ScribusDoc::getSortedCharStyleList()
{
QList<int> retList;
for (int ff = 0; ff < docCharStyles.count(); ++ff)
{
if (docCharStyles[ff].parent().isEmpty())
{
if (!retList.contains(ff))
retList.append(ff);
}
else
{
QList<int> retList2;
QString par = docCharStyles[ff].parent();
retList2.prepend(ff);
while (!par.isEmpty())
{
for (int pp = 0; pp < docCharStyles.count(); ++pp)
{
if (docCharStyles[pp].name() == par)
{
if (!retList2.contains(pp))
retList2.prepend(pp);
par = docCharStyles[pp].parent();
}
}
}
for (int r = 0; r < retList2.count(); ++r)
{
if (!retList.contains(retList2[r]))
retList.append(retList2[r]);
}
}
}
return retList;
}
 
void ScribusDoc::replaceStyles(const QMap<QString,QString>& newNameForOld)
{
ResourceCollection newNames;
/trunk/Scribus/scribus/scribusdoc.h
519,6 → 519,8
void getNamedResources(ResourceCollection& lists) const;
void replaceNamedResources(ResourceCollection& newNames);
bool styleExists(QString styleName);
QList<int> getSortedStyleList();
QList<int> getSortedCharStyleList();
void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
/**
/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
66,17 → 66,33
}
QList<QString>::Iterator it;
QList<QString> names = lists.styleNames();
for (it = names.begin(); it != names.end(); ++it)
QList<int> styleList = m_Doc->getSortedStyleList();
for (int a = 0; a < styleList.count(); ++a)
{
putPStyle(writer, m_Doc->paragraphStyles().get(*it), "STYLE");
if (names.contains(m_Doc->paragraphStyles()[styleList[a]].name()))
putPStyle(writer, m_Doc->paragraphStyles()[styleList[a]], "STYLE");
}
// for (it = names.begin(); it != names.end(); ++it)
// {
// putPStyle(writer, m_Doc->paragraphStyles().get(*it), "STYLE");
// }
names = lists.charStyleNames();
for (it = names.begin(); it != names.end(); ++it)
styleList = m_Doc->getSortedCharStyleList();
for (int a = 0; a < styleList.count(); ++a)
{
writer.writeStartElement("CHARSTYLE");
putNamedCStyle(writer, m_Doc->charStyles().get(*it));
writer.writeEndElement();
if (names.contains(m_Doc->charStyles()[styleList[a]].name()))
{
writer.writeStartElement("CHARSTYLE");
putNamedCStyle(writer, m_Doc->charStyles()[styleList[a]]);
writer.writeEndElement();
}
}
// for (it = names.begin(); it != names.end(); ++it)
// {
// writer.writeStartElement("CHARSTYLE");
// putNamedCStyle(writer, m_Doc->charStyles().get(*it));
// writer.writeEndElement();
// }
/* names = lists.lineStyleNames();
for (it = names.begin(); it != names.end(); ++it)
{
548,11 → 564,16
 
void Scribus150Format::writePStyles(ScXmlStreamWriter & docu)
{
// if (m_Doc->docParagraphStyles.count() > 5)
QList<int> styleList = m_Doc->getSortedStyleList();
for (int a = 0; a < styleList.count(); ++a)
{
for (int ff = 0; ff < m_Doc->paragraphStyles().count(); ++ff)
putPStyle(docu, m_Doc->paragraphStyles()[ff], "STYLE");
putPStyle(docu, m_Doc->paragraphStyles()[styleList[a]], "STYLE");
}
// if (m_Doc->docParagraphStyles.count() > 5)
// {
// for (int ff = 0; ff < m_Doc->paragraphStyles().count(); ++ff)
// putPStyle(docu, m_Doc->paragraphStyles()[ff], "STYLE");
// }
}
 
void Scribus150Format::putPStyle(ScXmlStreamWriter & docu, const ParagraphStyle & style, const QString &nodeName)
628,12 → 649,19
 
void Scribus150Format::writeCStyles(ScXmlStreamWriter & docu)
{
for (int ff = 0; ff < m_Doc->charStyles().count(); ++ff)
QList<int> styleList = m_Doc->getSortedCharStyleList();
for (int a = 0; a < styleList.count(); ++a)
{
docu.writeStartElement("CHARSTYLE");
putNamedCStyle(docu, m_Doc->charStyles()[ff]);
putNamedCStyle(docu, m_Doc->charStyles()[styleList[a]]);
docu.writeEndElement();
}
// for (int ff = 0; ff < m_Doc->charStyles().count(); ++ff)
// {
// docu.writeStartElement("CHARSTYLE");
// putNamedCStyle(docu, m_Doc->charStyles()[ff]);
// docu.writeEndElement();
// }
}
 
void Scribus150Format::putCStylePT(ScXmlStreamWriter & docu, const CharStyle & style)