Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 8342 → Rev 8343

/branches/Version13x/Scribus/scribus/style.cpp
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: Version13x/Scribus/scribus/styles/style.cpp
===================================================================
--- Version13x/Scribus/scribus/styles/style.cpp (nonexistent)
+++ Version13x/Scribus/scribus/styles/style.cpp (revision 8343)
@@ -0,0 +1,75 @@
+/*
+ For general Scribus (>=1.3.2) copyright and licensing information please refer
+ to the COPYING file provided with the program. Following this notice may exist
+ a copyright and/or license notice that predates the release of Scribus 1.3.2
+ for which a new license (GPL+exception) is in place.
+ */
+/***************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+
+#include "style.h"
+#include "desaxe/digester.h"
+#include "desaxe/simple_actions.h"
+#include "desaxe/saxiohelper.h"
+
+void Style::setContext(const StyleContext* context)
+{
+ 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(QString("follow %1").arg(reinterpret_cast<uint>(m_context),16));
+ const Style * par = m_context ? m_context->resolve(m_parent) : NULL;
+ if (par == this) return NULL; else return par;
+}
+
+using namespace desaxe;
+
+static void desaxeRules(Xml_string prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag)
+{
+ ruleset.addRule(prefixPattern, SetAttributeWithConversion<Style, const QString&>( & Style::setName, "name", &parse<const QString&>));
+ ruleset.addRule(prefixPattern, SetAttributeWithConversion<Style, const QString&>( & Style::setParent, "parent", &parse<const QString&>));
+ ruleset.addRule(prefixPattern, SetAttributeWithConversion<Style, const QString&>( & Style::setShortcut, "shortcut", &parse<const QString&>));
+}
+
+
+void Style::saxxAttributes(Xml_attr& attr) const
+{
+ if (!name().isEmpty())
+ attr["name"] = name();
+ if(!parent().isEmpty())
+ attr["parent"] = parent();
+ if (!shortcut().isEmpty())
+ attr["shortcut"] = shortcut();
+}
/Version13x/Scribus/scribus/styles/style.cpp
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: Version13x/Scribus/scribus/styles/CMakeLists.txt
===================================================================
--- Version13x/Scribus/scribus/styles/CMakeLists.txt (revision 8342)
+++ Version13x/Scribus/scribus/styles/CMakeLists.txt (revision 8343)
@@ -8,6 +8,7 @@
)
SET(SCRIBUS_STYLES_LIB_SOURCES
+styel.cpp
stylecontext.cpp
stylecontextproxy.cpp
linestyle.cpp
/branches/Version13x/Scribus/scribus/CMakeLists.txt
451,7 → 451,6
splash.cpp
stencilreader.cpp
story.cpp
style.cpp
styleitem.cpp
stylemanager.cpp
styleselect.cpp