Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12339 → Rev 12340

/branches/ScribusUIDStyles/scribus/styles/charstyle.cpp
105,12 → 105,13
 
 
 
void CharStyle::applyCharStyle(const CharStyle * other)
void CharStyle::applyCharStyle(const QString& other)
{
Style::applyStyle(other);
CharStyle *pOther = StylesLibrary::Char(other);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (! other->inh_##attr_NAME) \
set##attr_NAME(other->m_##attr_NAME);
if (! pOther->inh_##attr_NAME) \
set##attr_NAME(pOther->m_##attr_NAME);
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
updateFeatures();
117,12 → 118,13
}
 
 
void CharStyle::eraseCharStyle(const CharStyle * other)
void CharStyle::eraseCharStyle(const QString& other)
{
other->validate();
Style::eraseStyle(other);
CharStyle *pOther = StylesLibrary::Char(other);
pOther->validate();
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && m_##attr_NAME == other->m_##attr_NAME) \
if (!inh_##attr_NAME && m_##attr_NAME == pOther->m_##attr_NAME) \
reset##attr_NAME();
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
129,10 → 131,9
updateFeatures();
}
 
bool CharStyle::equiv(const Style & other) const
bool CharStyle::equiv(const QString & other) const
{
other.validate();
const CharStyle * oth = dynamic_cast<const CharStyle*> ( & other );
const CharStyle * oth = StylesLibrary::Char( other );
return oth &&
parent() == oth->parent()
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
189,19 → 190,6
}
 
 
void CharStyle::update(const StyleContext* context)
{
Style::update(context);
const CharStyle * oth = dynamic_cast<const CharStyle*> ( parentStyle() );
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (inh_##attr_NAME) \
m_##attr_NAME = oth->attr_GETTER();
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
}
updateFeatures();
}
 
 
 
380,14 → 368,14
 
 
 
void CharStyle::setStyle(const CharStyle* other)
void CharStyle::setStyle(const QString& other)
{
other->validate();
setParent(other->parent());
m_contextversion = -1;
CharStyle *pOther = StylesLibrary::Char(other);
pOther->validate();
setParent(pOther->parent());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
inh_##attr_NAME = other->inh_##attr_NAME; \
m_##attr_NAME = other->m_##attr_NAME;
inh_##attr_NAME = pOther->inh_##attr_NAME; \
m_##attr_NAME = pOther->m_##attr_NAME;
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
updateFeatures();
/branches/ScribusUIDStyles/scribus/styles/style.cpp
20,17 → 20,19
#include "desaxe/digester.h"
#include "desaxe/simple_actions.h"
#include "desaxe/saxiohelper.h"
#include "styleslibrary.h"
 
#include <QDebug>
#include <QUuid>
 
const QString Style::INHERIT_PARENT = "\n";
const QString Style::INHERIT_PARENT = QUuid().toString() ;
 
Style::Style()
: m_isDefaultStyle(false), m_uuid( QUuid::createUuid().toString() ), m_context(NULL), m_contextversion(-1), m_parent(QUuid().toString()), m_shortcut()
: m_isDefaultStyle(false), m_parent(QUuid().toString()), m_shortcut()
{
m_uuid = QUuid::createUuid().toString();
m_name = m_uuid;
StylesLibrary::add(m_name,this);
StylesLibrary::Add(m_uuid,this);
}
 
 
37,7 → 39,7
Style::Style( QString n, QString lang )
: m_isDefaultStyle(false), m_uuid( QUuid::createUuid().toString() ), m_name(n), m_parent(QUuid().toString()), m_shortcut()
{
StylesLibrary::add(m_name,this);
StylesLibrary::Add(m_uuid,this);
}
 
Style::Style(const Style& o)
45,14 → 47,10
m_isDefaultStyle(o.m_isDefaultStyle),
m_uuid( QUuid::createUuid().toString() ),
m_name(o.m_name),
// m_namesDB(o.m_namesDB),
m_userName(o.m_userName),
m_context(o.m_context),
m_contextversion(o.m_contextversion),
m_parent(o.m_parent),
m_shortcut(o.m_shortcut)
{
StylesLibrary::add(m_uuid,this);
StylesLibrary::Add(m_uuid,this);
}
 
Style& Style::operator=(const Style& o)
68,80 → 66,28
 
Style::~ Style()
{
StylesLibrary::remove(m_name);
StylesLibrary::Remove(m_name);
}
 
 
QString Style::displayName(/*const QString& lang*/) const
QString Style::name() const
{
// if ( !hasParent() || !m_context)
// {
// if(!lang.isEmpty())
// {
// if(m_namesDB.contains(lang))
// return m_namesDB.value(lang);
// else
// {
// return lang + "-" + m_name;
// }
// }
// else
// {
// QString la(PrefsManager::instance()->guiLanguage());
// if(m_namesDB.contains(la))
// return m_namesDB.value(la);
// else
// {
// return la+ "-" + m_name;
// }
// }
return m_userName;
// }
// else
// {
// return parentStyle()->displayName(/*lang*/) + "+";
// }
return m_name;
}
 
QString Style::uuid() const
{
// qDebug()<<"NAME"<<m_name<<m_userName<<m_parent;
return m_name;
return m_uuid;
}
 
void Style::setName(const QString& n/* , const QString& lang*/)
void Style::setName(const QString& n)
{
// if(!lang.isEmpty())
// {
// if(!n.isEmpty())
// m_namesDB[lang] = n;
// else
// m_namesDB[lang] = lang+"-"+m_name;
// }
// else
// {
// QString la(PrefsManager::instance()->guiLanguage());
// if(!n.isEmpty())
// m_namesDB[la] = n;
// else
// m_namesDB[la] = la+"-"+m_name;
// }
m_userName = n;
qDebug()<<"SET_NAME"<<m_name<<m_userName<<m_parent;
 
m_name = n;
}
 
bool Style::hasName(/*const QString& lang*/) const
bool Style::hasName() const
{
// if( lang.isEmpty() )
// {
// return m_namesDB.contains(PrefsManager::instance()->guiLanguage());
// }
//
// return m_namesDB.contains(lang);
qDebug()<<"HAS_NAME"<<m_name<<m_userName<<m_parent;
return m_name != m_userName; // here we can’t have anon style
return m_name != m_uuid;
}
 
QString Style::parent() const
151,15 → 97,7
 
void Style::setParent(const QString& p)
{
if (m_parent != p)
m_contextversion = -1;
// if(QUuid(p).isNull())
// m_parent = QUuid().toString();
// else
// m_parent = p;
m_parent = QUuid(p).toString();
qDebug()<<"SET_PARENT("<<p<<")"<< m_userName << m_parent ;
}
 
bool Style::hasParent() const
168,56 → 106,20
}
 
 
 
 
 
 
void Style::setContext(const StyleContext* context)
void Style::validate() const
{
if (m_context != context) {
m_context = context;
m_contextversion = -1;
assert( !m_context || m_context->checkConsistency() );
}
//qDebug(QString("setContext of %2 context %1").arg(reinterpret_cast<uint>(m_context),16).arg(reinterpret_cast<uint>(this),16));
}
 
 
void Style::update(const StyleContext* b)
{
if (b)
m_context = b;
if (m_context)
m_contextversion = m_context->version();
}
 
void Style::validate() const
{
if (m_context && m_contextversion != m_context->version()) {
const_cast<Style*>(this)->update(m_context);
assert( m_context->checkConsistency() );
}
}
 
 
const Style* Style::parentStyle() const
{
// qDebug()<<"parentStyle()"<< m_userName << m_parent;
const Style * par = m_context ? m_context->resolve(m_parent) : NULL;
const Style * par = QUuid(m_parent).isNull() ? NULL : StylesLibrary::BaseStyle(m_parent) ;
if (par == this)
{
return NULL;
}
else
{
if( !par && hasParent() )
{
qDebug()<<"PARENT_STYLE_FAILED"<<m_context<< m_userName << m_parent;
}
return par;
}
return par;
}
 
void Style::saxxAttributes(Xml_attr& attr) const
230,18 → 132,18
attr["shortcut"] = shortcut();
}
 
void Style::applyStyle(const Style* other)
void Style::applyStyle(const QString& other)
{
if (other->hasParent())
setParent( other->parent() == INHERIT_PARENT? QUuid().toString() :other->parent());
m_contextversion = -1;
Style *pOther = StylesLibrary::BaseStyle( other );
if (pOther && pOther->hasParent())
setParent( pOther->parent() == INHERIT_PARENT ? QUuid().toString() : pOther->parent());
}
 
void Style::eraseStyle(const Style* other)
void Style::eraseStyle(const QString& other)
{
if (other->parent() == parent())
Style *pOther = StylesLibrary::BaseStyle( other );
if ( pOther && pOther->parent() == parent())
setParent(QUuid().toString());
m_contextversion = -1;
}
 
 
/branches/ScribusUIDStyles/scribus/styles/charstyle.h
126,18 → 126,16
 
// QString displayName() const;
 
void update(const StyleContext * b);
/** This method may alter any of the attributes depending on the value of 'features'.
Used for font effects */
void updateFeatures();
bool equiv(const Style& other) const;
bool equiv(const QString& other) const;
void applyCharStyle(const CharStyle * other);
void eraseCharStyle(const CharStyle * other);
void setStyle(const CharStyle * other);
void erase() { eraseCharStyle(this); }
void applyCharStyle(const QString& other);
void eraseCharStyle(const QString& other);
void setStyle(const QString& other);
void erase() { eraseCharStyle(uuid()); }
QString asString() const;
209,8 → 207,6
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
m_Effects = other.m_Effects;
// m_context = NULL;
m_contextversion = -1;
return *this;
}
 
222,8 → 218,6
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
m_Effects = other.m_Effects;
// m_context = NULL;
m_contextversion = -1;
}
 
#endif
/branches/ScribusUIDStyles/scribus/styles/linestyle.cpp
12,6 → 12,7
#include "resourcecollection.h"
 
#include "styles/style.h"
#include "styleslibrary.h"
#include "linestyle.h"
#include "desaxe/saxiohelper.h"
#include "desaxe/simple_actions.h"
18,32 → 19,34
#include "prefsmanager.h"
 
 
void LineStyle::applyLineStyle(const LineStyle * other)
void LineStyle::applyLineStyle(const QString& other)
{
Style::applyStyle(other);
LineStyle *pOther = StylesLibrary::Line(other);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (! other->inh_##attr_NAME) \
set##attr_NAME(other->m_##attr_NAME);
if (! pOther->inh_##attr_NAME) \
set##attr_NAME(pOther->m_##attr_NAME);
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
 
 
void LineStyle::eraseLineStyle(const LineStyle * other)
void LineStyle::eraseLineStyle(const QString& other)
{
other->validate();
Style::eraseStyle(other);
LineStyle *pOther = StylesLibrary::Line(other);
pOther->validate();
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && m_##attr_NAME == other->m_##attr_NAME) \
if (!inh_##attr_NAME && m_##attr_NAME == pOther->m_##attr_NAME) \
reset##attr_NAME();
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
 
bool LineStyle::equiv(const Style & other) const
bool LineStyle::equiv(const QString& other) const
{
other.validate();
const LineStyle * oth = dynamic_cast<const LineStyle*> ( & other );
const LineStyle * oth = StylesLibrary::Line( other );
return oth &&
parent() == oth->parent()
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
98,27 → 101,16
}
 
 
void LineStyle::update(const StyleContext* context)
{
Style::update(context);
const LineStyle * oth = dynamic_cast<const LineStyle*> ( parentStyle() );
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (inh_##attr_NAME) \
m_##attr_NAME = oth->attr_GETTER();
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
}
 
 
void LineStyle::setStyle(const LineStyle* other)
void LineStyle::setStyle(const QString& other)
{
other->validate();
setParent(other->parent());
LineStyle *pOther = StylesLibrary::Line(other);
pOther->validate();
setParent(pOther->parent());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
inh_##attr_NAME = other->inh_##attr_NAME; \
m_##attr_NAME = other->m_##attr_NAME;
inh_##attr_NAME = pOther->inh_##attr_NAME; \
m_##attr_NAME = pOther->m_##attr_NAME;
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
/branches/ScribusUIDStyles/scribus/styles/styleslibrary.cpp
12,6 → 12,8
 
#include "styleslibrary.h"
 
#include <QDebug>
 
StylesLibrary *StylesLibrary::instance = 0;
StylesLibrary::StylesLibrary()
{
28,7 → 30,7
void StylesLibrary::Add(const QString& uuid, Style* style)
{
getThis()->insert(uuid,style);
qDebug()<<"ADD"<<style->displayName()<<getThis()->count();
qDebug()<<"ADD"<<style->name()<<getThis()->count();
}
 
void StylesLibrary::Remove(const QString& uuid)
38,7 → 40,7
}
 
Style * StylesLibrary::Style(const QString & uuid)
Style * StylesLibrary::BaseStyle(const QString & uuid)
{
if(getThis()->contains(uuid))
{
86,7 → 88,7
StylesLibrary *sThis(getThis());
for(StylesLibrary::iterator it = sThis->begin() ; it != sThis->end() ; ++it)
{
if(it->displayName() == dName)
if((*it)->name() == dName)
return it.key();
}
return QString();
93,3 → 95,7
}
 
 
int StylesLibrary::Count()
{
return getThis()->count();
}
/branches/ScribusUIDStyles/scribus/styles/linestyle.h
20,13 → 20,13
#include <QString>
#include "resourcecollection.h"
#include "style.h"
#include "styles/stylecontextproxy.h"
// #include "styles/stylecontextproxy.h"
 
class SCRIBUS_API LineStyle : public Style {
public:
 
LineStyle() : Style(), lineStyleProxy(this) {
LineStyle() : Style() {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = attr_DEFAULT; \
inh_##attr_NAME = true;
34,7 → 34,7
#undef ATTRDEF
};
LineStyle(double width, const QString& color, double shade=100) : Style(), lineStyleProxy(this) {
LineStyle(double width, const QString& color, double shade=100) : Style() {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = attr_DEFAULT; \
inh_##attr_NAME = true;
57,17 → 57,13
void getNamedResources(ResourceCollection& lists) const;
void replaceNamedResources(ResourceCollection& newNames);
 
// QString displayName() const;
 
void update(const StyleContext * b);
bool equiv(const Style& other) const;
bool equiv(const QString& other) const;
void applyLineStyle(const LineStyle * other);
void eraseLineStyle(const LineStyle * other);
void setStyle(const LineStyle * other);
void erase() { eraseLineStyle(this); }
void applyLineStyle(const QString& other);
void eraseLineStyle(const QString& other);
void setStyle(const QString& other);
void erase() { eraseLineStyle(uuid()); }
QString asString() const;
113,7 → 109,7
private:
 
StyleContextProxy lineStyleProxy;
// StyleContextProxy lineStyleProxy;
// FIXME: see pstyle how this works for nested styles
135,11 → 131,10
inh_##attr_NAME = other.inh_##attr_NAME;
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
m_contextversion = -1;
return *this;
}
 
inline LineStyle::LineStyle(const LineStyle & other) : Style(other), lineStyleProxy(this)
inline LineStyle::LineStyle(const LineStyle & other) : Style(other)
{
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = other.m_##attr_NAME; \
146,7 → 141,6
inh_##attr_NAME = other.inh_##attr_NAME;
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
m_contextversion = -1;
}
 
#endif
/branches/ScribusUIDStyles/scribus/styles/styleslibrary.h
32,11 → 32,12
public:
static void Add(const QString& uuid, Style* style);
static void Remove(const QString& uuid);
static Style* Style(const QString& uuid);
static Style* BaseStyle(const QString& uuid);
static LineStyle* Line(const QString& uuid);
static CharStyle* Char(const QString& uuid);
static ParagraphStyle* Paragraph(const QString& uuid);
static QString Find(const QString& dName);
static int Count();
};
 
/branches/ScribusUIDStyles/scribus/styles/paragraphstyle.cpp
22,13 → 22,12
#include "styleslibrary.h"
 
 
ParagraphStyle::ParagraphStyle() : Style(), cstyleContext(NULL), cstyleContextIsInh(true)/*, cstyle()*/
ParagraphStyle::ParagraphStyle() : Style()
{
setParent("");
CharStyle *csP(new CharStyle);
csP->setName( "CSTYLE" + displayName());
csP->setName( "CSTYLE" + name() );
cstyle = csP->uuid();
cstyleContext.setDefaultStyle( csP );
// qDebug(QString("ParagraphStyle() %1 pcontext %2 ccontext %3").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(context())).arg(reinterpret_cast<uint>(defaultStyle()->context())));
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
m_##attr_NAME = attr_DEFAULT; \
40,14 → 39,8
}
 
 
ParagraphStyle::ParagraphStyle(const ParagraphStyle& other) : Style(other), cstyleContext(NULL), cstyleContextIsInh(other.cstyleContextIsInh), cstyle(other.charStyle()->uuid())
ParagraphStyle::ParagraphStyle(const ParagraphStyle& other) : Style(other), cstyle(other.charStyle())
{
// if (cstyleContextIsInh)
// cstyle.setContext(NULL);
// else
// cstyle.setContext(other.charStyle().context());
cstyleContext.setDefaultStyle( reinterpret_cast<CharStyle*>(StylesLibrary::style( cstyle )) );
// qDebug(QString("ParagraphStyle(%2) %1").arg(reinterpret_cast<uint>(&other)).arg(reinterpret_cast<uint>(this)));
other.validate();
 
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
76,12 → 69,11
// }
//
 
bool ParagraphStyle::equiv(const Style& other) const
bool ParagraphStyle::equiv(const QString& other) const
{
other.validate();
const ParagraphStyle* oth = dynamic_cast<const ParagraphStyle*> ( & other );
const ParagraphStyle* oth = StylesLibrary::Paragraph( other );
return oth &&
parent() == oth->parent() && (cstyle == oth->charStyle()->uuid() )
parent() == oth->parent() && (cstyle == oth->charStyle() )
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
&& (inh_##attr_NAME == oth->inh_##attr_NAME) \
&& (inh_##attr_NAME || m_##attr_NAME == oth->m_##attr_NAME)
114,7 → 106,7
static_cast<Style&>(*this) = static_cast<const Style&>(other);
 
other.validate();
cstyle = other.charStyle()->uuid() ;
cstyle = other.charStyle() ;
 
// // we dont want cstyleContext to point to other's charstyle...
// cstyleContext.setDefaultStyle( StylesLibrary::Char( cstyle ) );
138,87 → 130,44
}
 
 
void ParagraphStyle::setContext(const StyleContext* context)
{
Style::setContext(context);
// qDebug(QString("ParagraphStyle::setContext(%1) parent=%2").arg((unsigned long int)context).arg((unsigned long int)oth));
repairImplicitCharStyleInheritance();
}
 
void ParagraphStyle::repairImplicitCharStyleInheritance()
{
if (cstyleContextIsInh) {
const ParagraphStyle * newParent = dynamic_cast<const ParagraphStyle*> ( parentStyle() );
StylesLibrary::Char( cstyle )->setContext(newParent ? newParent->charStyleContext() : NULL);
}
}
 
 
void ParagraphStyle::breakImplicitCharStyleInheritance(bool val)
{
cstyleContextIsInh = !val;
repairImplicitCharStyleInheritance();
}
 
void ParagraphStyle::update(const StyleContext* context)
void ParagraphStyle::applyStyle(const QString& other)
{
Style::update(context);
// assert ( &cstyleContext != cstyle.context());
 
repairImplicitCharStyleInheritance();
// assert ( &cstyleContext != cstyle.context());
StylesLibrary::Char(cstyle)->validate();
cstyleContext.invalidate();
 
const ParagraphStyle * oth = dynamic_cast<const ParagraphStyle*> ( parentStyle() );
// qDebug(QString("ParagraphStyle::update(%1) parent=%2").arg((unsigned long int)context).arg((unsigned long int)oth));
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (inh_##attr_NAME) \
m_##attr_NAME = oth->attr_GETTER();
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
}
}
 
 
 
void ParagraphStyle::applyStyle(const ParagraphStyle* other)
{
ParagraphStyle *pOther = StylesLibrary::Paragraph(other);
Style::applyStyle(other);
StylesLibrary::Char(cstyle)->applyCharStyle(other->charStyle());
cstyleContext.invalidate();
StylesLibrary::Char(cstyle)->applyCharStyle(pOther->charStyle());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (! other->inh_##attr_NAME) \
set##attr_NAME(other->m_##attr_NAME);
if (! pOther->inh_##attr_NAME) \
set##attr_NAME(pOther->m_##attr_NAME);
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
}
 
 
void ParagraphStyle::eraseStyle(const ParagraphStyle* other)
void ParagraphStyle::eraseStyle(const QString& other)
{
other->validate();
ParagraphStyle *pOther = StylesLibrary::Paragraph(other);
pOther->validate();
Style::eraseStyle(other);
StylesLibrary::Char(cstyle)->eraseCharStyle(other->charStyle());
cstyleContext.invalidate();
StylesLibrary::Char(cstyle)->eraseCharStyle(pOther->charStyle());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && m_##attr_NAME == other->m_##attr_NAME) \
if (!inh_##attr_NAME && m_##attr_NAME == pOther->m_##attr_NAME) \
reset##attr_NAME();
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
}
 
void ParagraphStyle::setStyle(const ParagraphStyle * other)
void ParagraphStyle::setStyle(const QString& other)
{
other->validate();
setParent(other->parent());
m_contextversion = -1;
StylesLibrary::Char(cstyle)->setStyle(other->charStyle());
cstyleContext.invalidate();
ParagraphStyle *pOther = StylesLibrary::Paragraph(other);
pOther->validate();
setParent(pOther->parent());
StylesLibrary::Char(cstyle)->setStyle(pOther->charStyle());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
inh_##attr_NAME = other->inh_##attr_NAME; \
m_##attr_NAME = other->m_##attr_NAME;
inh_##attr_NAME = pOther->inh_##attr_NAME; \
m_##attr_NAME = pOther->m_##attr_NAME;
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
}
228,7 → 177,7
{
for (const Style *sty = parentStyle(); sty != NULL; sty = sty->parentStyle())
lists.collectStyle(sty->uuid());
charStyle()->getNamedResources(lists);
StylesLibrary::Char( cstyle )->getNamedResources(lists);
}
 
 
239,7 → 188,6
if (hasParent() && (it = (newNames.styles().find(parent()))) != newNames.styles().end())
{
setParent(it.value());
repairImplicitCharStyleInheritance();
}
StylesLibrary::Char(cstyle)->replaceNamedResources(newNames);
}
369,13 → 317,3
Xml_string tabPrefix(Digester::concat(stylePrefix, "tabstop"));
ruleset.addRule(tabPrefix, SetTabStop());
}
 
ParagraphStyle * charStyle()
{
return StylesLibrary::style(cstyle);
}
 
ParagraphStyle * charStyle() const
{
return StylesLibrary::style(cstyle);
}
/branches/ScribusUIDStyles/scribus/styles/paragraphstyle.h
18,7 → 18,7
 
#include "style.h"
#include "charstyle.h"
#include "styles/stylecontextproxy.h"
// #include "styles/stylecontextproxy.h"
 
 
class ResourceCollection;
83,30 → 83,20
 
// QString displayName() const;
 
void setContext(const StyleContext* context);
void update(const StyleContext*);
 
bool equiv(const Style& other) const;
bool equiv(const QString& other) const;
void applyStyle(const ParagraphStyle* other);
void eraseStyle(const ParagraphStyle* other);
void setStyle(const ParagraphStyle* other);
void erase() { eraseStyle(this); }
void applyStyle(const QString& other);
void eraseStyle(const QString& other);
void setStyle(const QString& other);
void erase() { eraseStyle(uuid()); }
 
StyleContext* charStyleContext() { return & cstyleContext; }
const StyleContext* charStyleContext() const { return & cstyleContext; }
CharStyle * charStyle() ;
const CharStyle* charStyle() const ;
/** Normally the context for charStyle() is parentStyle()->charStyleContext()
Use this method to break that relation and set charStyle()'s context manually
*/
void breakImplicitCharStyleInheritance(bool val = true);
/** used internally to establish the implicit relation
charStyle().context() == parentStyle()->charStyleContext()
Done implicitly in setContext(), update(), operator= and breakImplicitCharStyleInheritance()
*/
void repairImplicitCharStyleInheritance();
QString charStyle(){ return cstyle;}
const QString charStyle() const { return cstyle;}
 
/** getter: validates and returns the attribute's value */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
151,8 → 141,6
private:
// member declarations:
StyleContextProxy cstyleContext;
bool cstyleContextIsInh;
QString cstyle;
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
/branches/ScribusUIDStyles/scribus/text/sctext_shared.cpp
9,26 → 9,15
#include "sctext_shared.h"
#include "util.h"
 
ScText_Shared::ScText_Shared(const StyleContext* pstyles) : QList<ScText*>(),
defaultStyle(),
pstyleContext(NULL),
refs(1), len(0), trailingStyle()
ScText_Shared::ScText_Shared() : QList<ScText*>(),refs(1), len(0)
{
pstyleContext.setDefaultStyle( & defaultStyle );
defaultStyle.setContext( pstyles );
trailingStyle.setContext( &pstyleContext );
// defaultStyle.charStyle().setContext( cstyles );
// qDebug(QString("ScText_Shared() %1 %2 %3 %4").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(&defaultStyle)).arg(reinterpret_cast<uint>(pstyles)).arg(reinterpret_cast<uint>(cstyles)));
}
 
ScText_Shared::ScText_Shared(const ScText_Shared& other) : QList<ScText*>(),
defaultStyle(other.defaultStyle),
pstyleContext(other.pstyleContext),
refs(1), len(0), trailingStyle(other.trailingStyle)
{
pstyleContext.setDefaultStyle( &defaultStyle );
trailingStyle.setContext( &pstyleContext );
QListIterator<ScText*> it( other );
ScText* elem;
while ( it.hasNext() ) {
35,15 → 24,8
elem = it.next();
ScText* elem2 = new ScText(*elem);
append(elem2);
if (elem2->parstyle) {
elem2->parstyle->setContext( & pstyleContext);
// elem2->parstyle->charStyle().setContext( defaultStyle.charStyleContext() );
replaceCharStyleContextInParagraph(count()-1, elem2->parstyle->charStyleContext());
}
}
len = count();
replaceCharStyleContextInParagraph(len, trailingStyle.charStyleContext() );
// qDebug(QString("ScText_Shared(%2) %1").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(&other)));
}
 
ScText_Shared& ScText_Shared::operator= (const ScText_Shared& other)
52,10 → 34,6
{
defaultStyle = other.defaultStyle;
trailingStyle = other.trailingStyle;
pstyleContext = other.pstyleContext;
pstyleContext.setDefaultStyle( &defaultStyle );
defaultStyle.setContext( other.defaultStyle.context() );
trailingStyle.setContext( &pstyleContext );
clear();
QListIterator<ScText*> it( other );
ScText* elem;
63,22 → 41,9
elem = it.next();
ScText* elem2 = new ScText(*elem);
append(elem2);
if (elem2->parstyle) {
elem2->parstyle->setContext( & pstyleContext );
// qDebug(QString("StoryText::copy: * %1 align=%2").arg(elem2->parstyle->parent())
// .arg(elem2->parstyle->alignment())
// .arg((uint)elem2->parstyle->context()));
// elem2->parstyle->charStyle().setContext( defaultStyle.charStyleContext() );
replaceCharStyleContextInParagraph(count()-1, elem2->parstyle->charStyleContext());
}
}
len = count();
pstyleContext.invalidate();
// qDebug(QString("StoryText::copy: %1 align=%2 %3").arg(trailingStyle.parentStyle()->name())
// .arg(trailingStyle.alignment()).arg((uint)trailingStyle.context()));
replaceCharStyleContextInParagraph(len, trailingStyle.charStyleContext());
}
// qDebug(QString("ScText_Shared: %1 = %2").arg(reinterpret_cast<uint>(this)).arg(reinterpret_cast<uint>(&other)));
return *this;
}
 
89,54 → 54,3
delete this->takeFirst();
}
 
/**
A char's stylecontext is the containing paragraph's style,
This routines makes sure that all charstyles look for defaults
in the parstyle first.
*/
void ScText_Shared::replaceCharStyleContextInParagraph(int pos, const StyleContext* newContext)
{
assert (pos >= 0);
assert (pos <= size());
if (pos < size())
value(pos)->setContext(newContext);
for (int i=pos-1; i >=0 ; --i )
{
if ( (at(i)->ch) == SpecialChars::PARSEP)
break;
value(i)->setContext(newContext);
}
// we are done here but will do a sanity check:
// assert that all chars point to the following parstyle
QListIterator<ScText*> it( *this );
const StyleContext* lastContext = NULL;
while ( it.hasNext() ) {
ScText* elem = it.next();
assert( elem );
if ( elem->ch.isNull() )
{
// nothing, see code in removeParSep
}
else if (elem->ch == SpecialChars::PARSEP)
{
assert( elem->parstyle );
if ( lastContext )
{
assert( lastContext == elem->parstyle->charStyleContext() );
}
lastContext = NULL;
}
else if (lastContext == NULL)
{
lastContext = elem->context();
}
else
{
assert( lastContext == elem->context() );
}
}
if ( lastContext )
assert( lastContext == trailingStyle.charStyleContext() );
}
 
/branches/ScribusUIDStyles/scribus/text/sctext_shared.h
12,31 → 12,23
// #include "styles/charstyle.h"
// #include "styles/paragraphstyle.h"
#include "styles/styleslibrary.h"
#include "styles/stylecontextproxy.h"
// #include "styles/stylecontextproxy.h"
 
 
class SCRIBUS_API ScText_Shared : public QList<ScText*>
{
public:
ParagraphStyle defaultStyle;
StyleContextProxy pstyleContext;
QString defaultStyle;
QString trailingStyle;
uint refs;
uint len;
ParagraphStyle trailingStyle;
ScText_Shared(const StyleContext* pstyles);
 
uint len;
ScText_Shared();
ScText_Shared(const ScText_Shared& other);
 
ScText_Shared& operator= (const ScText_Shared& other);
 
~ScText_Shared();
/**
A char's stylecontext is the containing paragraph's style,
This routines makes sure that all charstyles look for defaults
in the parstyle first.
*/
void replaceCharStyleContextInParagraph(int pos, const StyleContext* newContext);
};
 
#endif /*SCTEXT_SHARED_H*/
/branches/ScribusUIDStyles/scribus/text/storytext.cpp
41,14 → 41,9
 
StoryText::StoryText(ScribusDoc * doc_) : doc(doc_)
{
if (doc_) {
d = new ScText_Shared(&doc_->paragraphStyles());
doc->paragraphStyles().connect(this, SLOT(invalidateAll()));
doc->charStyles().connect(this, SLOT(invalidateAll()));
}
else {
d = new ScText_Shared(NULL);
}
d = new ScText_Shared();
selFirst = 0;
selLast = -1;
63,7 → 58,7
 
StoryText::StoryText() : doc(NULL)
{
d = new ScText_Shared(NULL);
d = new ScText_Shared();
 
selFirst = 0;
selLast = -1;
79,11 → 74,6
d = other.d;
d->refs++;
if(doc) {
doc->paragraphStyles().connect(this, SLOT(invalidateAll()));
doc->charStyles().connect(this, SLOT(invalidateAll()));
}
selFirst = 0;
selLast = -1;
140,18 → 130,10
delete d;
}
if(doc) {
doc->paragraphStyles().disconnect(this, SLOT(invalidateAll()));
doc->charStyles().disconnect(this, SLOT(invalidateAll()));
}
doc = other.doc;
d = other.d;
if (doc) {
doc->paragraphStyles().connect(this, SLOT(invalidateAll()));
doc->charStyles().connect(this, SLOT(invalidateAll()));
}
selFirst = 0;
selLast = -1;
172,8 → 154,8
firstFrameItem = 0;
lastFrameItem = -1;
d->defaultStyle.erase();
d->trailingStyle.erase();
// d->defaultStyle.erase();
// d->trailingStyle.erase();
d->clear();
d->len = 0;
191,7 → 173,7
// this style represents all differences between this and other's defaultstyles
QString otherDefault(other.defaultStyle());
StylesLibrary::style( otherDefault )->eraseStyle( StylesLibrary::style( defaultStyle() ) );
StylesLibrary::BaseStyle( otherDefault )->eraseStyle( defaultStyle() );
int otherStart = onlySelection? other.startOfSelection() : 0;
int otherEnd = onlySelection? other.endOfSelection() : other.length();
204,7 → 186,7
int len = i - cstyleStart;
if (len > 0) {
insertCharsWithSmartHyphens(pos, other.textWithSmartHyphens(cstyleStart, len));
applyCharStyle(pos, len, otherDefault.charStyle());
applyCharStyle(pos, len, otherDefault);
applyCharStyle(pos, len, cstyle);
pos += len;
}
230,7 → 212,7
int len = otherEnd - cstyleStart;
if (len > 0) {
insertCharsWithSmartHyphens(pos, other.textWithSmartHyphens(cstyleStart, len));
applyCharStyle(pos, len, otherDefault.charStyle());
applyCharStyle(pos, len, otherDefault);
applyCharStyle(pos, len, cstyle);
pos += len;
if (other.text(otherEnd-1) != SpecialChars::PARSEP) {
249,14 → 231,14
void StoryText::insertParSep(int pos)
{
ScText* it = item_p(pos);
if(!it->parstyle) {
it->parstyle = new ParagraphStyle(paragraphStyle(pos+1));
it->parstyle->setContext( & d->pstyleContext);
// if(!it->parstyle) {
it->parstyle = paragraphStyle(pos+1);
// it->parstyle->setContext( & d->pstyleContext);
// it->parstyle->setName("para"); // DONT TRANSLATE
// it->parstyle->charStyle().setName("cpara"); // DONT TRANSLATE
// it->parstyle->charStyle().setContext( d->defaultStyle.charStyleContext() );
}
d->replaceCharStyleContextInParagraph(pos, it->parstyle->charStyleContext());
// }
// d->replaceCharStyleContextInParagraph(pos, it->parstyle->charStyleContext());
}
/**
need to remove the ParagraphStyle structure and replace all pointers
265,17 → 247,17
void StoryText::removeParSep(int pos)
{
ScText* it = item_p(pos);
if (it->parstyle) {
// if (it->parstyle) {
// const CharStyle* oldP = & it->parstyle->charStyle();
// const CharStyle* newP = & that->paragraphStyle(pos+1).charStyle();
// d->replaceParentStyle(pos, oldP, newP);
delete it->parstyle;
it->parstyle = 0;
}
// delete it->parstyle;
it->parstyle = "";
// }
// demote this parsep so the assert code in replaceCharStyleContextInParagraph()
// doesnt choke:
it->ch = 0;
d->replaceCharStyleContextInParagraph(pos, paragraphStyle(pos+1).charStyleContext());
// d->replaceCharStyleContextInParagraph(pos, paragraphStyle(pos+1).charStyleContext());
}
 
void StoryText::removeChars(int pos, uint len)
319,7 → 301,6
if (txt.length() == 0)
return;
const StyleContext* cStyleContext = paragraphStyle(pos).charStyleContext();
 
ScText clone;
if (applyNeighbourStyle)
332,7 → 313,6
for (int i = 0; i < txt.length(); ++i) {
ScText * item = new ScText(clone);
item->ch= txt.at(i);
item->setContext(cStyleContext);
d->insert(pos + i, item);
d->len++;
if (item->ch == SpecialChars::PARSEP) {
638,7 → 618,7
 
 
 
void StoryText::eraseCharStyle(int pos, uint len, const CharStyle& style )
void StoryText::eraseCharStyle(int pos, uint len, const QString& style )
{
if (pos < 0)
pos += length();
693,7 → 673,7
invalidate(pos, qMin(i, length()));
}
 
void StoryText::eraseStyle(int pos, const ParagraphStyle& style)
void StoryText::eraseStyle(int pos, const QString& style)
{
if (pos < 0)
pos += length();
/branches/ScribusUIDStyles/scribus/text/storytext.h
134,9 → 134,9
void setCharStyle(int pos, uint len, const QString& style);
void setStyle(int pos, const QString& style);
void applyCharStyle(int pos, uint len, const QString& style);
void applyStyle(int pos, const ParagraphStyle& style);
void eraseCharStyle(int pos, uint len, const CharStyle& style);
void eraseStyle(int pos, const ParagraphStyle& style);
void applyStyle(int pos, const QString& style);
void eraseCharStyle(int pos, uint len, const QString& style);
void eraseStyle(int pos, const QString& style);
void replaceStyles(QMap<QString,QString> newNameForOld);
void replaceCharStyles(QMap<QString,QString> newNameForOld);
/branches/ScribusUIDStyles/scribus/style.h
38,9 → 38,8
class SCRIBUS_API Style : public SaxIO {
protected:
bool m_isDefaultStyle;
// QMap<QString,QString> m_namesDB; // map< lang , name >
QString m_name; // transitional
QString m_uuid;
QString m_name;
QString m_parent;
QString m_shortcut;
public:
47,8 → 46,8
// static const short NOVALUE = -16000;
 
// default constructor
// create an UUID for its name and null UUID for its parent member
// name the style lang+"-"+m_name for current gui language
// create an UUID for itself and null UUID for its parent member
// name the style the same as m_uuid so hasName() return false until a proper name has been set
Style();
 
// if lang is null, which likely will be the rule, we get it from gui language
73,7 → 72,8
void setDefaultStyle(bool ids) { m_isDefaultStyle = ids; }
bool isDefaultStyle() const { return m_isDefaultStyle; }
QString uuid() const ; // returns the UUID, at some point has to be changed into uuid()
QString uuid() const ; // returns the UUID, at some point has to be changed into uuid() - cannot be reset
QString name() const ; // returns the human-readable name
void setName(const QString& n = QString()/*, const QString& lang = QString()*/);
bool hasName(/*const QString& lang = QString()*/) const ;
88,6 → 88,9
QString shortcut() const { return m_shortcut; }
void setShortcut(const QString &shortcut) { m_shortcut = shortcut; }
/// We keep it under the hood
void validate() const;
 
/**
returns true if both Styles are of the same type, inherit the same attributes,
116,7 → 119,13
if other has the same parent, remove this parent
*/
void eraseStyle(const QString& other) ;
const Style* parentStyle() const;
// make us life easier
operator const QString&(){return m_uuid;}
};
 
 
 
#endif
/branches/ScribusUIDStyles/scribus/smtextstyles.h
9,7 → 9,7
#define SMTEXTSTYLES_H
 
#include "styleitem.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
// #include "styles/paragraphstyle.h"
#include "styles/styleslibrary.h"
 
/branches/ScribusUIDStyles/scribus/resourcecollection.h
21,6 → 21,9
#include <QMap>
#include <QString>
 
class SCFonts;
class ColorList;
 
/**
* A simple structure which holds the names of all resources & styles used in a doc or part of a document.
* Also holds pointers to the doc's fontset and colorset.
/branches/ScribusUIDStyles/scribus/scribusdoc.cpp
935,12 → 935,12
}
 
 
void ScribusDoc::replaceStyles(const QMap<QString,QString>& newNameForOld)
{
ResourceCollection newNames;
newNames.mapStyles(newNameForOld);
replaceNamedResources(newNames);
}
// void ScribusDoc::replaceStyles(const QMap<QString,QString>& newNameForOld)
// {
// ResourceCollection newNames;
// newNames.mapStyles(newNameForOld);
// replaceNamedResources(newNames);
// }
 
 
void ScribusDoc::replaceNamedResources(ResourceCollection& newNames)
1012,52 → 1012,52
}
 
 
void ScribusDoc::replaceCharStyles(const QMap<QString,QString>& newNameForOld)
{
ResourceCollection newNames;
newNames.mapCharStyles(newNameForOld);
replaceNamedResources(newNames);
/*
// replace style in items
QPtrList<PageItem> * itemlist = & MasterItems;
while (itemlist != NULL)
{
for (uint i=0; i < itemlist->count(); ++i)
{
PageItem_TextFrame * currItem = itemlist->at(i)->asTextFrame();
if (currItem)
currItem->itemText.replaceCharStyles(newNameForOld);
}
if (itemlist == &MasterItems)
itemlist = &DocItems;
else if (itemlist == &DocItems)
itemlist = &FrameItems;
else
itemlist = NULL;
}
// replace names in styles
for (uint i=0; i < docParagraphStyles.count(); ++i)
{
// ...parent of parstyle's charstyle
const QString& parent(docParagraphStyles[i].charStyle().parent());
if (newNameForOld.contains(parent))
docParagraphStyles[i].charStyle().setParent(newNameForOld[parent]);
}
for (int i=docCharStyles.count()-1; i >= 0; --i)
{
// ...parent of charstyle
const QString& parent(docCharStyles[i].parent());
if (newNameForOld.contains(parent))
docCharStyles[i].setParent(newNameForOld[parent]);
// ... as name
if (newNameForOld.contains(docCharStyles[i].name()))
docCharStyles.remove(i);
}
*/
}
// void ScribusDoc::replaceCharStyles(const QMap<QString,QString>& newNameForOld)
// {
// ResourceCollection newNames;
// newNames.mapCharStyles(newNameForOld);
// replaceNamedResources(newNames);
//
// /*
// // replace style in items
// QPtrList<PageItem> * itemlist = & MasterItems;
// while (itemlist != NULL)
// {
// for (uint i=0; i < itemlist->count(); ++i)
// {
// PageItem_TextFrame * currItem = itemlist->at(i)->asTextFrame();
// if (currItem)
// currItem->itemText.replaceCharStyles(newNameForOld);
// }
// if (itemlist == &MasterItems)
// itemlist = &DocItems;
// else if (itemlist == &DocItems)
// itemlist = &FrameItems;
// else
// itemlist = NULL;
// }
// // replace names in styles
// for (uint i=0; i < docParagraphStyles.count(); ++i)
// {
// // ...parent of parstyle's charstyle
// const QString& parent(docParagraphStyles[i].charStyle().parent());
// if (newNameForOld.contains(parent))
// docParagraphStyles[i].charStyle().setParent(newNameForOld[parent]);
// }
// for (int i=docCharStyles.count()-1; i >= 0; --i)
// {
// // ...parent of charstyle
// const QString& parent(docCharStyles[i].parent());
// if (newNameForOld.contains(parent))
// docCharStyles[i].setParent(newNameForOld[parent]);
// // ... as name
// if (newNameForOld.contains(docCharStyles[i].name()))
// docCharStyles.remove(i);
// }
// */
// }
 
 
/*
void ScribusDoc::redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused)
{
docParagraphStyles.redefine(newStyles, false);
1090,8 → 1090,8
}
docParagraphStyles.invalidate();
}
*/
 
 
void ScribusDoc::redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused)
{
docCharStyles.redefine(newStyles, false);
1120,38 → 1120,10
* - 2004-09-14 Craig Ringer
*/
// dont like this here. could as well be a static method for reading this stuff into temp., then always use redefineXY() - av
void ScribusDoc::loadStylesFromFile(QString fileName, StyleSet<ParagraphStyle> *tempStyles,
StyleSet<CharStyle> *tempCharStyles,
QMap<QString, multiLine> *tempLineStyles)
void ScribusDoc::loadStylesFromFile(QString fileName)
{
StyleSet<ParagraphStyle> *wrkStyles = NULL;
StyleSet<CharStyle> *wrkCharStyles = NULL;
QMap<QString, multiLine> *wrkLineStyles = NULL;
int oldStyles, oldCharStyles;
int oldLineStyles;
int oldStyles = StylesLibrary::Count();
 
/*
* Use the working styles struct if passed, or work directly
* on the document styles otherwise.
*/
if (tempStyles != NULL)
wrkStyles = tempStyles;
else
wrkStyles = &docParagraphStyles;
oldStyles = wrkStyles->count();
if (tempCharStyles != NULL)
wrkCharStyles = tempCharStyles;
else
wrkCharStyles = &docCharStyles;
oldCharStyles = wrkCharStyles->count();
if (tempLineStyles != NULL)
wrkLineStyles = tempLineStyles;
else
wrkLineStyles = &MLineStyles;
oldLineStyles = wrkLineStyles->count();
if (!fileName.isEmpty())
{
FileLoader fl(fileName);
1159,24 → 1131,22
//TODO put in nice user warning
return;
 
if (!fl.ReadStyles(fileName, this, *wrkStyles))
if (!fl.ReadStyles(fileName, this))
{
//TODO put in nice user warning
}
 
if (!fl.ReadCharStyles(fileName, this, *wrkCharStyles))
if (!fl.ReadCharStyles(fileName, this))
{
//TODO put in nice user warning
}
 
if (!fl.ReadLineStyles(fileName, wrkLineStyles))
if (!fl.ReadLineStyles(fileName))
{
//TODO put in nice user warning
}
if ( !isLoading() && ( (wrkStyles == &docParagraphStyles && wrkStyles->count() > oldStyles)
|| (wrkCharStyles == &docCharStyles && wrkCharStyles->count() > oldCharStyles)
|| (wrkLineStyles == &MLineStyles && wrkLineStyles->count() > oldLineStyles) ) )
if ( !isLoading() && ( StylesLibrary::Count() > oldStyles) )
changed();
}
}
/branches/ScribusUIDStyles/scribus/scribusXml.h
24,7 → 24,7
#include "scribusapi.h"
#include "scribusstructs.h"
#include "selection.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
 
#include <QXmlStreamAttributes>
#include <QXmlStreamReader>
/branches/ScribusUIDStyles/scribus/smstyleimport.h
11,7 → 11,7
 
#include "ui_smstyleimport.h"
#include "scribusapi.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
#include "scribusstructs.h"
 
 
/branches/ScribusUIDStyles/scribus/sctextstruct.h
115,7 → 115,7
class SCRIBUS_API ScText : public CharStyle
{
public:
ParagraphStyle* parstyle; // only for parseps
QString parstyle; // only for parseps
GlyphLayout glyph;
float PtransX;
float PtransY;
129,12 → 129,10
PtransX(0.0f), PtransY(0.0f), PRot(0.0f), PDx(0.0f), embedded(NULL), ch() {}
ScText(const ScText& other) :
CharStyle(other),
parstyle(NULL), glyph(other.glyph),
parstyle(other.parstyle), glyph(other.glyph),
PtransX(other.PtransX), PtransY(other.PtransY), PRot(other.PRot), PDx(other.PDx),
embedded(other.embedded), ch(other.ch)
{
if (other.parstyle)
parstyle = new ParagraphStyle(*other.parstyle);
}
~ScText();
};
/branches/ScribusUIDStyles/scribus/scribusdoc.h
47,7 → 47,7
#include "pageitem.h"
#include "pagestructs.h"
#include "usertaskstructs.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
#include "scguardedptr.h"
#include "updatemanager.h"
#include "sclayer.h"
428,35 → 428,34
*/
void enableCMS(bool enable);
const ParagraphStyle& paragraphStyle(QString name) { return docParagraphStyles.get(name); }
const StyleSet<ParagraphStyle>& paragraphStyles() { return docParagraphStyles; }
bool isDefaultStyle( const ParagraphStyle& p ) const { return docParagraphStyles.isDefault(p); }
bool isDefaultStyle( const CharStyle& c ) const { return docCharStyles.isDefault(c); }
// Now that we have StyleLibrary, no point to keep that
// const ParagraphStyle& paragraphStyle(QString name) { return docParagraphStyles.get(name); }
// const StyleSet<ParagraphStyle>& paragraphStyles() { return docParagraphStyles; }
// bool isDefaultStyle( const ParagraphStyle& p ) const { return docParagraphStyles.isDefault(p); }
// bool isDefaultStyle( const CharStyle& c ) const { return docCharStyles.isDefault(c); }
// bool isDefaultStyle( LineStyle& l ) const { return MLineStyles......; }
 
void getNamedResources(ResourceCollection& lists) const;
void replaceNamedResources(ResourceCollection& newNames);
void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
// void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
/**
* @brief Remove any reference to old styles and replace with new name. This needs to be
* called when a style was removed. New name may be "".
* @param newNameForOld a map which maps the name of any style to remove to a new stylename
*/
void replaceStyles(const QMap<QString,QString>& newNameForOld);
void loadStylesFromFile(QString fileName, StyleSet<ParagraphStyle> *tempStyles = NULL,
StyleSet<CharStyle> *tempCharStyles = NULL,
QMap<QString, multiLine> *tempLineStyles = NULL);
// void replaceStyles(const QMap<QString,QString>& newNameForOld);
void loadStylesFromFile(QString fileName);
 
const CharStyle& charStyle(QString name) { return docCharStyles.get(name); }
const StyleSet<CharStyle>& charStyles() { return docCharStyles; }
void redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused=false);
// const CharStyle& charStyle(QString name) { return docCharStyles.get(name); }
// const StyleSet<CharStyle>& charStyles() { return docCharStyles; }
// void redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused=false);
/**
* @brief Remove any reference to old styles and replace with new name. This needs to be
* called when a style was removed. New name may be "".
* @param newNameForOld a map which maps the name of any style to remove to a new stylename
*/
void replaceCharStyles(const QMap<QString,QString>& newNameForOld);
// void replaceCharStyles(const QMap<QString,QString>& newNameForOld);
 
/**
* @brief Should guides be locked or not
974,8 → 973,8
PageItem *ElemToLink;
QList<uint> DragElements;
private:
StyleSet<ParagraphStyle> docParagraphStyles;
StyleSet<CharStyle> docCharStyles;
// StyleSet<ParagraphStyle> docParagraphStyles;
// StyleSet<CharStyle> docCharStyles;
public:
ScLayers Layers;
bool marginColored;
/branches/ScribusUIDStyles/scribus/plugins/fileloader/scribus12format/scribus12format.h
11,7 → 11,7
#include "loadsaveplugin.h"
#include "scfonts.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
 
#include <QDomElement>
#include <QMap>
/branches/ScribusUIDStyles/scribus/plugins/fileloader/scribus13format/scribus13format.h
11,7 → 11,7
#include "loadsaveplugin.h"
#include "scfonts.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
 
#include <QDomElement>
#include <QMap>
/branches/ScribusUIDStyles/scribus/plugins/fileloader/scribus134format/scribus134format.h
11,7 → 11,7
#include "loadsaveplugin.h"
#include "scfonts.h"
#include "scribusstructs.h"
#include "styles/styleset.h"
// #include "styles/styleset.h"
 
#include <QDomElement>
#include <QMap>
42,8 → 42,8
 
// Special features - .sla page extraction support
virtual bool loadPage(const QString & fileName, int pageNumber, bool Mpage, QString renamedPageName=QString::null);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles);
virtual bool readCharStyles(const QString& fileName, ScribusDoc* doc, StyleSet<CharStyle> &docCharStyles);
virtual bool readStyles(const QString& fileName, ScribusDoc* doc);
virtual bool readCharStyles(const QString& fileName, ScribusDoc* doc);
virtual bool readLineStyles(const QString& fileName, QMap<QString,multiLine> *Sty);
virtual bool readColors(const QString& fileName, ColorList & colors);
virtual bool readPageCount(const QString& fileName, int *num1, int *num2, QStringList & masterPageNames);
59,10 → 59,10
void registerFormats();
//Scribus Doc vars, not plugin vars
void GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo=false, bool VorLFound=false);
void GetCStyle(const QDomElement *it, ScribusDoc *doc, CharStyle & newStyle);
void GetCStyle(const QDomElement *it, ScribusDoc *doc, CharStyle * newStyle);
void readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc);
PageItem* PasteItem(QDomElement *obj, ScribusDoc *doc, const QString& baseDir);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> *docParagraphStyles, ScribusDoc* doc, bool fl);
void GetStyle(QDomElement *pg, ParagraphStyle *vg, ScribusDoc* doc, bool fl);
QString readSLA(const QString & fileName);
 
void writeCheckerProfiles(ScXmlStreamWriter& docu);
/branches/ScribusUIDStyles/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
1579,33 → 1579,33
cstyle.resetTracking();
}
void fixLegacyParStyle(ParagraphStyle& pstyle)
void fixLegacyParStyle(ParagraphStyle* pstyle)
{
if (pstyle.lineSpacing() <= -16000)
pstyle.resetLineSpacing();
if (pstyle->lineSpacing() <= -16000)
pstyle->resetLineSpacing();
if (pstyle.leftMargin() <= -16000)
pstyle.resetLeftMargin();
if (pstyle.rightMargin() <= -16000)
pstyle.resetRightMargin();
if (pstyle.firstIndent() <= -16000)
pstyle.resetFirstIndent();
if (pstyle.alignment() < 0)
pstyle.resetAlignment();
if (pstyle.gapBefore() <= -16000)
pstyle.resetGapBefore();
if (pstyle.gapAfter() <= -16000)
pstyle.resetGapAfter();
if (pstyle.dropCapLines() < 0)
pstyle.resetDropCapLines();
if (pstyle.dropCapOffset() <= -16000)
pstyle.resetDropCapOffset();
fixLegacyCharStyle(pstyle.charStyle());
pstyle->resetLeftMargin();
if (pstyle->rightMargin() <= -16000)
pstyle->resetRightMargin();
if (pstyle->firstIndent() <= -16000)
pstyle->resetFirstIndent();
if (pstyle->alignment() < 0)
pstyle->resetAlignment();
if (pstyle->gapBefore() <= -16000)
pstyle->resetGapBefore();
if (pstyle->gapAfter() <= -16000)
pstyle->resetGapAfter();
if (pstyle->dropCapLines() < 0)
pstyle->resetDropCapLines();
if (pstyle->dropCapOffset() <= -16000)
pstyle->resetDropCapOffset();
fixLegacyCharStyle(pstyle->charStyle());
}
}// namespace
 
 
void Scribus134Format::GetCStyle(const QDomElement *it, ScribusDoc *doc, CharStyle & newStyle)
void Scribus134Format::GetCStyle(const QDomElement *it, ScribusDoc *doc, CharStyle * newStyle)
{
if (it->hasAttribute("CNAME"))
newStyle.setName(it->attribute("CNAME"));
1686,7 → 1686,7
void Scribus134Format::GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo, bool VorLFound)
{
QString tmp2, tmpf;
CharStyle newStyle;
CharStyle *newStyle = new CharStyle;
GetCStyle(it, doc, newStyle);
 
1710,21 → 1710,21
newStyle.setFont(m_AvailableFonts->findFont(it->attribute("CFONT"), doc));
if (it->hasAttribute("CSIZE"))
newStyle.setFontSize(qRound(it->attribute("CSIZE").toDouble() * 10));
newStyle->setFontSize(qRound(it->attribute("CSIZE").toDouble() * 10));
if (it->hasAttribute("CCOLOR"))
newStyle.setFillColor(it->attribute("CCOLOR"));
newStyle->setFillColor(it->attribute("CCOLOR"));
if (it->hasAttribute("CEXTRA"))
newStyle.setTracking(qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0));
newStyle->setTracking(qRound(it->attribute("CEXTRA").toDouble() / it->attribute("CSIZE").toDouble() * 1000.0));
else if (it->hasAttribute("CKERN"))
newStyle.setTracking(it->attribute("CKERN").toInt());
newStyle->setTracking(it->attribute("CKERN").toInt());
if (it->hasAttribute("CSHADE"))
newStyle.setFillShade(it->attribute("CSHADE").toInt());
newStyle->setFillShade(it->attribute("CSHADE").toInt());
if (it->hasAttribute("CSTYLE"))
newStyle.setFeatures(static_cast<StyleFlag>(it->attribute("CSTYLE").toInt()).featureList());
newStyle->setFeatures(static_cast<StyleFlag>(it->attribute("CSTYLE").toInt()).featureList());
 
QString pstylename = it->attribute("PSTYLE", "");
int calign = it->attribute("CALIGN", "-1").toInt();
1740,41 → 1740,41
}
if (it->hasAttribute("CSTROKE"))
newStyle.setStrokeColor(it->attribute("CSTROKE", CommonStrings::None));
newStyle->setStrokeColor(it->attribute("CSTROKE", CommonStrings::None));
if (it->hasAttribute("CSHADE2"))
newStyle.setStrokeShade(it->attribute("CSHADE2", "100").toInt());
newStyle->setStrokeShade(it->attribute("CSHADE2", "100").toInt());
if (it->hasAttribute("CSCALE"))
newStyle.setScaleH(qMin(qMax(qRound(it->attribute("CSCALE", "100").toDouble() * 10), 100), 4000));
newStyle->setScaleH(qMin(qMax(qRound(it->attribute("CSCALE", "100").toDouble() * 10), 100), 4000));
if (it->hasAttribute("CSCALEV"))
newStyle.setScaleV(qMin(qMax(qRound(it->attribute("CSCALEV", "100").toDouble() * 10), 100), 4000));
newStyle->setScaleV(qMin(qMax(qRound(it->attribute("CSCALEV", "100").toDouble() * 10), 100), 4000));
if (it->hasAttribute("CBASE"))
newStyle.setBaselineOffset(qRound(it->attribute("CBASE", "0").toDouble() * 10));
newStyle->setBaselineOffset(qRound(it->attribute("CBASE", "0").toDouble() * 10));
if (it->hasAttribute("CSHX"))
newStyle.setShadowXOffset(qRound(it->attribute("CSHX", "5").toDouble() * 10));
newStyle->setShadowXOffset(qRound(it->attribute("CSHX", "5").toDouble() * 10));
if (it->hasAttribute("CSHY"))
newStyle.setShadowYOffset(qRound(it->attribute("CSHY", "-5").toDouble() * 10));
newStyle->setShadowYOffset(qRound(it->attribute("CSHY", "-5").toDouble() * 10));
if (it->hasAttribute("COUT"))
newStyle.setOutlineWidth(qRound(it->attribute("COUT", "1").toDouble() * 10));
newStyle->setOutlineWidth(qRound(it->attribute("COUT", "1").toDouble() * 10));
if (it->hasAttribute("CULP"))
newStyle.setUnderlineOffset(qRound(it->attribute("CULP", "-0.1").toDouble() * 10));
newStyle->setUnderlineOffset(qRound(it->attribute("CULP", "-0.1").toDouble() * 10));
if (it->hasAttribute("CULW"))
newStyle.setUnderlineWidth(qRound(it->attribute("CULW", "-0.1").toDouble() * 10));
newStyle->setUnderlineWidth(qRound(it->attribute("CULW", "-0.1").toDouble() * 10));
if (it->hasAttribute("CSTP"))
newStyle.setStrikethruOffset(qRound(it->attribute("CSTP", "-0.1").toDouble() * 10));
newStyle->setStrikethruOffset(qRound(it->attribute("CSTP", "-0.1").toDouble() * 10));
if (it->hasAttribute("CSTW"))
newStyle.setStrikethruWidth(qRound(it->attribute("CSTW", "-0.1").toDouble() * 10));
newStyle->setStrikethruWidth(qRound(it->attribute("CSTW", "-0.1").toDouble() * 10));
fixLegacyCharStyle(newStyle);
1822,10 → 1822,10
else {
obj->itemText.insertChars(pos, QString(ch));
}
// qDebug(QString("style at %1: %2 ^ %3 = %4 (%5)").arg(pos).arg((uint)newStyle.effects()).arg((uint)last->Style.effects()).arg((uint)(newStyle.effects() ^ last->Style.effects())).arg(newStyle != last->Style));
if (newStyle != last->Style) // || (newStyle.effects() ^ last->Style.effects()) == ScStyle_HyphenationPossible)
// qDebug(QString("style at %1: %2 ^ %3 = %4 (%5)").arg(pos).arg((uint)newStyle->effects()).arg((uint)last->Style.effects()).arg((uint)(newStyle->effects() ^ last->Style.effects())).arg(newStyle != last->Style));
if (newStyle != last->Style) // || (newStyle->effects() ^ last->Style.effects()) == ScStyle_HyphenationPossible)
{ // FIXME StyleFlag operator== ignores hyphen flag
// qDebug(QString("new style at %1: %2 -> %3").arg(pos).arg(last->Style.asString()).arg(newStyle.asString()));
// qDebug(QString("new style at %1: %2 -> %3").arg(pos).arg(last->Style.asString()).arg(newStyle->g()));
obj->itemText.setCharStyle(last->StyleStart, pos-last->StyleStart, last->Style);
last->Style = newStyle;
last->StyleStart = pos;
1869,41 → 1869,41
 
 
 
void Scribus134Format::readParagraphStyle(ParagraphStyle& vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc)
void Scribus134Format::readParagraphStyle(ParagraphStyle *vg, const QDomElement& pg, SCFonts &avail, ScribusDoc *doc)
{
vg.erase();
vg.setName(pg.attribute("NAME", ""));
vg.setParent(pg.attribute("PARENT", ""));
vg->erase();
vg->setName(pg.attribute("NAME", ""));
vg->setParent(pg.attribute("PARENT", ""));
if (pg.hasAttribute("DefaultStyle"))
vg.setDefaultStyle(pg.attribute("DefaultStyle").toInt());
vg->setDefaultStyle(pg.attribute("DefaultStyle").toInt());
else
vg.setDefaultStyle(false);
vg->setDefaultStyle(false);
if (pg.hasAttribute("LINESPMode"))
vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode").toInt()));
vg->setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode").toInt()));
if (pg.hasAttribute("LINESP"))
vg.setLineSpacing(pg.attribute("LINESP").toDouble());
vg->setLineSpacing(pg.attribute("LINESP").toDouble());
if (pg.hasAttribute("INDENT"))
vg.setLeftMargin(pg.attribute("INDENT").toDouble());
vg->setLeftMargin(pg.attribute("INDENT").toDouble());
if (pg.hasAttribute("RMARGIN"))
vg.setRightMargin(pg.attribute("RMARGIN").toDouble());
vg->setRightMargin(pg.attribute("RMARGIN").toDouble());
if (pg.hasAttribute("FIRST"))
vg.setFirstIndent(pg.attribute("FIRST").toDouble());
vg->setFirstIndent(pg.attribute("FIRST").toDouble());
if (pg.hasAttribute("ALIGN"))
vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg.attribute("ALIGN").toInt()));
vg->setAlignment(static_cast<ParagraphStyle::AlignmentType>(pg.attribute("ALIGN").toInt()));
if (pg.hasAttribute("VOR"))
vg.setGapBefore(pg.attribute("VOR").toDouble());
vg->setGapBefore(pg.attribute("VOR").toDouble());
if (pg.hasAttribute("NACH"))
vg.setGapAfter(pg.attribute("NACH").toDouble());
vg->setGapAfter(pg.attribute("NACH").toDouble());
if (pg.hasAttribute("DROP"))
vg.setHasDropCap(static_cast<bool>(pg.attribute("DROP").toInt()));
vg->setHasDropCap(static_cast<bool>(pg.attribute("DROP").toInt()));
if (pg.hasAttribute("DROPLIN"))
vg.setDropCapLines(pg.attribute("DROPLIN").toInt());
vg->setDropCapLines(pg.attribute("DROPLIN").toInt());
if (pg.hasAttribute("DROPDIST"))
vg.setDropCapOffset(pg.attribute("DROPDIST").toDouble());
vg->setDropCapOffset(pg.attribute("DROPDIST").toDouble());
if (pg.hasAttribute("PSHORTCUT"))
vg.setShortcut(pg.attribute("PSHORTCUT"));
vg->setShortcut(pg.attribute("PSHORTCUT"));
 
// vg.tabValues().clear();
// vg->tabValues().clear();
if ((pg.hasAttribute("NUMTAB")) && (pg.attribute("NUMTAB", "0").toInt() != 0))
{
QList<ParagraphStyle::TabRecord> tbs;
1920,13 → 1920,13
tb.tabFillChar = QChar();
tbs.append(tb);
}
vg.setTabValues(tbs);
vg->setTabValues(tbs);
tmp = "";
}
else
{
QList<ParagraphStyle::TabRecord> tbs;
vg.resetTabValues();
vg->resetTabValues();
QDomNode IT = pg.firstChild();
while(!IT.isNull())
{
1947,23 → 1947,23
IT=IT.nextSibling();
}
if (tbs.count() > 0)
vg.setTabValues(tbs);
vg->setTabValues(tbs);
}
if (pg.hasAttribute("OpticalMargins"))
vg.setOpticalMargins(pg.attribute("OpticalMargins").toInt());
vg->setOpticalMargins(pg.attribute("OpticalMargins").toInt());
if (pg.hasAttribute("HyphenationMode"))
vg.setHyphenationMode(pg.attribute("HyphenationMode").toInt());
vg->setHyphenationMode(pg.attribute("HyphenationMode").toInt());
if (pg.hasAttribute("MinWordTrack"))
vg.setMinWordTracking(pg.attribute("MinWordTrack").toDouble());
vg->setMinWordTracking(pg.attribute("MinWordTrack").toDouble());
if (pg.hasAttribute("NormWordTrack"))
vg.charStyle().setWordTracking(pg.attribute("NormWordTrack").toDouble());
vg->charStyle().setWordTracking(pg.attribute("NormWordTrack").toDouble());
if (pg.hasAttribute("MinGlyphShrink"))
vg.setMinGlyphExtension(pg.attribute("MinGlyphShrink").toDouble());
vg->setMinGlyphExtension(pg.attribute("MinGlyphShrink").toDouble());
if (pg.hasAttribute("MaxGlyphExtend"))
vg.setMaxGlyphExtension(pg.attribute("MaxGlyphExtend").toDouble());
vg->setMaxGlyphExtension(pg.attribute("MaxGlyphExtend").toDouble());
GetCStyle( &pg, doc, vg.charStyle());
GetCStyle( &pg, doc, StylesLibrary::Char( vg->charStyle() ) );
fixLegacyParStyle(vg);
}
3239,73 → 3239,17
return true;
}
 
void Scribus134Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, StyleSet<ParagraphStyle> * tempStyles, ScribusDoc* doc, bool fl)
void Scribus134Format::GetStyle(QDomElement *pg, ParagraphStyle *vg, ScribusDoc* doc, bool fl)
{
bool fou;
QString tmpf, tmf, tmV;
fou = false;
const StyleSet<ParagraphStyle> * docParagraphStyles = tempStyles? tempStyles : & doc->paragraphStyles();
PrefsManager* prefsManager=PrefsManager::instance();
readParagraphStyle(*vg, *pg, prefsManager->appPrefs.AvailFonts, doc);
for (int xx=0; xx<docParagraphStyles->count(); ++xx)
{
if (vg->uuid() == (*docParagraphStyles)[xx].uuid())
{
if (vg->equiv((*docParagraphStyles)[xx]))
{
if (fl)
{
DoVorl[VorlC] = tmV.setNum(xx);
VorlC++;
}
fou = true;
}
else
{
vg->setName("Copy of "+(*docParagraphStyles)[xx].displayName());
fou = false;
}
break;
}
}
if (!fou)
{
for (int xx=0; xx< docParagraphStyles->count(); ++xx)
{
if (vg->equiv((*docParagraphStyles)[xx]))
{
vg->setName((*docParagraphStyles)[xx].displayName());
fou = true;
if (fl)
{
DoVorl[VorlC] = tmV.setNum(xx);
VorlC++;
}
break;
}
}
}
if (!fou)
{
if (tempStyles)
tempStyles->create(*vg);
else
{
StyleSet<ParagraphStyle> tmp;
tmp.create(*vg);
doc->redefineStyles(tmp, false);
}
if (fl)
{
DoVorl[VorlC] = tmV.setNum(docParagraphStyles->count()-1);
VorlC++;
}
}
readParagraphStyle(vg, *pg, prefsManager->appPrefs.AvailFonts, doc);
}
 
bool Scribus134Format::readStyles(const QString& fileName, ScribusDoc* doc, StyleSet<ParagraphStyle> &docParagraphStyles)
bool Scribus134Format::readStyles(const QString& fileName, ScribusDoc* doc )
{
ParagraphStyle vg;
QDomDocument docu("scridoc");
QString tmpf, tmf;
QString f (readSLA(fileName));
3325,7 → 3269,7
{
QDomElement pg=PAGE.toElement();
if(pg.tagName()=="STYLE")
GetStyle(&pg, &vg, &docParagraphStyles, doc, false);
GetStyle(&pg, new ParagraphStyle, doc, false);
PAGE=PAGE.nextSibling();
}
DOC=DOC.nextSibling();
3333,9 → 3277,8
return true;
}
 
bool Scribus134Format::readCharStyles(const QString& fileName, ScribusDoc* doc, StyleSet<CharStyle> &docCharStyles)
bool Scribus134Format::readCharStyles(const QString& fileName, ScribusDoc* doc)
{
CharStyle cstyle;
QDomDocument docu("scridoc");
QString tmpf, tmf;
QString f (readSLA(fileName));
3355,9 → 3298,8
{
QDomElement pg=PAGE.toElement();
if(pg.tagName()=="CHARSTYLE")
{
GetCStyle(&pg, doc, cstyle);
docCharStyles.create(cstyle);
{
GetCStyle(&pg, doc, new CharStyle );
}
PAGE=PAGE.nextSibling();
}