diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-03-27 11:38:44 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2024-04-15 12:36:23 +0200 |
commit | ee36f0456c6308d10085d79b0d211b70f97388b7 (patch) | |
tree | 59b803df003f43626ff3cfd277774091d9337fc8 /svgio/inc | |
parent | a6b07a445a1f84b9510b5b694cc12229e87b596a (diff) |
tdf#160386: Add support for switch element
For now, only use language tag, meaning if
there is a file like in the unittest with
<text systemLanguage="en-us">Howdy!</text>
<text systemLanguage="en-gb">Wotcha!</text>
<text systemLanguage="en-au">G'day!</text>
<text systemLanguage="en">Hello!</text>
"Hello!" with be displayed in a en_AU system locale
This patch partially reverts 13a41e7a12598c7896d6dc8d34aba6af5b80b83c
"tdf#150124: do nothing when parent is of unkown type"
making 0dfd8288a87b58e503bb3a41be6137485fbf3f68
"ofz#60384 Direct-leak" no longer necessary
Change-Id: Ifc73bc69aa997088dc0a2b11d7d30446303fa3b3
Change-Id: I885ef0f2c44b86196881fe55a963db2e5c7eb1be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165394
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165438
Diffstat (limited to 'svgio/inc')
-rw-r--r-- | svgio/inc/svgdocument.hxx | 6 | ||||
-rw-r--r-- | svgio/inc/svgnode.hxx | 7 | ||||
-rw-r--r-- | svgio/inc/svgswitchnode.hxx | 55 | ||||
-rw-r--r-- | svgio/inc/svgtoken.hxx | 1 |
4 files changed, 63 insertions, 6 deletions
diff --git a/svgio/inc/svgdocument.hxx b/svgio/inc/svgdocument.hxx index 77b4d3891179..9f79342c0c55 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 63abc4f8cb0a..16c1f50bc3db 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/svgswitchnode.hxx b/svgio/inc/svgswitchnode.hxx new file mode 100644 index 000000000000..b83ae0c4ac0f --- /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 26a5d8f5f423..26ef86efc5f9 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, |