summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-04-11 01:57:47 +0200
committerXisco FaulĂ­ <anistenis@gmail.com>2016-04-12 12:13:25 +0000
commitafe7392f88d8aa42f20a62788a14a132617f6602 (patch)
treec4626175b039be9a50155deff1380d5054b70d6f /svgio
parent31bddb874d2be54b81cdd7ea142b58db18e11a5b (diff)
SVG: Clean up this code a litle bit
Change-Id: Ib941321d43a9a04d57f3c7c4a55528927fed5036 Reviewed-on: https://gerrit.libreoffice.org/24009 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Xisco FaulĂ­ <anistenis@gmail.com>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svgio/svgreader/svgnode.hxx2
-rw-r--r--svgio/source/svgreader/svgnode.cxx11
2 files changed, 6 insertions, 7 deletions
diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx
index 3ad7b0f3423d..0184f29d4136 100644
--- a/svgio/inc/svgio/svgreader/svgnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgnode.hxx
@@ -123,7 +123,7 @@ namespace svgio
const SvgStyleAttributes* checkForCssStyle(const OUString& rClassStr, const SvgStyleAttributes& rOriginal) const;
/// helper for filling the CssStyle vector once dependent on mbCssStyleVectorBuilt
- void fillCssStyleVector(const OUString& rClassStr);
+ void fillCssStyleVector(const OUString& rClassStr, const SvgStyleAttributes& rOriginal);
void fillCssStyleVectorUsingHierarchyAndSelectors(
const OUString& rClassStr,
const SvgNode& rCurrent,
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index b1de51d263fa..c9bd15adbdf1 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -162,7 +162,7 @@ namespace svgio
}
}
- void SvgNode::fillCssStyleVector(const OUString& rClassStr)
+ void SvgNode::fillCssStyleVector(const OUString& rClassStr, const SvgStyleAttributes& rOriginal)
{
OSL_ENSURE(!mbCssStyleVectorBuilt, "OOps, fillCssStyleVector called double ?!?");
mbCssStyleVectorBuilt = true;
@@ -199,6 +199,9 @@ namespace svgio
// add CssStyle for selector '*' if found
maCssStyleVector.push_back(pNew);
}
+
+ //local attributes
+ maCssStyleVector.push_back(&rOriginal);
}
const SvgStyleAttributes* SvgNode::checkForCssStyle(const OUString& rClassStr, const SvgStyleAttributes& rOriginal) const
@@ -206,7 +209,7 @@ namespace svgio
if(!mbCssStyleVectorBuilt)
{
// build needed CssStyleVector for local node
- const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr);
+ const_cast< SvgNode* >(this)->fillCssStyleVector(rClassStr, rOriginal);
}
if(maCssStyleVector.empty())
@@ -232,7 +235,6 @@ namespace svgio
// for the element containing the hierarchy) in a vector of pointers and to use that.
// Resetting the CssStyleParent on rOriginal is probably not needed
// but simply safer to do.
- const_cast< SvgStyleAttributes& >(rOriginal).setCssStyleParent(nullptr);
// loop over the existing CssStyles and link them. There is a first one, take
// as current
@@ -246,9 +248,6 @@ namespace svgio
pCurrent = pNext;
}
- // pCurrent is the last used CssStyle, let it point to the original style
- pCurrent->setCssStyleParent(&rOriginal);
-
// return 1st CssStyle as style chain start element (only for the
// local element, still no hierarchy used here)
return maCssStyleVector[0];