Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 8336 → Rev 8337

/branches/Version13x/Scribus/scribus/style.cpp
15,8 → 15,10
 
 
#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) {
52,3 → 54,22
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();
}
/branches/Version13x/Scribus/scribus/styles/charstyle.cpp
10,7 → 10,7
#include <qobject.h>
#include "sctextstruct.h"
#include "scfonts.h"
#include "style.h"
#include "charstyle.h"
#include "desaxe/saxiohelper.h"
#include "desaxe/simple_actions.h"
#include "prefsmanager.h"
254,10 → 254,7
void CharStyle::saxx(SaxHandler& handler, Xml_string elemtag) const
{
Xml_attr att;
if (!name().isEmpty())
att.insert("name", name());
if (!parent().isEmpty())
att.insert("parent", parent());
Style::saxxAttributes(att);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME) \
att.insert(# attr_NAME, toXMLString(m_##attr_NAME));
291,8 → 288,7
{
Xml_string stylePrefix(Digester::concat(prefixPattern, elemtag));
ruleset.addRule(stylePrefix, Factory<CharStyle>());
ruleset.addRule(stylePrefix, SetAttributeWithConversion<CharStyle, const QString&>( & CharStyle::setName, "name", &parse<const QString&>));
ruleset.addRule(stylePrefix, SetAttributeWithConversion<CharStyle, const QString&>( & CharStyle::setParent, "parent", &parse<const QString&>));
Style::desaxeRules(prefixPattern, ruleset, elemtag);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
ruleset.addRule(stylePrefix, SetAttributeWithConversion<CharStyle, attr_TYPE> ( & CharStyle::set##attr_NAME, # attr_NAME, &parse<attr_TYPE> ));
#include "charstyle.attrdefs.cxx"
/branches/Version13x/Scribus/scribus/styles/linestyle.attrdefs.cxx
0,0 → 1,31
/*
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. *
* *
***************************************************************************/
 
 
//Syntax: ATTRDEF( datatype, gettername, name, defaultvalue)
 
ATTRDEF(double, width, Width, 0)
ATTRDEF(QString, color, Color, "Black")
ATTRDEF(double, shade, Shade, 100)
ATTRDEF(int, transparency, Transparency, 0)
ATTRDEF(int, blendMode, BlendMode, 0)
ATTRDEF(Qt::PenStyle, style, Style, Qt::SolidLine)
ATTRDEF(Qt::PenCapStyle, cap, Cap, Qt::FlatCap)
ATTRDEF(Qt::PenJoinStyle, join, Join, Qt::MiterJoin)
ATTRDEF(QValueList<double>, dashes, Dashes, QValueList<double>())
ATTRDEF(double, dashOffset, DashOffset, 0)
ATTRDEF(int, startArrow, StartArrow, 0)
ATTRDEF(int, endArrow, EndArrow, 0)
ATTRDEF(QValueList<LineStyle>, sublines, Sublines, QValueList<LineStyle>())
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/charstyle.h
===================================================================
--- Version13x/Scribus/scribus/styles/charstyle.h (revision 8336)
+++ Version13x/Scribus/scribus/styles/charstyle.h (revision 8337)
@@ -13,9 +13,11 @@
* *
***************************************************************************/
+#ifndef CHARSTYLE_H
+#define CHARSTYLE_H
-// DONT INCLUDE this file directly, include "style.h" instead!
+#include "style.h"
enum StyleFlagValue {
ScStyle_Default = 0,
@@ -85,9 +87,9 @@
inh_##attr_NAME = true;
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
- m_Font = font;
- m_FontSize = size;
- m_Effects = style;
+ setFont(font);
+ setFontSize(size);
+ setEffects(style);
};
CharStyle(const CharStyle & other);
@@ -188,3 +190,4 @@
m_contextversion = -1;
}
+#endif
/branches/Version13x/Scribus/scribus/styles/linestyle.cpp
0,0 → 1,242
/*
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.
*/
 
 
#include <qvaluelist.h>
#include <qobject.h>
#include "sctextstruct.h"
#include "scfonts.h"
#include "linestyle.h"
#include "desaxe/saxiohelper.h"
#include "desaxe/simple_actions.h"
#include "prefsmanager.h"
 
 
void LineStyle::applyLineStyle(const LineStyle & other)
{
Style::applyStyle(other);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (! other.inh_##attr_NAME) \
set##attr_NAME(other.m_##attr_NAME);
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
 
 
void LineStyle::eraseLineStyle(const LineStyle & other)
{
other.validate();
Style::eraseStyle(other);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && m_##attr_NAME == other.m_##attr_NAME) \
reset##attr_NAME();
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
 
bool LineStyle::equiv(const Style & other) const
{
other.validate();
const LineStyle * oth = dynamic_cast<const LineStyle*> ( & other );
return oth &&
parent() == oth->parent()
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
&& (inh_##attr_NAME == oth->inh_##attr_NAME) \
&& (inh_##attr_NAME || m_##attr_NAME == oth->m_##attr_NAME)
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
;
}
 
 
QString LineStyle::displayName() const
{
if ( hasName() || !hasParent() || ! m_context)
return name();
// else if ( inheritsAll() )
// return parent()->displayName();
else
return parentStyle()->displayName() + "+";
}
 
 
 
QString LineStyle::asString() const
{
QString result;
/* if ( !inh_Font )
result += QObject::tr("font %1 ").arg(font().scName());
if ( !inh_FontSize )
result += QObject::tr("size %1 ").arg(fontSize());
if ( !inh_Effects )
result += QObject::tr("+style ");
if ( !inh_StrokeColor || !inh_StrokeShade || !inh_FillColor || !inh_FillShade )
result += QObject::tr("+color ");
if ( !inh_UnderlineWidth || !inh_UnderlineOffset )
result += underlineWidth() > 0 ? QObject::tr("+underline ") : QObject::tr("-underline ");
if ( !inh_StrikethruWidth || !inh_StrikethruOffset )
result += strikethruWidth() > 0 ? QObject::tr("+strikeout ") : QObject::tr("-strikeout ");
if ( !inh_ShadowXOffset || !inh_ShadowYOffset )
result += shadowXOffset() != 0 || shadowYOffset() != 0 ? QObject::tr("+shadow ") : QObject::tr("-shadow ");
if ( !inh_OutlineWidth )
result += outlineWidth() > 0 ? QObject::tr("+outline ") : QObject::tr("-outline ");
if ( !inh_Tracking )
result += tracking() > 0 ? QObject::tr("+tracking %1 ").arg(tracking()) : QObject::tr("-tracking ");
if ( !inh_BaselineOffset )
result += QObject::tr("+baseline %1 ").arg(baselineOffset());
if ( !inh_ScaleH || !inh_ScaleV )
result += QObject::tr("+stretch ");
if ( hasParent() )
result += QObject::tr("parent= %1").arg(parent());
*/ return result.stripWhiteSpace();
}
 
 
void LineStyle::update(const StyleContext* context)
{
Style::update(context);
const LineStyle * oth = dynamic_cast<const LineStyle*> ( parentStyle() );
if (oth) {
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (inh_##attr_NAME) \
m_##attr_NAME = oth->attr_GETTER();
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
}
 
 
void LineStyle::setStyle(const LineStyle& other)
{
other.validate();
setParent(other.parent());
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
inh_##attr_NAME = other.inh_##attr_NAME; \
m_##attr_NAME = other.m_##attr_NAME;
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
}
 
 
 
/*
bool LineStyle::definesAll() const
{
return definesLineSpacing() &&
definesLeftMargin() &&
definesRightMargin() &&
definesFirstIndent() &&
definesAlignment() &&
definesGapBefore() &&
definesLineSpacingMode() &&
definesGapAfter() &&
definesHasDropCap() &&
definesDropCapOffset() &&
definesDropCapLines() &&
definesUseBaselineGrid() &&
lineStyle().definesAll() ;
}
 
// equiv. to "*this == LineStyle()"
bool LineStyle::inheritsAll() const
{
return inheritsLineSpacing() &&
inheritsLeftMargin() &&
inheritsRightMargin() &&
inheritsFirstIndent() &&
inheritsAlignment() &&
inheritsGapBefore() &&
inheritsLineSpacingMode() &&
inheritsGapAfter() &&
inheritsHasDropCap() &&
inheritsDropCapOffset() &&
inheritsDropCapLines() &&
inheritsUseBaselineGrid() &&
lineStyle().inheritsAll() ;
}
*/
 
typedef QValueList<LineStyle> Sublist;
 
static QString toXMLString(const Sublist & )
{
return "dummy";
}
 
 
void LineStyle::saxx(SaxHandler& handler, Xml_string elemtag) const
{
Xml_attr att;
Style::saxxAttributes(att);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && # attr_NAME != "Sublines") \
att.insert(# attr_NAME, toXMLString(m_##attr_NAME));
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
handler.begin(elemtag, att);
Sublist::const_iterator it;
for (it=m_Sublines.begin(); it != m_Sublines.end(); ++it)
{
(*it).saxx(handler, "subline");
}
handler.end(elemtag);
}
 
 
 
 
template<>
Sublist parse<Sublist>(Xml_string str)
{
return Sublist();
}
 
template<>
Qt::PenStyle parse<Qt::PenStyle>(Xml_string str)
{
return parseEnum<Qt::PenStyle>(str);
}
 
template<>
Qt::PenCapStyle parse<Qt::PenCapStyle>(Xml_string str)
{
return parseEnum<Qt::PenCapStyle>(str);
}
 
template<>
Qt::PenJoinStyle parse<Qt::PenJoinStyle>(Xml_string str)
{
return parseEnum<Qt::PenJoinStyle>(str);
}
 
 
 
using namespace desaxe;
 
 
const Xml_string LineStyle::saxxDefaultElem("linestyle");
 
void LineStyle::desaxeRules(Xml_string prefixPattern, Digester& ruleset, Xml_string elemtag)
{
Xml_string stylePrefix(Digester::concat(prefixPattern, elemtag));
ruleset.addRule(stylePrefix, Factory<LineStyle>());
Style::desaxeRules(prefixPattern, ruleset, elemtag);
Xml_string subPrefix(Digester::concat(Digester::concat(stylePrefix, "**"), "subline"));
ruleset.addRule(subPrefix, Factory<LineStyle>());
Style::desaxeRules(Digester::concat(stylePrefix, "**"), ruleset, "subline");
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if ( # attr_NAME != "Sublines" ) { \
ruleset.addRule(stylePrefix, SetAttributeWithConversion<LineStyle, attr_TYPE> ( & LineStyle::set##attr_NAME, # attr_NAME, &parse<attr_TYPE> )); \
ruleset.addRule(subPrefix, SetAttributeWithConversion<LineStyle, attr_TYPE> ( & LineStyle::set##attr_NAME, # attr_NAME, &parse<attr_TYPE> )); \
}
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
ruleset.addRule(subPrefix, SetterWithConversion<LineStyle, const LineStyle&, LineStyle>( & LineStyle::appendSubline ));
}
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/linestyle.h
===================================================================
--- Version13x/Scribus/scribus/styles/linestyle.h (nonexistent)
+++ Version13x/Scribus/scribus/styles/linestyle.h (revision 8337)
@@ -0,0 +1,149 @@
+/*
+ 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. *
+* *
+***************************************************************************/
+
+
+#ifndef LINESTYLE_H
+#define LINESTYLE_H
+
+#include <qstring.h>
+#include <qvaluelist.h>
+#include "style.h"
+#include "styles/stylecontextproxy.h"
+
+class SCRIBUS_API LineStyle : public Style {
+public:
+
+
+ LineStyle() : Style(), lineStyleProxy(this) {
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ m_##attr_NAME = attr_DEFAULT; \
+ inh_##attr_NAME = true;
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+ };
+
+ LineStyle(double width, const QString& color, double shade=100) : Style(), lineStyleProxy(this) {
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ m_##attr_NAME = attr_DEFAULT; \
+ inh_##attr_NAME = true;
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+ setWidth(width);
+ setColor(color);
+ setShade(shade);
+ };
+
+ LineStyle(const LineStyle & other);
+
+ LineStyle & operator=(const LineStyle & other);
+
+ static const Xml_string saxxDefaultElem;
+ static void desaxeRules(Xml_string prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
+
+ virtual void saxx(SaxHandler& handler, Xml_string elemtag) const;
+ virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
+
+ QString displayName() const;
+
+ void update(const StyleContext * b);
+
+ bool equiv(const Style& other) const;
+
+ void applyLineStyle(const LineStyle & other);
+ void eraseLineStyle(const LineStyle & other);
+ void setStyle(const LineStyle & other);
+ void erase() { eraseLineStyle(*this); }
+
+ QString asString() const;
+
+ /** getter: validates and returns the attribute's value */
+
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ const attr_TYPE attr_GETTER() const { validate(); return m_##attr_NAME; }
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+
+ /** setter: sets the attribute's value and clears inherited flag */
+
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ void set##attr_NAME(attr_TYPE v) { m_##attr_NAME = v; inh_##attr_NAME = false; }
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+ void appendSubline(const LineStyle& subline) { validate(); m_Sublines.append(subline); inh_Sublines = false; }
+
+ /** setter: resets the attribute's value and sets inherited flag */
+
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ void reset##attr_NAME() { m_##attr_NAME = attr_DEFAULT; inh_##attr_NAME = true; }
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+
+ /** isInherited: returns true if the attribute is inherited */
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ bool isInh##attr_NAME() const { return inh_##attr_NAME; }
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+
+
+ /** isDefined: returns true if the attribute is defined in this style or any parent */
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ bool isDef##attr_NAME() const { \
+ if ( !inh_##attr_NAME ) return true; \
+ const LineStyle * par = dynamic_cast<const LineStyle*>(parentStyle()); \
+ return par && par->isDef##attr_NAME(); \
+ }
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+
+
+private:
+
+ StyleContextProxy lineStyleProxy;
+ // FIXME: see pstyle how this works for nested styles
+
+
+ // member declarations:
+
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ attr_TYPE m_##attr_NAME; \
+ bool inh_##attr_NAME;
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+};
+
+
+inline LineStyle & LineStyle::operator=(const LineStyle & other)
+{
+ static_cast<Style&>(*this) = static_cast<const Style&>(other);
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ m_##attr_NAME = other.m_##attr_NAME; \
+ inh_##attr_NAME = other.inh_##attr_NAME;
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+ m_contextversion = -1;
+ return *this;
+}
+
+inline LineStyle::LineStyle(const LineStyle & other) : Style(other), lineStyleProxy(this)
+{
+#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
+ m_##attr_NAME = other.m_##attr_NAME; \
+ inh_##attr_NAME = other.inh_##attr_NAME;
+#include "linestyle.attrdefs.cxx"
+#undef ATTRDEF
+ m_contextversion = -1;
+}
+
+#endif
/Version13x/Scribus/scribus/styles/linestyle.h
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/paragraphstyle.cpp
===================================================================
--- Version13x/Scribus/scribus/styles/paragraphstyle.cpp (revision 8336)
+++ Version13x/Scribus/scribus/styles/paragraphstyle.cpp (revision 8337)
@@ -16,7 +16,7 @@
-#include "style.h"
+#include "paragraphstyle.h"
#include "desaxe/saxiohelper.h"
#include "desaxe/simple_actions.h"
@@ -212,10 +212,7 @@
void ParagraphStyle::saxx(SaxHandler& handler, Xml_string elemtag) const
{
Xml_attr att;
- if (!name().isEmpty())
- att.insert("name", name());
- if (!parent().isEmpty())
- att.insert("parent", parent());
+ Style::saxxAttributes(att);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if (!inh_##attr_NAME && # attr_NAME != "TabValues") \
att.insert(# attr_NAME, toXMLString(m_##attr_NAME));
@@ -232,7 +229,8 @@
tab.insert("type", toXMLString(tb.tabType));
handler.beginEnd("tabstop", tab);
}
- charStyle().saxx(handler);
+ if (charStyle() != CharStyle())
+ charStyle().saxx(handler);
handler.end(elemtag);
}
@@ -306,8 +304,7 @@
Xml_string stylePrefix(Digester::concat(prefixPattern, elemtag));
ruleset.addRule(stylePrefix, Factory<ParagraphStyle>());
- ruleset.addRule(stylePrefix, SetAttributeWithConversion<ParagraphStyle, const QString&>( & ParagraphStyle::setName, "name", &parse<const QString&>));
- ruleset.addRule(stylePrefix, SetAttributeWithConversion<ParagraphStyle, const QString&>( & ParagraphStyle::setParent, "parent", &parse<const QString&>));
+ Style::desaxeRules(prefixPattern, ruleset, elemtag);
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
if ( # attr_NAME != "TabValues") \
ruleset.addRule(stylePrefix, SetAttributeWithConversion<ParagraphStyle, attr_TYPE> ( & ParagraphStyle::set##attr_NAME, # attr_NAME, &parse<attr_TYPE> ));
/branches/Version13x/Scribus/scribus/styles/Makefile.am
1,6 → 1,6
noinst_LTLIBRARIES=libstyles.la
 
libstyles_la_SOURCES=charstyle.cpp paragraphstyle.cpp stylecontext.cpp stylecontextproxy.cpp
libstyles_la_SOURCES=linestyle.cpp charstyle.cpp paragraphstyle.cpp stylecontext.cpp stylecontextproxy.cpp
 
EXTRA_DIST = CMakeLists.txt
 
/branches/Version13x/Scribus/scribus/styles/paragraphstyle.h
13,8 → 13,12
* *
***************************************************************************/
 
#ifndef PARAGRAPHSTYLE_H
#define PARAGRAPHSTYLE_H
 
// DONT INCLUDE this file directly, include "style.h" instead!
#include "style.h"
#include "charstyle.h"
#include "styles/stylecontextproxy.h"
 
class SCRIBUS_API ParagraphStyle : public Style
{
108,7 → 112,9
void set##attr_NAME(attr_TYPE v) { m_##attr_NAME = v; inh_##attr_NAME = false; }
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
void appendTabValue(const TabRecord& tab) { validate(); m_TabValues.append(tab); inh_TabValues = false; }
/** setter: resets the attribute's value and sets inherited flag */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
148,3 → 154,5
#undef ATTRDEF
};
 
#endif
/branches/Version13x/Scribus/scribus/styles/CMakeLists.txt
10,6 → 10,7
SET(SCRIBUS_STYLES_LIB_SOURCES
stylecontext.cpp
stylecontextproxy.cpp
linestyle.cpp
charstyle.cpp
paragraphstyle.cpp
)
/branches/Version13x/Scribus/scribus/text/sctext_shared.h
11,19 → 11,11
//#include "text/paragraphlayout.h"
#include "text/frect.h"
#include "style.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
#include "styles/stylecontextproxy.h"
 
#ifdef NLS_CONFORMANCE
#define NLS_PRIVATE private
#else
#define NLS_PRIVATE public
#endif
 
class CharStyle;
class ParagraphStyle;
class PageItem;
 
 
class SCRIBUS_API ScText_Shared : public QPtrList<ScText>
{
public:
/branches/Version13x/Scribus/scribus/text/storytext.cpp
73,7 → 73,7
m_lastMagicPos = -1;
}
 
StoryText::StoryText(const StoryText & other) : QObject(), doc(other.doc)
StoryText::StoryText(const StoryText & other) : QObject(), SaxIO(), doc(other.doc)
{
d = other.d;
d->refs++;
1196,7 → 1196,8
if (lastWasPar)
{
handler.begin("para", empty);
paragraphStyle(i).saxx(handler);
if (paragraphStyle(i) != ParagraphStyle())
paragraphStyle(i).saxx(handler);
handler.end("para");
}
else if (curr == SpecialChars::OBJECT && object(i) != NULL)
/branches/Version13x/Scribus/scribus/text/storytext.h
37,6 → 37,8
#include "text/specialchars.h"
#include "sctextstruct.h"
#include "style.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
#include "desaxe/saxio.h"
 
#ifdef NLS_CONFORMANCE
/branches/Version13x/Scribus/scribus/style.h
66,6 → 66,16
virtual ~Style() {}
 
// this is an abstract class, so:
// static const Xml_string saxxDefaultElem;
static void desaxeRules(Xml_string prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag);
void saxxAttributes(Xml_attr& attr) const;
//virtual void saxx(SaxHandler& handler, Xml_string elemtag) const;
//virtual void saxx(SaxHandler& handler) const { saxx(handler, saxxDefaultElem); }
QString name() const { return m_name; }
void setName(const QString& n) { m_name = n; }
bool hasName() const { return ! m_name.isEmpty(); }
140,10 → 150,5
};
 
 
//FIXME: make this proper: charstyle.h #includes style.h, pstyle.h #includes style.h and stylecontextproxy.h
#include "styles/stylecontextproxy.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
 
 
#endif
/branches/Version13x/Scribus/scribus/util.h
21,6 → 21,8
#include "fpointarray.h"
#include "pagestructs.h"
#include "style.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
#include "scribusapi.h"
 
class ScribusDoc;
/branches/Version13x/Scribus/scribus/pageitem_desaxe.cpp
18,56 → 18,7
using namespace desaxe;
 
 
Xml_string toXMLString(const QValueList<double>& doublelist)
{
QString result = "";
QValueList<double>::const_iterator dax;
for (dax = doublelist.begin(); dax != doublelist.end(); ++dax)
result += toXMLString(*dax) + " ";
return result;
}
 
 
QValueList<double> parseDoubleList(Xml_string str)
{
QStringList strlist = QStringList::split(' ', str);
QValueList<double> result;
for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
result.append(parseDouble(*it));
return result;
}
 
 
Xml_string toXMLString(const QValueList<int>& intlist)
{
QString result = "";
QValueList<int>::const_iterator dax;
for (dax = intlist.begin(); dax != intlist.end(); ++dax)
result += toXMLString(*dax) + " ";
return result;
}
 
 
QValueList<int> parseIntList(Xml_string str)
{
QStringList strlist = QStringList::split(' ', str);
QValueList<int> result;
for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
result.append(parseInt(*it));
return result;
}
 
 
QValueStack<int> parseIntStack(Xml_string str)
{
QStringList strlist = QStringList::split(' ', str);
QValueStack<int> result;
for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
result.append(parseInt(*it));
return result;
}
 
 
FPointArray parseSVG(Xml_string str)
{
FPointArray result;
/branches/Version13x/Scribus/scribus/desaxe/saxiohelper.cpp
97,7 → 97,56
}
 
 
Xml_string toXMLString(const QValueList<double>& doublelist)
{
QString result = "";
QValueList<double>::const_iterator dax;
for (dax = doublelist.begin(); dax != doublelist.end(); ++dax)
result += toXMLString(*dax) + " ";
return result;
}
 
 
QValueList<double> parseDoubleList(Xml_string str)
{
QStringList strlist = QStringList::split(' ', str);
QValueList<double> result;
for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
result.append(parseDouble(*it));
return result;
}
 
 
Xml_string toXMLString(const QValueList<int>& intlist)
{
QString result = "";
QValueList<int>::const_iterator dax;
for (dax = intlist.begin(); dax != intlist.end(); ++dax)
result += toXMLString(*dax) + " ";
return result;
}
 
 
QValueList<int> parseIntList(Xml_string str)
{
QStringList strlist = QStringList::split(' ', str);
QValueList<int> result;
for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
result.append(parseInt(*it));
return result;
}
 
 
QValueStack<int> parseIntStack(Xml_string str)
{
QStringList strlist = QStringList::split(' ', str);
QValueStack<int> result;
for (QStringList::iterator it=strlist.begin(); it != strlist.end(); ++it)
result.append(parseInt(*it));
return result;
}
 
 
// FIXME: the following should not be in desaxe:
Xml_string toXMLString(const ScFace& val)
{
/branches/Version13x/Scribus/scribus/desaxe/saxiohelper.h
2,7 → 2,10
#define SAXHELPER_H
 
#include "desaxe_conf.h"
#include <qvaluelist.h>
#include <qvaluestack.h>
 
 
class ScFace;
class FPointArray;
 
18,6 → 21,9
Xml_string toXMLString(const ScFace& val);
Xml_string toXMLString(const FPointArray& path);
 
Xml_string toXMLString(const QValueList<double>& doublelist);
Xml_string toXMLString(const QValueList<int>& intlist);
 
unsigned int parseUInt(Xml_string str);
int parseInt(Xml_string str);
unsigned long parseULong(Xml_string str);
25,6 → 31,9
double parseDouble(Xml_string str);
float parseFloat(Xml_string str);
bool parseBool(Xml_string str);
QValueList<double> parseDoubleList(Xml_string str);
QValueList<int> parseIntList(Xml_string str);
QValueStack<int> parseIntStack(Xml_string str);
 
template<class ENUM>
inline
90,5 → 99,19
return parseBool(str);
}
 
template<>
inline
QValueList<int> parse<QValueList<int> >(Xml_string str)
{
return parseIntList(str);
}
 
template<>
inline
QValueList<double> parse<QValueList<double> >(Xml_string str)
{
return parseDoubleList(str);
}
 
 
#endif
/branches/Version13x/Scribus/scribus/sctextstruct.h
24,6 → 24,8
 
#include "scfonts.h"
#include "style.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
 
class PageItem;