Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 12915 → Rev 12916

/trunk/Scribus/scribus/styles/style.cpp
13,6 → 13,7
* *
***************************************************************************/
 
#include <QDebug>
 
#include "style.h"
#include "desaxe/digester.h"
31,7 → 32,25
//qDebug(QString("setContext of %2 context %1").arg(reinterpret_cast<uint>(m_context),16).arg(reinterpret_cast<uint>(this),16));
}
 
void Style::setDefaultStyle(bool ids)
{
if (ids && hasParent())
setParent(QString(""));
m_isDefaultStyle = ids;
}
 
void Style::setParent(const QString& p)
{
if (m_isDefaultStyle && !p.isEmpty())
{
qDebug() << "A default style cannot have a parent";
return;
}
if (m_parent != p)
m_contextversion = -1;
m_parent = p.isEmpty()? "" : p;
}
 
void Style::update(const StyleContext* b)
{
if (b)
52,6 → 71,8
const Style* Style::parentStyle() const
{
//qDebug(QString("follow %1").arg(reinterpret_cast<uint>(m_context),16));
if (m_isDefaultStyle)
return NULL;
const Style * par = m_context ? m_context->resolve(m_parent) : NULL;
if (par == this) return NULL; else return par;
}
/trunk/Scribus/scribus/style.h
76,7 → 76,7
//virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
//virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
void setDefaultStyle(bool ids) { m_isDefaultStyle = ids; }
void setDefaultStyle(bool ids);
bool isDefaultStyle() const { return m_isDefaultStyle; }
QString name() const { return m_name; }
93,7 → 93,7
}*/
QString parent() const { return m_parent; }
void setParent(const QString& p) { if (m_parent != p) m_contextversion = -1; m_parent = p.isEmpty()? "" : p; }
void setParent(const QString& p);
bool hasParent() const { return ! m_parent.isEmpty(); }
const Style* parentStyle() const;
/trunk/Scribus/scribus/smcstylewidget.cpp
155,7 → 155,7
void SMCStyleWidget::show(CharStyle *cstyle, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex)
{
disconnect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
parentCombo->setEnabled(true);
parentCombo->setEnabled(!cstyle->isDefaultStyle());
const CharStyle *parent = dynamic_cast<const CharStyle*>(cstyle->parentStyle());
bool hasParent = cstyle->hasParent() && parent != 0 && parent->hasName() && cstyle->parent() != "";
if (hasParent)
/trunk/Scribus/scribus/smpstylewidget.cpp
148,7 → 148,7
void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
{
double unitRatio = unitGetRatioFromIndex(unitIndex);
parentCombo->setEnabled(true);
parentCombo->setEnabled(!pstyle->isDefaultStyle());
const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle->parentStyle());
hasParent_ = pstyle->hasParent() && parent != NULL && parent->hasName() && pstyle->parent() != "";