summaryrefslogtreecommitdiffstats
path: root/svgio
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:03:24 +0000
commite3cf16e6fbf8d39cad8762f002b6db1d4f61ed36 (patch)
tree3c1753125149dcf36ba42a57f1574369e8524225 /svgio
parentAdding debian version 4:24.2.2-3. (diff)
downloadlibreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.tar.xz
libreoffice-e3cf16e6fbf8d39cad8762f002b6db1d4f61ed36.zip
Merging upstream version 4:24.2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/CppunitTest_svgio.mk1
-rw-r--r--svgio/CppunitTest_svgio_tools.mk1
-rw-r--r--svgio/Library_svgio.mk2
-rw-r--r--svgio/inc/svgdocument.hxx6
-rw-r--r--svgio/inc/svgnode.hxx7
-rw-r--r--svgio/inc/svgstyleattributes.hxx9
-rw-r--r--svgio/inc/svgswitchnode.hxx55
-rw-r--r--svgio/inc/svgtoken.hxx1
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx37
-rw-r--r--svgio/qa/cppunit/data/tdf160373.svg14
-rw-r--r--svgio/qa/cppunit/data/tdf160386.svg16
-rw-r--r--svgio/source/svgreader/svgdocumenthandler.cxx9
-rw-r--r--svgio/source/svgreader/svgnode.cxx44
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx36
-rw-r--r--svgio/source/svgreader/svgswitchnode.cxx129
-rw-r--r--svgio/source/svgreader/svgtoken.cxx1
16 files changed, 337 insertions, 31 deletions
diff --git a/svgio/CppunitTest_svgio.mk b/svgio/CppunitTest_svgio.mk
index 9309f5dcb9..a179d6af30 100644
--- a/svgio/CppunitTest_svgio.mk
+++ b/svgio/CppunitTest_svgio.mk
@@ -34,6 +34,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svgio,\
cppu \
cppuhelper \
comphelper \
+ i18nlangtag \
sal \
salhelper \
sax \
diff --git a/svgio/CppunitTest_svgio_tools.mk b/svgio/CppunitTest_svgio_tools.mk
index abb6bb6e0f..5f4d7adbe5 100644
--- a/svgio/CppunitTest_svgio_tools.mk
+++ b/svgio/CppunitTest_svgio_tools.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svgio_tools,\
comphelper \
cppu \
cppuhelper \
+ i18nlangtag \
sal \
salhelper \
sax \
diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index edd83ed572..45b34a26b9 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_libraries,svgio,\
comphelper \
cppu \
cppuhelper \
+ i18nlangtag \
sal \
salhelper \
tk \
@@ -83,6 +84,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
svgio/source/svgreader/svgstyleattributes \
svgio/source/svgreader/svgstylenode \
svgio/source/svgreader/svgsvgnode \
+ svgio/source/svgreader/svgswitchnode \
svgio/source/svgreader/svgsymbolnode \
svgio/source/svgreader/svgtextnode \
svgio/source/svgreader/svgtextposition \
diff --git a/svgio/inc/svgdocument.hxx b/svgio/inc/svgdocument.hxx
index 77b4d38911..9f79342c0c 100644
--- a/svgio/inc/svgdocument.hxx
+++ b/svgio/inc/svgdocument.hxx
@@ -34,9 +34,6 @@ namespace svgio::svgreader
/// the document hierarchy with all root nodes
SvgNodeVector maNodes;
- /// invalid nodes that have no parent
- SvgNodeVector maOrphanNodes;
-
/// the absolute path of the Svg file in progress (if available)
const OUString maAbsolutePath;
@@ -75,9 +72,6 @@ namespace svgio::svgreader
/// data read access
const SvgNodeVector& getSvgNodeVector() const { return maNodes; }
const OUString& getAbsolutePath() const { return maAbsolutePath; }
-
- /// invalid nodes that have no parent
- void addOrphanNode(SvgNode* pOrphan) { maOrphanNodes.emplace_back(pOrphan); }
};
} // end of namespace svgio::svgreader
diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx
index 63abc4f8cb..16c1f50bc3 100644
--- a/svgio/inc/svgnode.hxx
+++ b/svgio/inc/svgnode.hxx
@@ -95,6 +95,9 @@ namespace svgio::svgreader
/// Class svan value
std::optional<OUString> mpClass;
+ /// systemLanguage values
+ std::vector<OUString> maSystemLanguage;
+
/// XmlSpace value
XmlSpace maXmlSpace;
@@ -174,6 +177,10 @@ namespace svgio::svgreader
std::optional<OUString> const & getClass() const { return mpClass; }
void setClass(OUString const &);
+ /// SystemLanguage access
+ std::vector<OUString> const & getSystemLanguage() const { return maSystemLanguage; }
+ void setSystemLanguage(OUString const &);
+
/// XmlSpace access
XmlSpace getXmlSpace() const;
void setXmlSpace(XmlSpace eXmlSpace) { maXmlSpace = eXmlSpace; }
diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx
index bf921f8b1b..c5c095462f 100644
--- a/svgio/inc/svgstyleattributes.hxx
+++ b/svgio/inc/svgstyleattributes.hxx
@@ -243,10 +243,6 @@ namespace svgio::svgreader
mutable std::vector<sal_uInt16> maResolvingParent;
- // defines if this attributes are part of a ClipPath. If yes,
- // rough geometry will be created on decomposition by patching
- // values for fill, stroke, strokeWidth and others
- bool mbIsClipPathContent : 1;
// #121221# Defines if evtl. an empty array *is* set
bool mbStrokeDasharraySet : 1;
@@ -318,6 +314,11 @@ namespace svgio::svgreader
SvgStyleAttributes(SvgNode& rOwner);
~SvgStyleAttributes();
+ // Check if this attribute is part of a ClipPath.
+ // If so, rough geometry will be created on decomposition by patching
+ // values for fill, stroke, strokeWidth and others
+ bool isClipPathContent() const;
+
/// fill content
bool isFillSet() const; // #i125258# ask if fill is a direct hard attribute (no hierarchy)
const basegfx::BColor* getFill() const;
diff --git a/svgio/inc/svgswitchnode.hxx b/svgio/inc/svgswitchnode.hxx
new file mode 100644
index 0000000000..b83ae0c4ac
--- /dev/null
+++ b/svgio/inc/svgswitchnode.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgstyleattributes.hxx"
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+namespace svgio::svgreader
+{
+class SvgSwitchNode final : public SvgNode
+{
+private:
+ /// use styles
+ SvgStyleAttributes maSvgStyleAttributes;
+
+ /// variable scan values, dependent of given XAttributeList
+ std::optional<basegfx::B2DHomMatrix> mpaTransform;
+
+public:
+ SvgSwitchNode(SvgDocument& rDocument, SvgNode* pParent);
+ virtual ~SvgSwitchNode() override;
+
+ virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
+ virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) override;
+ virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ bool bReferenced) const override;
+
+ /// transform content
+ const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; }
+ void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix)
+ {
+ mpaTransform = pMatrix;
+ }
+};
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/inc/svgtoken.hxx b/svgio/inc/svgtoken.hxx
index 26a5d8f5f4..26ef86efc5 100644
--- a/svgio/inc/svgtoken.hxx
+++ b/svgio/inc/svgtoken.hxx
@@ -109,6 +109,7 @@ namespace svgio::svgreader
PatternContentUnits,
PatternTransform,
Opacity,
+ SystemLanguage,
Visibility,
Title,
Desc,
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 326e8f38ff..6969dc406a 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -38,6 +38,7 @@ protected:
void checkRectPrimitive(Primitive2DSequence const & rPrimitive);
Primitive2DSequence parseSvg(std::u16string_view aSource);
+ xmlDocUniquePtr dumpAndParseSvg(std::u16string_view aSource);
};
Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
@@ -59,6 +60,17 @@ Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
return xSvgParser->getDecomposition(aInputStream, aPath);
}
+xmlDocUniquePtr Test::dumpAndParseSvg(std::u16string_view aSource)
+{
+ Primitive2DSequence aSequence = parseSvg(aSource);
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+ return pDocument;
+}
+
void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive)
{
drawinglayer::Primitive2dXmlDump dumper;
@@ -385,6 +397,17 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative)
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]"_ostr, "familyname"_ostr, "DejaVu Serif");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf160386)
+{
+ xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160386.svg");
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 1
+ // - Actual : 11
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, 1);
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion"_ostr, "text"_ostr, "Hello!");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.svg");
@@ -441,6 +464,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156168)
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr, "color"_ostr, "#00ff00");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf160373)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf160373.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+
+ // Without the fix in place, nothing would be displayed
+ assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor"_ostr, "color"_ostr, "#0000ff");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf129356)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf129356.svg");
diff --git a/svgio/qa/cppunit/data/tdf160373.svg b/svgio/qa/cppunit/data/tdf160373.svg
new file mode 100644
index 0000000000..73b18bb2ea
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf160373.svg
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='503.75pt' height='503.25pt' viewBox='0 0 503.75 503.25'>
+<defs>
+ <style type='text/css'><![CDATA[
+ rect { fill: none; }
+ ]]></style>
+</defs>
+ <clipPath id='cpMC4wMHw1MDMuNzV8MC4wMHw1MDMuMjU='>
+ <rect x='0.00' y='0.00' width='503.75' height='503.25' />
+ </clipPath>
+<g clip-path='url(#cpMC4wMHw1MDMuNzV8MC4wMHw1MDMuMjU=)'>
+<rect class="r5" x="10" y="0" height="50" width="50" style="fill:blue"></rect>
+</g>
+</svg>
diff --git a/svgio/qa/cppunit/data/tdf160386.svg b/svgio/qa/cppunit/data/tdf160386.svg
new file mode 100644
index 0000000000..1644b0d155
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf160386.svg
@@ -0,0 +1,16 @@
+<svg viewBox="0 -20 100 50" xmlns="http://www.w3.org/2000/svg">
+ <switch font-family="DejaVu Sans">
+ <text systemLanguage="ar">مرحبا</text>
+ <text systemLanguage="de,nl">Hallo!</text>
+ <text systemLanguage="en-us">Howdy!</text>
+ <text systemLanguage="en-gb">Wotcha!</text>
+ <text systemLanguage="en-au">G'day!</text>
+ <text systemLanguage="en">Hello!</text>
+ <text systemLanguage="es">Hola!</text>
+ <text systemLanguage="fr">Bonjour!</text>
+ <text systemLanguage="ja">こんにちは</text>
+ <text systemLanguage="ru">Привет!</text>
+ <text>☺</text>
+ </switch>
+</svg>
+
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx
index 5e89edad6c..8d2cc8849c 100644
--- a/svgio/source/svgreader/svgdocumenthandler.cxx
+++ b/svgio/source/svgreader/svgdocumenthandler.cxx
@@ -27,6 +27,7 @@
#include <svgrectnode.hxx>
#include <svggradientnode.hxx>
#include <svggradientstopnode.hxx>
+#include <svgswitchnode.hxx>
#include <svgsymbolnode.hxx>
#include <svgusenode.hxx>
#include <svgcirclenode.hxx>
@@ -199,7 +200,13 @@ namespace
mpTarget->parseAttributes(xAttribs);
break;
}
- case SVGToken::Switch: //TODO: Support switch element
+ case SVGToken::Switch:
+ {
+ /// new node for Switch
+ mpTarget = new SvgSwitchNode(maDocument, mpTarget);
+ mpTarget->parseAttributes(xAttribs);
+ break;
+ }
case SVGToken::Defs:
case SVGToken::G:
{
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index 0ae4e80363..7a45c681f1 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -367,17 +367,13 @@ namespace {
mpParent(pParent),
mpAlternativeParent(nullptr),
maXmlSpace(XmlSpace::NotSet),
- maDisplay(Display::Inline),
+ maDisplay(maType == SVGToken::Unknown ? Display::None : Display::Inline), // tdf#150124: do not display unknown nodes
mbDecomposing(false),
mbCssStyleVectorBuilt(false)
{
if (pParent)
{
- // tdf#150124 ignore when parent is unknown
- if (pParent->getType() != SVGToken::Unknown)
- pParent->maChildren.emplace_back(this);
- else
- mrDocument.addOrphanNode(this);
+ pParent->maChildren.emplace_back(this);
}
}
@@ -527,6 +523,14 @@ namespace {
}
break;
}
+ case SVGToken::SystemLanguage:
+ {
+ if(!aContent.isEmpty())
+ {
+ setSystemLanguage(aContent);
+ }
+ break;
+ }
case SVGToken::XmlSpace:
{
if(!aContent.isEmpty())
@@ -752,6 +756,34 @@ namespace {
mrDocument.addSvgNodeToMapper(*mpClass, *this);
}
+ void SvgNode::setSystemLanguage(OUString const & rSystemClass)
+ {
+ const sal_Int32 nLen(rSystemClass.getLength());
+ sal_Int32 nPos(0);
+ OUStringBuffer aToken;
+
+ // split into single tokens (currently only comma separator)
+ while(nPos < nLen)
+ {
+ const sal_Int32 nInitPos(nPos);
+ copyToLimiter(rSystemClass, u',', nPos, aToken, nLen);
+ skip_char(rSystemClass, u',', nPos, nLen);
+ const OUString aLang(o3tl::trim(aToken));
+ aToken.setLength(0);
+
+ if(!aLang.isEmpty())
+ {
+ maSystemLanguage.push_back(aLang);
+ }
+
+ if(nInitPos == nPos)
+ {
+ OSL_ENSURE(false, "Could not interpret on current position (!)");
+ nPos++;
+ }
+ }
+ }
+
XmlSpace SvgNode::getXmlSpace() const
{
if(maXmlSpace != XmlSpace::NotSet)
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 19070989bb..58bdb9add8 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1287,18 +1287,9 @@ namespace svgio::svgreader
maBaselineShift(BaselineShift::Baseline),
maBaselineShiftNumber(0),
maDominantBaseline(DominantBaseline::Auto),
- maResolvingParent(31, 0),
- mbIsClipPathContent(SVGToken::ClipPathNode == mrOwner.getType()),
+ maResolvingParent(32, 0),
mbStrokeDasharraySet(false)
{
- const SvgStyleAttributes* pParentStyle = getParentStyle();
- if(!mbIsClipPathContent)
- {
- if(pParentStyle)
- {
- mbIsClipPathContent = pParentStyle->mbIsClipPathContent;
- }
- }
}
SvgStyleAttributes::~SvgStyleAttributes()
@@ -2005,10 +1996,27 @@ namespace svgio::svgreader
}
}
+ bool SvgStyleAttributes::isClipPathContent() const
+ {
+ if (SVGToken::ClipPathNode == mrOwner.getType())
+ return true;
+
+ const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
+ if (pSvgStyleAttributes && maResolvingParent[31] < nStyleDepthLimit)
+ {
+ ++maResolvingParent[31];
+ bool ret = pSvgStyleAttributes->isClipPathContent();
+ --maResolvingParent[31];
+ return ret;
+ }
+
+ return false;
+ }
+
// #i125258# ask if fill is a direct hard attribute (no hierarchy)
bool SvgStyleAttributes::isFillSet() const
{
- if(mbIsClipPathContent)
+ if(isClipPathContent())
{
return false;
}
@@ -2042,7 +2050,7 @@ namespace svgio::svgreader
{
return &maFill.getBColor();
}
- else if(mbIsClipPathContent)
+ else if(isClipPathContent())
{
const SvgStyleAttributes* pSvgStyleAttributes = getParentStyle();
@@ -2066,7 +2074,7 @@ namespace svgio::svgreader
const basegfx::BColor* pFill = pSvgStyleAttributes->getFill();
--maResolvingParent[0];
- if(mbIsClipPathContent)
+ if(isClipPathContent())
{
if (pFill)
{
@@ -2269,7 +2277,7 @@ namespace svgio::svgreader
return ret;
}
- if(mbIsClipPathContent)
+ if(isClipPathContent())
{
return SvgNumber(0.0);
}
diff --git a/svgio/source/svgreader/svgswitchnode.cxx b/svgio/source/svgreader/svgswitchnode.cxx
new file mode 100644
index 0000000000..bbad79a3b5
--- /dev/null
+++ b/svgio/source/svgreader/svgswitchnode.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svgswitchnode.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <unotools/syslocaleoptions.hxx>
+
+namespace svgio::svgreader
+{
+SvgSwitchNode::SvgSwitchNode(SvgDocument& rDocument, SvgNode* pParent)
+ : SvgNode(SVGToken::Switch, rDocument, pParent)
+ , maSvgStyleAttributes(*this)
+{
+}
+
+SvgSwitchNode::~SvgSwitchNode() {}
+
+const SvgStyleAttributes* SvgSwitchNode::getSvgStyleAttributes() const
+{
+ return checkForCssStyle(maSvgStyleAttributes);
+}
+
+void SvgSwitchNode::parseAttribute(SVGToken aSVGToken, const OUString& aContent)
+{
+ // call parent
+ SvgNode::parseAttribute(aSVGToken, aContent);
+
+ // read style attributes
+ maSvgStyleAttributes.parseStyleAttribute(aSVGToken, aContent);
+
+ // parse own
+ switch (aSVGToken)
+ {
+ case SVGToken::Style:
+ {
+ readLocalCssStyle(aContent);
+ break;
+ }
+ case SVGToken::Transform:
+ {
+ const basegfx::B2DHomMatrix aMatrix(readTransform(aContent, *this));
+
+ if (!aMatrix.isIdentity())
+ {
+ setTransform(aMatrix);
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+}
+
+void SvgSwitchNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ bool bReferenced) const
+{
+ // #i125258# for SVGTokenG decompose children
+ const SvgStyleAttributes* pStyle = getSvgStyleAttributes();
+
+ if (pStyle)
+ {
+ drawinglayer::primitive2d::Primitive2DContainer aContent;
+
+ const auto& rChildren = getChildren();
+ const sal_uInt32 nCount(rChildren.size());
+ OUString sLanguage(SvtSysLocaleOptions().GetRealUILanguageTag().getLanguage());
+
+ SvgNode* pNodeToDecompose = nullptr;
+ for (sal_uInt32 a(0); a < nCount; a++)
+ {
+ SvgNode* pCandidate = rChildren[a].get();
+
+ if (pCandidate && Display::None != pCandidate->getDisplay())
+ {
+ std::vector<OUString> aSystemLanguage = pCandidate->getSystemLanguage();
+ if (!sLanguage.isEmpty() && !aSystemLanguage.empty())
+ {
+ for (const OUString& sSystemLang : aSystemLanguage)
+ {
+ if (sSystemLang == sLanguage)
+ {
+ pNodeToDecompose = pCandidate;
+ break;
+ }
+ }
+ }
+ else
+ {
+ pNodeToDecompose = pCandidate;
+ }
+ }
+
+ if (pNodeToDecompose)
+ {
+ pNodeToDecompose->decomposeSvgNode(aContent, bReferenced);
+ // break once it's descomposed
+ break;
+ }
+ }
+
+ if (!aContent.empty())
+ {
+ pStyle->add_postProcess(rTarget, std::move(aContent), getTransform());
+ }
+ }
+}
+
+} // end of namespace svgio::svgreader
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx
index 968ead0483..642fba085f 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -107,6 +107,7 @@ constexpr auto aSVGTokenMap = frozen::make_unordered_map<std::u16string_view, SV
{ u"patternContentUnits", SVGToken::PatternContentUnits },
{ u"patternTransform", SVGToken::PatternTransform },
{ u"opacity", SVGToken::Opacity },
+ { u"systemLanguage", SVGToken::SystemLanguage },
{ u"visibility", SVGToken::Visibility },
{ u"title", SVGToken::Title },
{ u"desc", SVGToken::Desc },