Avoid potential negative array index access to cached text.
[LibreOffice.git] / svgio / inc / svgtspannode.hxx
blob0740c3cece24e702173801857301e4365ed668bf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include "svgnode.hxx"
23 #include "svgstyleattributes.hxx"
25 namespace svgio::svgreader
27 class SvgTspanNode : public SvgNode
29 private:
30 /// use styles
31 SvgStyleAttributes maSvgStyleAttributes;
33 SvgNumberVector maX;
34 SvgNumberVector maY;
35 SvgNumberVector maDx;
36 SvgNumberVector maDy;
37 SvgNumberVector maRotate;
38 SvgNumber maTextLength;
40 bool mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs
42 // The text line width composed by the different SvgCharacterNode children
43 // it will be used to calculate their alignment
44 double mnTextLineWidth;
46 public:
47 SvgTspanNode(
48 SVGToken aType,
49 SvgDocument& rDocument,
50 SvgNode* pParent);
51 virtual ~SvgTspanNode() override;
53 virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
54 virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) override;
56 /// X content
57 const SvgNumberVector& getX() const { return maX; }
58 void setX(SvgNumberVector&& aX) { maX = std::move(aX); }
60 /// Y content
61 const SvgNumberVector& getY() const { return maY; }
62 void setY(SvgNumberVector&& aY) { maY = std::move(aY); }
64 /// Dx content
65 const SvgNumberVector& getDx() const { return maDx; }
66 void setDx(SvgNumberVector&& aDx) { maDx = std::move(aDx); }
68 /// Dy content
69 const SvgNumberVector& getDy() const { return maDy; }
70 void setDy(SvgNumberVector&& aDy) { maDy = std::move(aDy); }
72 /// Rotate content
73 const SvgNumberVector& getRotate() const { return maRotate; }
74 void setRotate(SvgNumberVector&& aRotate) { maRotate = std::move(aRotate); }
76 /// TextLength content
77 const SvgNumber& getTextLength() const { return maTextLength; }
78 void setTextLength(const SvgNumber& rTextLength) { maTextLength = rTextLength; }
80 /// LengthAdjust content
81 bool getLengthAdjust() const { return mbLengthAdjust; }
82 void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; }
84 void concatenateTextLineWidth(double nWidth) {mnTextLineWidth += nWidth;}
85 double getTextLineWidth() const { return mnTextLineWidth; }
88 } // end of namespace svgio::svgreader
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */