summaryrefslogtreecommitdiff
path: root/svgio/inc
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-07-25 08:28:44 +0000
committerXisco Fauli <anistenis@gmail.com>2013-04-14 17:52:33 +0200
commitf75ca1fdad1094fbea4bb6cb0e3cc9458700c470 (patch)
tree8e99cbe055a075b77315985621b314884077a870 /svgio/inc
parent1591194a5fc45cbd44c0f4cb022d8ff8c88e0a24 (diff)
Fix #120334# Added support for multiple CSS styles per graphic primitive
(cherry picked from commit 37446076e684a0d0de448366ab927531e3b54bba) Conflicts: svgio/inc/svgio/svgreader/svgstyleattributes.hxx svgio/source/svgreader/svgcirclenode.cxx svgio/source/svgreader/svgellipsenode.cxx svgio/source/svgreader/svggnode.cxx svgio/source/svgreader/svgimagenode.cxx svgio/source/svgreader/svglinenode.cxx svgio/source/svgreader/svgmarkernode.cxx svgio/source/svgreader/svgpathnode.cxx svgio/source/svgreader/svgpatternnode.cxx svgio/source/svgreader/svgpolynode.cxx svgio/source/svgreader/svgrectnode.cxx svgio/source/svgreader/svgstyleattributes.cxx svgio/source/svgreader/svgtextnode.cxx svgio/source/svgreader/svgusenode.cxx Change-Id: Id554528932eea590d645cb5e5a1ea8cf7f1d0aac
Diffstat (limited to 'svgio/inc')
-rw-r--r--svgio/inc/svgio/svgreader/svgnode.hxx8
-rw-r--r--svgio/inc/svgio/svgreader/svgstyleattributes.hxx27
2 files changed, 26 insertions, 9 deletions
diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx
index 1fc1e50deb44..759859bd395c 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -47,6 +47,7 @@ namespace svgio
namespace svgreader
{
typedef ::std::vector< SvgNode* > SvgNodeVector;
+ typedef ::std::vector< const SvgStyleAttributes* > SvgStyleAttributeVector;
enum XmlSpace
{
@@ -76,6 +77,13 @@ namespace svgio
/// XmlSpace value
XmlSpace maXmlSpace;
+ /// CSS styles
+ SvgStyleAttributeVector maCssStyleVector;
+
+ protected:
+ /// helper to evtl. link to css style
+ const SvgStyleAttributes* checkForCssStyle(const rtl::OUString& rClassStr, const SvgStyleAttributes& rOriginal) const;
+
public:
SvgNode(
SVGToken aType,
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index 6de635109810..e8c39d7c5943 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -136,12 +136,18 @@ namespace svgio
TextAnchor_end
};
+ enum FillRule
+ {
+ FillRule_notset,
+ FillRule_nonzero,
+ FillRule_evenodd
+ };
+
class SvgStyleAttributes
{
private:
SvgNode& mrOwner;
const SvgStyleAttributes* mpCssStyleParent;
-
SvgPaint maFill;
SvgPaint maStroke;
SvgPaint maStopColor;
@@ -184,18 +190,19 @@ namespace svgio
OUString maMarkerEndXLink;
const SvgMarkerNode* mpMarkerEndXLink;
+ /// fill rule
+ FillRule maFillRule;
+
+ // ClipRule setting (only valid wne mbIsClipPathContent == true, default is FillRule_nonzero)
+ FillRule maClipRule;
+
/// bitfield
- bool maFillRule : 1; // true: NonZero, false: EvenOdd
- bool maFillRuleSet : 1;
// defines if this attributes are part of a ClipPath. If yes,
// rough geometry will be created on decomposition by patching
// vaules for fill, stroke, strokeWidth and others
bool mbIsClipPathContent : 1;
- // ClipRule setting (only valid wne mbIsClipPathContent == true)
- bool mbClipRule : 1; // true == nonzero(default), false == evenodd
-
/// internal helpers
void add_fillGradient(
const basegfx::B2DPolyPolygon& rPath,
@@ -253,8 +260,9 @@ namespace svgio
const drawinglayer::primitive2d::Primitive2DSequence& rSource,
const basegfx::B2DHomMatrix* pTransform) const;
- /// helper to evtl. link to css style
- void checkForCssStyle(const OUString& rClassStr) const;
+ /// helper to set mpCssStyleParent temporarily for CSS style hierarchies
+ void setCssStyleParent(const SvgStyleAttributes* pNew) { mpCssStyleParent = pNew; }
+ const SvgStyleAttributes* getCssStyleParent() const { return mpCssStyleParent; }
/// scan helpers
void readStyle(const OUString& rCandidate);
@@ -304,7 +312,8 @@ namespace svgio
void setFillOpacity(const SvgNumber& rFillOpacity = SvgNumber()) { maFillOpacity = rFillOpacity; }
/// fill rule content
- bool getFillRule() const;
+ const FillRule getFillRule() const;
+ void setFillRule(const FillRule aFillRule = FillRule_notset) { maFillRule = aFillRule; }
/// fill StrokeDasharray content
const SvgNumberVector& getStrokeDasharray() const;