summaryrefslogtreecommitdiff
path: root/svgio/inc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-08-09 11:47:37 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-08-09 20:20:58 +0200
commit1e4d10dcfbeeeb997bf93145da2326514ffcfad3 (patch)
tree3b284df451a63ce7dd7d79ae8e7b53ce38e35cc9 /svgio/inc
parent9346f31f39586445b0547a4810d11ebe3884e0e3 (diff)
svgio: get rid of SvgTextPositions
and make SvgText inherit from SvgTspan Change-Id: Ief25e52ba2a493936f82f1674f73168ed5647278 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155521 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/inc')
-rw-r--r--svgio/inc/svgcharacternode.hxx51
-rw-r--r--svgio/inc/svgtextnode.hxx9
-rw-r--r--svgio/inc/svgtspannode.hxx44
3 files changed, 43 insertions, 61 deletions
diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx
index c74f881df468..f44d7547b4ca 100644
--- a/svgio/inc/svgcharacternode.hxx
+++ b/svgio/inc/svgcharacternode.hxx
@@ -25,57 +25,12 @@
#include <string_view>
#include "svgnode.hxx"
+#include "svgtspannode.hxx"
namespace drawinglayer::primitive2d { class TextSimplePortionPrimitive2D; }
namespace svgio::svgreader
{
- class SvgTextPositions
- {
- private:
- SvgNumberVector maX;
- SvgNumberVector maY;
- SvgNumberVector maDx;
- SvgNumberVector maDy;
- SvgNumberVector maRotate;
- SvgNumber maTextLength;
-
- bool mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
-
- public:
- SvgTextPositions();
-
- void parseTextPositionAttributes(SVGToken aSVGToken, std::u16string_view aContent);
-
- /// X content
- const SvgNumberVector& getX() const { return maX; }
- void setX(SvgNumberVector&& aX) { maX = std::move(aX); }
-
- /// Y content
- const SvgNumberVector& getY() const { return maY; }
- void setY(SvgNumberVector&& aY) { maY = std::move(aY); }
-
- /// Dx content
- const SvgNumberVector& getDx() const { return maDx; }
- void setDx(SvgNumberVector&& aDx) { maDx = std::move(aDx); }
-
- /// Dy content
- const SvgNumberVector& getDy() const { return maDy; }
- void setDy(SvgNumberVector&& aDy) { maDy = std::move(aDy); }
-
- /// Rotate content
- const SvgNumberVector& getRotate() const { return maRotate; }
- void setRotate(SvgNumberVector&& aRotate) { maRotate = std::move(aRotate); }
-
- /// TextLength content
- const SvgNumber& getTextLength() const { return maTextLength; }
- void setTextLength(const SvgNumber& rTextLength) { maTextLength = rTextLength; }
-
- /// LengthAdjust content
- bool getLengthAdjust() const { return mbLengthAdjust; }
- void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
- };
-
class SvgTextPosition
{
private:
@@ -98,8 +53,7 @@ namespace svgio::svgreader
public:
SvgTextPosition(
SvgTextPosition* pParent,
- const InfoProvider& rInfoProvider,
- const SvgTextPositions& rSvgTextPositions);
+ const SvgTspanNode& rSvgCharacterNode);
// data read access
const SvgTextPosition* getParent() const { return mpParent; }
@@ -147,6 +101,7 @@ namespace svgio::svgreader
virtual ~SvgCharacterNode() override;
virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
+
void decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const;
void whiteSpaceHandling();
void addGap();
diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx
index 0cc78f130aed..da6f0e5cbcb2 100644
--- a/svgio/inc/svgtextnode.hxx
+++ b/svgio/inc/svgtextnode.hxx
@@ -19,23 +19,19 @@
#pragma once
-#include "svgnode.hxx"
#include "svgstyleattributes.hxx"
#include "svgcharacternode.hxx"
+#include "svgtspannode.hxx"
#include <basegfx/matrix/b2dhommatrix.hxx>
namespace svgio::svgreader
{
- class SvgTextNode final : public SvgNode
+ class SvgTextNode final : public SvgTspanNode
{
private:
- /// use styles
- SvgStyleAttributes maSvgStyleAttributes;
-
/// variable scan values, dependent of given XAttributeList
std::optional<basegfx::B2DHomMatrix>
mpaTransform;
- SvgTextPositions maSvgTextPositions;
/// local helpers
void DecomposeChild(
@@ -53,7 +49,6 @@ namespace svgio::svgreader
SvgNode* pParent);
virtual ~SvgTextNode() override;
- virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override;
diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx
index 10a7b7ee16a9..d5d86c5a7c1a 100644
--- a/svgio/inc/svgtspannode.hxx
+++ b/svgio/inc/svgtspannode.hxx
@@ -19,22 +19,29 @@
#pragma once
-#include "svgcharacternode.hxx"
+#include "svgnode.hxx"
#include "svgstyleattributes.hxx"
namespace svgio::svgreader
{
- class SvgTspanNode final : public SvgNode
+ class SvgTspanNode : public SvgNode
{
private:
/// use styles
SvgStyleAttributes maSvgStyleAttributes;
- /// variable scan values, dependent of given XAttributeList
- SvgTextPositions maSvgTextPositions;
+ SvgNumberVector maX;
+ SvgNumberVector maY;
+ SvgNumberVector maDx;
+ SvgNumberVector maDy;
+ SvgNumberVector maRotate;
+ SvgNumber maTextLength;
+
+ bool mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
public:
SvgTspanNode(
+ SVGToken aType,
SvgDocument& rDocument,
SvgNode* pParent);
virtual ~SvgTspanNode() override;
@@ -44,8 +51,33 @@ namespace svgio::svgreader
double getCurrentFontSize() const;
- /// access to SvgTextPositions
- const SvgTextPositions& getSvgTextPositions() const { return maSvgTextPositions; }
+ /// X content
+ const SvgNumberVector& getX() const { return maX; }
+ void setX(SvgNumberVector&& aX) { maX = std::move(aX); }
+
+ /// Y content
+ const SvgNumberVector& getY() const { return maY; }
+ void setY(SvgNumberVector&& aY) { maY = std::move(aY); }
+
+ /// Dx content
+ const SvgNumberVector& getDx() const { return maDx; }
+ void setDx(SvgNumberVector&& aDx) { maDx = std::move(aDx); }
+
+ /// Dy content
+ const SvgNumberVector& getDy() const { return maDy; }
+ void setDy(SvgNumberVector&& aDy) { maDy = std::move(aDy); }
+
+ /// Rotate content
+ const SvgNumberVector& getRotate() const { return maRotate; }
+ void setRotate(SvgNumberVector&& aRotate) { maRotate = std::move(aRotate); }
+
+ /// TextLength content
+ const SvgNumber& getTextLength() const { return maTextLength; }
+ void setTextLength(const SvgNumber& rTextLength) { maTextLength = rTextLength; }
+
+ /// LengthAdjust content
+ bool getLengthAdjust() const { return mbLengthAdjust; }
+ void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
};
} // end of namespace svgio::svgreader