| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 | /* |
| 3 | * This file is part of the LibreOffice project. |
| 4 | * |
| 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/. |
| 8 | * |
| 9 | * This file incorporates work covered by the following license notice: |
| 10 | * |
| 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 . |
| 18 | */ |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include "svgnode.hxx" |
| 23 | #include "svgstyleattributes.hxx" |
| 24 | |
| 25 | namespace svgio::svgreader |
| 26 | { |
| 27 | class SvgTspanNode : public SvgNode |
| 28 | { |
| 29 | private: |
| 30 | /// use styles |
| 31 | SvgStyleAttributes maSvgStyleAttributes; |
| 32 | |
| 33 | SvgNumberVector maX; |
| 34 | SvgNumberVector maY; |
| 35 | SvgNumberVector maDx; |
| 36 | SvgNumberVector maDy; |
| 37 | SvgNumberVector maRotate; |
| 38 | SvgNumber maTextLength; |
| 39 | |
| 40 | bool mbLengthAdjust : 1; // true = spacing, false = spacingAndGlyphs |
| 41 | |
| 42 | // The text line width composed by the different SvgCharacterNode children |
| 43 | // it will be used to calculate their alignment |
| 44 | double mnTextLineWidth; |
| 45 | |
| 46 | public: |
| 47 | SvgTspanNode( |
| 48 | SVGToken aType, |
| 49 | SvgDocument& rDocument, |
| 50 | SvgNode* pParent); |
| 51 | virtual ~SvgTspanNode() override; |
| 52 | |
| 53 | virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; |
| 54 | virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) override; |
| 55 | |
| 56 | /// X content |
| 57 | const SvgNumberVector& getX() const { return maX; } |
| 58 | void setX(SvgNumberVector&& aX) { maX = std::move(aX); } |
| 59 | |
| 60 | /// Y content |
| 61 | const SvgNumberVector& getY() const { return maY; } |
| 62 | void setY(SvgNumberVector&& aY) { maY = std::move(aY); } |
| 63 | |
| 64 | /// Dx content |
| 65 | const SvgNumberVector& getDx() const { return maDx; } |
| 66 | void setDx(SvgNumberVector&& aDx) { maDx = std::move(aDx); } |
| 67 | |
| 68 | /// Dy content |
| 69 | const SvgNumberVector& getDy() const { return maDy; } |
| 70 | void setDy(SvgNumberVector&& aDy) { maDy = std::move(aDy); } |
| 71 | |
| 72 | /// Rotate content |
| 73 | const SvgNumberVector& getRotate() const { return maRotate; } |
| 74 | void setRotate(SvgNumberVector&& aRotate) { maRotate = std::move(aRotate); } |
| 75 | |
| 76 | /// TextLength content |
| 77 | const SvgNumber& getTextLength() const { return maTextLength; } |
| 78 | void setTextLength(const SvgNumber& rTextLength) { maTextLength = rTextLength; } |
| 79 | |
| 80 | /// LengthAdjust content |
| 81 | bool getLengthAdjust() const { return mbLengthAdjust; } |
| 82 | void setLengthAdjust(bool bNew) { mbLengthAdjust = bNew; } |
| 83 | |
| 84 | void concatenateTextLineWidth(double nWidth) {mnTextLineWidth += nWidth;} |
| 85 | double getTextLineWidth() const { return mnTextLineWidth; } |
| 86 | }; |
| 87 | |
| 88 | } // end of namespace svgio::svgreader |
| 89 | |
| 90 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |