23 #include "scribusapi.h"
24 #include "styles/stylecontext.h"
25 #include "desaxe/saxio.h"
39 bool m_isDefaultStyle;
48 Style(): m_isDefaultStyle(
false), m_name(
""), m_context(NULL), m_contextversion(-1), m_parent(
""), m_shortcut() {}
50 Style(
StyleContext* b, QString n): m_isDefaultStyle(
false), m_name(n), m_context(b), m_contextversion(-1), m_parent(
""), m_shortcut() {}
54 m_isDefaultStyle = o.m_isDefaultStyle;
57 m_contextversion = -1;
58 m_parent = o.m_parent;
59 m_shortcut = o.m_shortcut;
63 Style(
const Style& o) :
SaxIO(), m_isDefaultStyle(o.m_isDefaultStyle),m_name(o.m_name),
64 m_context(o.m_context), m_contextversion(o.m_contextversion), m_parent(o.m_parent), m_shortcut(o.m_shortcut) {}
71 template<
class SUBSTYLE>
74 void saxxAttributes(Xml_attr& attr)
const;
78 void setDefaultStyle(
bool ids);
79 bool isDefaultStyle()
const {
return m_isDefaultStyle; }
81 QString name()
const {
return m_name; }
82 void setName(
const QString& n) { m_name = n.isEmpty() ?
"" : n; }
83 bool hasName()
const {
return ! m_name.isEmpty(); }
85 virtual QString displayName()
const = 0;
94 QString parent()
const {
return m_parent; }
95 void setParent(
const QString& p);
96 bool hasParent()
const {
return ! m_parent.isEmpty(); }
97 const Style* parentStyle()
const;
99 static const QString INHERIT_PARENT;
102 const StyleContext* context()
const {
return m_context; }
114 if (m_context && m_contextversion != m_context->version()) {
115 const_cast<Style*
>(
this)->update(m_context);
116 assert( m_context->checkConsistency() );
120 QString shortcut()
const {
return m_shortcut; }
121 void setShortcut(
const QString &shortcut) { m_shortcut = shortcut; }
128 virtual bool equiv(
const Style& other)
const = 0;
134 virtual bool operator==(
const Style& other)
const {
return name() == other.name() && equiv(other); }
135 virtual bool operator!=(
const Style& other)
const {
return ! ( (*this) == other ); }
141 virtual void erase() = 0;
146 if (other.hasParent())
147 setParent( other.parent() == INHERIT_PARENT?
"" :other.parent());
148 m_contextversion = -1;
154 if (other.parent() == parent())
156 m_contextversion = -1;
Definition: stylecontext.h:35
void applyStyle(const Style &other)
Definition: style.h:145
void eraseStyle(const Style &other)
Definition: style.h:153
virtual bool operator==(const Style &other) const
Definition: style.h:134
static void desaxeRules(const Xml_string &, desaxe::Digester &, const Xml_string=saxxDefaultElem)
Definition: saxio.h:49
Definition: digester.h:100
void validate() const
Definition: style.h:113