diff --git a/src/style.h b/src/style.h
index 9a2c72f16a694005d01076a0ced930f2905e63a0..b4663e8f6c043cb86434eafb514e9a08306611a6 100644 (file)
--- a/src/style.h
+++ b/src/style.h
-#ifndef __SP_STYLE_H__
-#define __SP_STYLE_H__
+#ifndef SEEN_SP_STYLE_H
+#define SEEN_SP_STYLE_H
/** \file
* SPStyle - a style object for SPItem objects
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
+ * Jon A. Cruz <jon@joncruz.org>
*
+ * Copyright (C) 2010 Jon A. Cruz
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
*
class SPILength;
class SPIPaint;
class SPIFontSize;
+class SPIBaselineShift;
/// Float type internal to SPStyle.
struct SPIFloat {
#define SP_STYLE_FILL_SERVER(s) (((SPStyle *) (s))->getFillPaintServer())
#define SP_STYLE_STROKE_SERVER(s) (((SPStyle *) (s))->getStrokePaintServer())
-#define SP_OBJECT_STYLE_FILL_SERVER(o) (SP_OBJECT (o)->style->getFillPaintServer())
-#define SP_OBJECT_STYLE_STROKE_SERVER(o) (SP_OBJECT (o)->style->getStrokePaintServer())
class SVGICCColor;
SPColor color;
} value;
+ SPIPaint();
bool isSet() const { return true; /* set || colorSet*/}
bool isSameType( SPIPaint const & other ) const {return (isPaintserver() == other.isPaintserver()) && (colorSet == other.colorSet) && (currentcolor == other.currentcolor);}
void setColor( float r, float g, float b ) {value.color.set( r, g, b ); colorSet = true;}
void setColor( guint32 val ) {value.color.set( val ); colorSet = true;}
void setColor( SPColor const& color ) {value.color = color; colorSet = true;}
+
+ void read( gchar const *str, SPStyle &tyle, SPDocument *document = 0);
+
+ // Win32 is a temp work-around until the emf extension is fixed:
+#ifndef WIN32
+private:
+ SPIPaint(SPIPaint const&);
+ SPIPaint &operator=(SPIPaint const &);
+#endif // WIN32
};
/// Filter type internal to SPStyle
SP_FONT_SIZE_PERCENTAGE
};
+enum {
+ SP_BASELINE_SHIFT_LITERAL,
+ SP_BASELINE_SHIFT_LENGTH,
+ SP_BASELINE_SHIFT_PERCENTAGE
+};
+
#define SP_FONT_SIZE ((1 << 24) - 1)
#define SP_F8_16_TO_FLOAT(v) ((gdouble) (v) / (1 << 16))
float computed;
};
+/// Baseline shift type internal to SPStyle.
+struct SPIBaselineShift {
+ unsigned set : 1;
+ unsigned inherit : 1;
+ unsigned type : 2;
+ unsigned unit : 4;
+ unsigned literal: 2;
+ float value; // Can be negative
+ float computed;
+};
+
/// Text decoration type internal to SPStyle.
struct SPITextDecoration {
unsigned set : 1;
SPIEnum block_progression;
/** Writing mode (css3 text 3.2 and svg1.1 10.7.2) */
SPIEnum writing_mode;
+ /** Baseline shift (svg1.1 10.9.2) */
+ SPIBaselineShift baseline_shift;
/* SVG */
/** Anchor of the text (svg1.1 10.9.1) */
SPIEnum enable_background;
/// style belongs to a cloned object
- bool cloned;
+ bool cloned;
sigc::connection release_connection;
sigc::connection fill_ps_modified_connection;
sigc::connection stroke_ps_modified_connection;
- SPObject *getFilter() {if (filter.href) return filter.href->getObject(); else return NULL;}
- const gchar *getFilterURI() {if (filter.href) return filter.href->getURI()->toString(); else return NULL;}
- SPPaintServer *getFillPaintServer() {if (fill.value.href) return fill.value.href->getObject(); else return NULL;}
- const gchar *getFillURI() {if (fill.value.href) return fill.value.href->getURI()->toString(); else return NULL;}
- SPPaintServer *getStrokePaintServer() {if (stroke.value.href) return stroke.value.href->getObject(); else return NULL;}
- const gchar *getStrokeURI() {if (stroke.value.href) return stroke.value.href->getURI()->toString(); else return NULL;}
+ SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : 0; }
+ SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : 0; }
+ gchar const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : 0; }
+
+ SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : 0; }
+ SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : 0; }
+ gchar const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : 0; }
+
+ SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : 0; }
+ SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : 0; }
+ gchar const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : 0; }
};
SPStyle *sp_style_new(SPDocument *document);
SP_CSS_TEXT_ANCHOR_END
};
+enum SPCSSBaselineShift {
+ SP_CSS_BASELINE_SHIFT_BASELINE,
+ SP_CSS_BASELINE_SHIFT_SUB,
+ SP_CSS_BASELINE_SHIFT_SUPER
+};
+
enum SPVisibility {
SP_CSS_VISIBILITY_HIDDEN,
SP_CSS_VISIBILITY_COLLAPSE,
/* Full font name, as font_factory::ConstructFontSpecification would give */
SPIString font_specification;
-
+
/** \todo fixme: The 'font' property is ugly, and not working (lauris) */
SPIString font;
};
gchar *attribute_unquote(gchar const *val);
gchar *css2_escape_quote(gchar const *val);
-#endif
+#endif // SEEN_SP_STYLE_H
/*
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :