Scribus
Open source desktop publishing at your fingertips
Style Class Referenceabstract

#include <style.h>

Inheritance diagram for Style:
Collaboration diagram for Style:

Public Member Functions

 Style (StyleContext *b, QString n)
 
Styleoperator= (const Style &o)
 
 Style (const Style &o)
 
void saxxAttributes (Xml_attr &attr) const
 
void setDefaultStyle (bool ids)
 
bool isDefaultStyle () const
 
QString name () const
 
void setName (const QString &n)
 
bool hasName () const
 
virtual QString displayName () const =0
 
QString parent () const
 
void setParent (const QString &p)
 
bool hasParent () const
 
const StyleparentStyle () const
 
virtual void setContext (const StyleContext *context)
 
const StyleContextcontext () const
 
virtual void update (const StyleContext *b=NULL)
 
void validate () const
 
QString shortcut () const
 
void setShortcut (const QString &shortcut)
 
virtual bool equiv (const Style &other) const =0
 
virtual bool operator== (const Style &other) const
 
virtual bool operator!= (const Style &other) const
 
virtual void erase ()=0
 
void applyStyle (const Style &other)
 
void eraseStyle (const Style &other)
 
- Public Member Functions inherited from SaxIO
virtual void saxx (SaxHandler &, const Xml_string &) const =0
 
virtual void saxx (SaxHandler &) const =0
 

Static Public Member Functions

template<class SUBSTYLE >
static void desaxeRules (const Xml_string &prefixPattern, desaxe::Digester &ruleset, Xml_string elemtag)
 
- Static Public Member Functions inherited from SaxIO
static void desaxeRules (const Xml_string &, desaxe::Digester &, const Xml_string=saxxDefaultElem)
 

Static Public Attributes

static const QString INHERIT_PARENT = "\n"
 
- Static Public Attributes inherited from SaxIO
static const Xml_string saxxDefaultElem
 

Protected Attributes

bool m_isDefaultStyle
 
QString m_name
 
const StyleContextm_context
 
int m_contextversion
 
QString m_parent
 
QString m_shortcut
 

Detailed Description

This is the base class for all style-like objects: CharStyles, ParagraphStyles, LineStyles, FrameStyles, CellStyles, FlowStyles,... It provides a name and an inheritance mechanism which uses a Stylecontext. Before any attribute is queried, you have to call validate(), which checks the stored m_contextversion against the StyleContext's version and updates all attributes if they are different.

Member Function Documentation

void Style::applyStyle ( const Style other)
inline

if other has a parent, replace this parent with the other ones

virtual bool Style::equiv ( const Style other) const
pure virtual

returns true if both Styles are of the same type, inherit the same attributes, have the same parent, and agree on all attributes which are not inherited. The StyleContext, the name and any inherited attrinutes may be different.

Implemented in CharStyle, ParagraphStyle, CellStyle, TableStyle, and LineStyle.

virtual void Style::erase ( )
pure virtual

resets all attributes to their defaults and makes them inherited. name and parent are not affected.

Implemented in CharStyle, ParagraphStyle, CellStyle, TableStyle, and LineStyle.

void Style::eraseStyle ( const Style other)
inline

if other has the same parent, remove this parent

virtual bool Style::operator== ( const Style other) const
inlinevirtual

returns true if both Styles are equivalent and have the same name. Since the context is not tested, this does not ensure they will return the same values for all attributes.

void Style::update ( const StyleContext b = NULL)
virtual

sets a new StyleContext if b is not NULL and then uses the StyleContext to set all inherited attributes to their valid value.

Reimplemented in CharStyle, CellStyle, TableStyle, ParagraphStyle, and LineStyle.

void Style::validate ( ) const
inline

Checks if this Style needs an update


The documentation for this class was generated from the following files: