summaryrefslogtreecommitdiff
path: root/svgio/source
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-22 18:00:01 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-22 19:50:25 +0200
commit079cd3429ace2f9568d42368bb0c56487335d44d (patch)
tree15403b01294390eb03184733ccf91dbfad12b0af /svgio/source
parent83ff25f09c4b897a19b9de14980c83c1236813c1 (diff)
tdf#156018: check if there is a css style with element inside element
Change-Id: I54fa5bea42560eec5ae51dd7ba07de11f418c75c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153466 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/source')
-rw-r--r--svgio/source/svgreader/svgnode.cxx15
-rw-r--r--svgio/source/svgreader/svgtoken.cxx13
2 files changed, 28 insertions, 0 deletions
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index d45624d3edc6..2137209d5599 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -160,6 +160,21 @@ namespace svgio::svgreader
// add CssStyle if found
maCssStyleVector.push_back(pNew);
}
+
+ // check if there is a css style with element inside element
+ if(pParent)
+ {
+ OUString sParentType(SVGTokenToStr(pParent->getType()));
+
+ aNewConcatenated = sParentType + rClassStr;
+ pNew = rDocument.findGlobalCssStyleAttributes(aNewConcatenated);
+
+ if(pNew)
+ {
+ // add CssStyle if found
+ maCssStyleVector.push_back(pNew);
+ }
+ }
}
void SvgNode::fillCssStyleVector(const OUString& rClassStr, const SvgStyleAttributes& rOriginal)
diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx
index 45af658b1ebd..ed50612323e5 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -243,6 +243,19 @@ SVGToken StrToSVGToken(const OUString& rStr, bool bCaseIndependent)
}
}
+OUString SVGTokenToStr(const SVGToken& rToken)
+{
+ for (auto it = aSVGTokenMapperList.begin(); it != aSVGTokenMapperList.end(); ++it)
+ {
+ if (it->second == rToken)
+ {
+ OUString aFirst(it->first);
+ return aFirst;
+ }
+ }
+ return OUString();
+}
+
OUString getStrTitle()
{
return OUString(constToken_Title);