summaryrefslogtreecommitdiff
path: root/svgio
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
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')
-rw-r--r--svgio/inc/svgio/svgreader/svgnode.hxx8
-rw-r--r--svgio/inc/svgio/svgreader/svgstyleattributes.hxx27
-rw-r--r--svgio/source/svgreader/svgcirclenode.cxx4
-rw-r--r--svgio/source/svgreader/svgellipsenode.cxx6
-rw-r--r--svgio/source/svgreader/svggnode.cxx6
-rw-r--r--svgio/source/svgreader/svgimagenode.cxx6
-rw-r--r--svgio/source/svgreader/svglinenode.cxx6
-rw-r--r--svgio/source/svgreader/svgmarkernode.cxx6
-rw-r--r--svgio/source/svgreader/svgnode.cxx93
-rw-r--r--svgio/source/svgreader/svgpathnode.cxx6
-rw-r--r--svgio/source/svgreader/svgpatternnode.cxx6
-rw-r--r--svgio/source/svgreader/svgpolynode.cxx8
-rw-r--r--svgio/source/svgreader/svgrectnode.cxx6
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx73
-rw-r--r--svgio/source/svgreader/svgtextnode.cxx6
-rw-r--r--svgio/source/svgreader/svgusenode.cxx6
16 files changed, 156 insertions, 117 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;
diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx
index 4f26ae9abae2..6dc269ca867a 100644
--- a/svgio/source/svgreader/svgcirclenode.cxx
+++ b/svgio/source/svgreader/svgcirclenode.cxx
@@ -47,9 +47,7 @@ namespace svgio
const SvgStyleAttributes* SvgCircleNode::getSvgStyleAttributes() const
{
static OUString aClassStr(OUString::createFromAscii("circle"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgCircleNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx
index 12289929dbd8..aa42d7adc757 100644
--- a/svgio/source/svgreader/svgellipsenode.cxx
+++ b/svgio/source/svgreader/svgellipsenode.cxx
@@ -47,10 +47,8 @@ namespace svgio
const SvgStyleAttributes* SvgEllipseNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("ellipse"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("ellipse"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgEllipseNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx
index 80a0fa141d96..d18534092300 100644
--- a/svgio/source/svgreader/svggnode.cxx
+++ b/svgio/source/svgreader/svggnode.cxx
@@ -45,10 +45,8 @@ namespace svgio
const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("g"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("g"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgGNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx
index 952472c1cff4..7c7de6b6493e 100644
--- a/svgio/source/svgreader/svgimagenode.cxx
+++ b/svgio/source/svgreader/svgimagenode.cxx
@@ -64,10 +64,8 @@ namespace svgio
const SvgStyleAttributes* SvgImageNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("image"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("image"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgImageNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx
index 877bd222014d..74e9facbf973 100644
--- a/svgio/source/svgreader/svglinenode.cxx
+++ b/svgio/source/svgreader/svglinenode.cxx
@@ -47,10 +47,8 @@ namespace svgio
const SvgStyleAttributes* SvgLineNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("line"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("line"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgLineNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx
index 5ee664d08e42..e79b0f07c3ad 100644
--- a/svgio/source/svgreader/svgmarkernode.cxx
+++ b/svgio/source/svgreader/svgmarkernode.cxx
@@ -50,10 +50,8 @@ namespace svgio
const SvgStyleAttributes* SvgMarkerNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("marker"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("marker"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgMarkerNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index d00beaf1908f..81a47c7ddf12 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -35,6 +35,96 @@ namespace svgio
return 0;
}
+ const SvgStyleAttributes* SvgNode::checkForCssStyle(const rtl::OUString& rClassStr, const SvgStyleAttributes& rOriginal) const
+ {
+ const SvgDocument& rDocument = getDocument();
+
+ if(rDocument.hasSvgStyleAttributesById())
+ {
+ if(getClass())
+ {
+ // find all referenced CSS styles, a list of entries is allowed
+ const rtl::OUString* pClassList = getClass();
+ const sal_Int32 nLen(pClassList->getLength());
+ sal_Int32 nPos(0);
+ const SvgStyleAttributes* pNew = 0;
+
+ skip_char(*pClassList, sal_Unicode(' '), nPos, nLen);
+
+ while(nPos < nLen)
+ {
+ rtl::OUStringBuffer aTokenValue;
+
+ copyToLimiter(*pClassList, sal_Unicode(' '), nPos, aTokenValue, nLen);
+ skip_char(*pClassList, sal_Unicode(' '), nPos, nLen);
+
+ rtl::OUString aId(rtl::OUString::createFromAscii("."));
+ const rtl::OUString aOUTokenValue(aTokenValue.makeStringAndClear());
+
+ // look for CSS style common to token
+ aId = aId + aOUTokenValue;
+ pNew = rDocument.findSvgStyleAttributesById(aId);
+
+ if(!pNew && rClassStr.getLength())
+ {
+ // look for CSS style common to class.token
+ aId = rClassStr + aId;
+
+ pNew = rDocument.findSvgStyleAttributesById(aId);
+ }
+
+ if(pNew)
+ {
+ const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
+ }
+ }
+ }
+
+ if(maCssStyleVector.empty() && getId())
+ {
+ // if none found, search for CSS style equal to Id
+ const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(*getId());
+
+ if(pNew)
+ {
+ const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
+ }
+ }
+
+ if(maCssStyleVector.empty() && rClassStr.getLength())
+ {
+ // if none found, search for CSS style equal to class type
+ const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(rClassStr);
+
+ if(pNew)
+ {
+ const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
+ }
+ }
+ }
+
+ if(maCssStyleVector.empty())
+ {
+ return &rOriginal;
+ }
+ else
+ {
+ // set CssStyleParent at maCssStyleVector members to hang them in front of
+ // the existing style
+ SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(&rOriginal);
+
+ for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++)
+ {
+ SvgStyleAttributes* pCandidate = const_cast< SvgStyleAttributes* >(maCssStyleVector[maCssStyleVector.size() - a - 1]);
+
+ pCandidate->setCssStyleParent(pCurrent);
+ pCurrent = pCandidate;
+ }
+
+ return pCurrent;
+ }
+ }
+
SvgNode::SvgNode(
SVGToken aType,
SvgDocument& rDocument,
@@ -46,7 +136,8 @@ namespace svgio
maChildren(),
mpId(0),
mpClass(0),
- maXmlSpace(XmlSpace_notset)
+ maXmlSpace(XmlSpace_notset),
+ maCssStyleVector()
{
OSL_ENSURE(SVGTokenUnknown != maType, "SvgNode with unknown type created (!)");
diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx
index a50beefc306c..9e77f723a6df 100644
--- a/svgio/source/svgreader/svgpathnode.cxx
+++ b/svgio/source/svgreader/svgpathnode.cxx
@@ -45,10 +45,8 @@ namespace svgio
const SvgStyleAttributes* SvgPathNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("path"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("path"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgPathNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx
index c507bd3ffdf3..229a7c6246a3 100644
--- a/svgio/source/svgreader/svgpatternnode.cxx
+++ b/svgio/source/svgreader/svgpatternnode.cxx
@@ -64,10 +64,8 @@ namespace svgio
const SvgStyleAttributes* SvgPatternNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("pattern"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("pattern"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgPatternNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx
index 3100fc30a00e..eef4808404dc 100644
--- a/svgio/source/svgreader/svgpolynode.cxx
+++ b/svgio/source/svgreader/svgpolynode.cxx
@@ -47,11 +47,9 @@ namespace svgio
const SvgStyleAttributes* SvgPolyNode::getSvgStyleAttributes() const
{
- static OUString aClassStrA(OUString::createFromAscii("polygon"));
- static OUString aClassStrB(OUString::createFromAscii("polyline"));
- maSvgStyleAttributes.checkForCssStyle(mbIsPolyline? aClassStrB : aClassStrA);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStrA(rtl::OUString::createFromAscii("polygon"));
+ static rtl::OUString aClassStrB(rtl::OUString::createFromAscii("polyline"));
+ return checkForCssStyle(mbIsPolyline? aClassStrB : aClassStrA, maSvgStyleAttributes);
}
void SvgPolyNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx
index c3948164e342..5d518a46c245 100644
--- a/svgio/source/svgreader/svgrectnode.cxx
+++ b/svgio/source/svgreader/svgrectnode.cxx
@@ -49,10 +49,8 @@ namespace svgio
const SvgStyleAttributes* SvgRectNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("rect"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("rect"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgRectNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index a64e66e0b734..aa672a61a35a 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -203,53 +203,11 @@ namespace svgio
}
}
- void SvgStyleAttributes::checkForCssStyle(const OUString& rClassStr) const
- {
- if(!mpCssStyleParent)
- {
- const SvgDocument& rDocument = mrOwner.getDocument();
- const SvgStyleAttributes* pNew = 0;
-
- if(rDocument.hasSvgStyleAttributesById())
- {
- if(mrOwner.getClass())
- {
- OUString aId(OUString::createFromAscii("."));
- aId = aId + *mrOwner.getClass();
- pNew = rDocument.findSvgStyleAttributesById(aId);
-
- if(!pNew && rClassStr.getLength())
- {
- aId = rClassStr + aId;
-
- pNew = rDocument.findSvgStyleAttributesById(aId);
- }
- }
-
- if(!pNew && mrOwner.getId())
- {
- pNew = rDocument.findSvgStyleAttributesById(*mrOwner.getId());
- }
-
- if(!pNew && rClassStr.getLength())
- {
- pNew = rDocument.findSvgStyleAttributesById(rClassStr);
- }
-
- if(pNew)
- {
- // found css style, set as parent
- const_cast< SvgStyleAttributes* >(this)->mpCssStyleParent = pNew;
- }
- }
- }
- }
-
const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const
{
- if(mpCssStyleParent)
+ if(getCssStyleParent())
{
- return mpCssStyleParent;
+ return getCssStyleParent();
}
if(mrOwner.getParent())
@@ -1061,8 +1019,8 @@ namespace svgio
{
basegfx::B2DPolyPolygon aPath(rPath);
const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType());
- const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && mbClipRule);
- const bool bFillRuleIsNonzero(!bIsLine && bNeedToCheckClipRule && !mbIsClipPathContent && getFillRule());
+ const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && FillRule_nonzero == maClipRule);
+ const bool bFillRuleIsNonzero(!bIsLine && bNeedToCheckClipRule && !mbIsClipPathContent && FillRule_nonzero == getFillRule());
if(bClipPathIsNonzero || bFillRuleIsNonzero)
{
@@ -1196,10 +1154,9 @@ namespace svgio
mpMarkerMidXLink(0),
maMarkerEndXLink(),
mpMarkerEndXLink(0),
- maFillRule(true),
- maFillRuleSet(false),
- mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()),
- mbClipRule(true)
+ maFillRule(FillRule_notset),
+ maClipRule(FillRule_nonzero),
+ mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType())
{
if(!mbIsClipPathContent)
{
@@ -1266,13 +1223,11 @@ namespace svgio
{
if(aContent.match(commonStrings::aStrNonzero))
{
- maFillRule = true;
- maFillRuleSet = true;
+ maFillRule = FillRule_nonzero;
}
else if(aContent.match(commonStrings::aStrEvenOdd))
{
- maFillRule = false;
- maFillRuleSet = true;
+ maFillRule = FillRule_evenodd;
}
}
break;
@@ -1783,11 +1738,11 @@ namespace svgio
{
if(aContent.match(commonStrings::aStrNonzero))
{
- mbClipRule = true;
+ maClipRule = FillRule_nonzero;
}
else if(aContent.match(commonStrings::aStrEvenOdd))
{
- mbClipRule = false;
+ maClipRule = FillRule_evenodd;
}
}
break;
@@ -2041,9 +1996,9 @@ namespace svgio
return SvgNumber(1.0);
}
- bool SvgStyleAttributes::getFillRule() const
+ const FillRule SvgStyleAttributes::getFillRule() const
{
- if(maFillRuleSet)
+ if(FillRule_notset != maFillRule)
{
return maFillRule;
}
@@ -2056,7 +2011,7 @@ namespace svgio
}
// default is NonZero
- return true;
+ return FillRule_nonzero;
}
const SvgNumberVector& SvgStyleAttributes::getStrokeDasharray() const
diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx
index 17cbd901e29d..77adedea0eb3 100644
--- a/svgio/source/svgreader/svgtextnode.cxx
+++ b/svgio/source/svgreader/svgtextnode.cxx
@@ -49,10 +49,8 @@ namespace svgio
const SvgStyleAttributes* SvgTextNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("text"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("text"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgTextNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx
index 65a6949595a6..1768a176a989 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -48,10 +48,8 @@ namespace svgio
const SvgStyleAttributes* SvgUseNode::getSvgStyleAttributes() const
{
- static OUString aClassStr(OUString::createFromAscii("use"));
- maSvgStyleAttributes.checkForCssStyle(aClassStr);
-
- return &maSvgStyleAttributes;
+ static rtl::OUString aClassStr(rtl::OUString::createFromAscii("use"));
+ return checkForCssStyle(aClassStr, maSvgStyleAttributes);
}
void SvgUseNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)