Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions | Private Attributes
StyleContextProxy Class Reference

This class turns a style into a new stylecontext: it maps the empty name "" to the given default style and uses the style's context to resolve all other names. More...

#include <stylecontextproxy.h>

Inheritance diagram for StyleContextProxy:
Inheritance graph
[legend]
Collaboration diagram for StyleContextProxy:
Collaboration graph
[legend]

List of all members.

Public Member Functions

const Style * resolve (const QString &name) const
 StyleContextProxy (const Style *style)
 StyleContextProxy (const StyleContextProxy &other)
StyleContextProxyoperator= (const StyleContextProxy &other)
const Style * defaultStyle () const
void setDefaultStyle (const Style *def)
bool checkConsistency () const
bool contextContained (const StyleContext *context) const

Private Attributes

const Style * m_default

Detailed Description

This class turns a style into a new stylecontext: it maps the empty name "" to the given default style and uses the style's context to resolve all other names.

Definition at line 34 of file stylecontextproxy.h.


Constructor & Destructor Documentation

StyleContextProxy::StyleContextProxy ( const Style *  style) [inline]

Definition at line 39 of file stylecontextproxy.h.

              : StyleContext(), m_default(style) {
              }

Definition at line 43 of file stylecontextproxy.h.

              : StyleContext(other), m_default(other.m_default) {
              }

Member Function Documentation

Definition at line 62 of file stylecontextproxy.h.

       { 
              const StyleContext* context = m_default->context();
              return !context || context == this || !context->contextContained(this);
       }
bool StyleContextProxy::contextContained ( const StyleContext context) const [inline]

Definition at line 68 of file stylecontextproxy.h.

       {
              const StyleContext* mycontext = m_default->context();
              return context == this || 
                     (mycontext && mycontext->contextContained(context));
       }
const Style* StyleContextProxy::defaultStyle ( ) const [inline]

Definition at line 54 of file stylecontextproxy.h.

{ return m_default; }
StyleContextProxy& StyleContextProxy::operator= ( const StyleContextProxy other) [inline]

Definition at line 47 of file stylecontextproxy.h.

       {
              static_cast<StyleContext&>(*this) = static_cast<const StyleContext&>(other); 
              m_default = other.m_default;
              return *this;
       }
const Style * StyleContextProxy::resolve ( const QString &  name) const

Definition at line 20 of file stylecontextproxy.cpp.

{
       const StyleContext* context = m_default->context();
       //     if (!name.isEmpty())
       //            qDebug(QString("resolve %4 %3 -%1- %2").arg(name)
       //                      .arg(reinterpret_cast<uint>(context),16).arg(reinterpret_cast<uint>(this),16)
       //                      .arg(m_default->name()));
       
       if (name.isEmpty() || ! context)
              return m_default;
       else if (this == context)
              return NULL;
       else
              return context->resolve(name);
}
void StyleContextProxy::setDefaultStyle ( const Style *  def) [inline]

Definition at line 56 of file stylecontextproxy.h.

                                              { 
              assert(def);
              m_default = def; 
              invalidate();
       }

Member Data Documentation

const Style* StyleContextProxy::m_default [private]

Definition at line 76 of file stylecontextproxy.h.


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