1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
21 #define INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
23 #include "svgnode.hxx"
25 namespace drawinglayer
{ namespace primitive2d
{ class TextSimplePortionPrimitive2D
; }}
31 class SvgTextPositions
38 SvgNumberVector maRotate
;
39 SvgNumber maTextLength
;
41 bool mbLengthAdjust
: 1; // true = spacing, false = spacingAndGlyphs
46 void parseTextPositionAttributes(SVGToken aSVGToken
, const OUString
& aContent
);
49 const SvgNumberVector
& getX() const { return maX
; }
50 void setX(const SvgNumberVector
& aX
) { maX
= aX
; }
53 const SvgNumberVector
& getY() const { return maY
; }
54 void setY(const SvgNumberVector
& aY
) { maY
= aY
; }
57 const SvgNumberVector
& getDx() const { return maDx
; }
58 void setDx(const SvgNumberVector
& aDx
) { maDx
= aDx
; }
61 const SvgNumberVector
& getDy() const { return maDy
; }
62 void setDy(const SvgNumberVector
& aDy
) { maDy
= aDy
; }
65 const SvgNumberVector
& getRotate() const { return maRotate
; }
66 void setRotate(const SvgNumberVector
& aRotate
) { maRotate
= aRotate
; }
68 /// TextLength content
69 const SvgNumber
& getTextLength() const { return maTextLength
; }
70 void setTextLength(const SvgNumber
& rTextLength
) { maTextLength
= rTextLength
; }
72 /// LengthAdjust content
73 bool getLengthAdjust() const { return mbLengthAdjust
; }
74 void setLengthAdjust(bool bNew
) { mbLengthAdjust
= bNew
; }
76 } // end of namespace svgreader
77 } // end of namespace svgio
87 SvgTextPosition
* mpParent
;
88 ::std::vector
< double > maX
;
89 ::std::vector
< double > maY
;
90 ::std::vector
< double > maRotate
;
93 // absolute, current, advancing position
94 basegfx::B2DPoint maPosition
;
96 // advancing rotation index
97 sal_uInt32 mnRotationIndex
;
99 bool mbLengthAdjust
: 1; // true = spacing, false = spacingAndGlyphs
100 bool mbAbsoluteX
: 1;
104 SvgTextPosition
* pParent
,
105 const InfoProvider
& rInfoProvider
,
106 const SvgTextPositions
& rSvgTextPositions
);
109 const SvgTextPosition
* getParent() const { return mpParent
; }
110 const ::std::vector
< double >& getX() const { return maX
; }
111 double getTextLength() const { return mfTextLength
; }
112 bool getLengthAdjust() const { return mbLengthAdjust
; }
113 bool getAbsoluteX() const { return mbAbsoluteX
; }
115 // get/set absolute, current, advancing position
116 const basegfx::B2DPoint
& getPosition() const { return maPosition
; }
117 void setPosition(const basegfx::B2DPoint
& rNew
) { maPosition
= rNew
; }
120 bool isRotated() const;
121 double consumeRotation();
123 } // end of namespace svgreader
124 } // end of namespace svgio
131 class SvgCharacterNode
: public SvgNode
138 drawinglayer::primitive2d::TextSimplePortionPrimitive2D
* createSimpleTextPrimitive(
139 SvgTextPosition
& rSvgTextPosition
,
140 const SvgStyleAttributes
& rSvgStyleAttributes
) const;
141 void decomposeTextWithStyle(
142 drawinglayer::primitive2d::Primitive2DContainer
& rTarget
,
143 SvgTextPosition
& rSvgTextPosition
,
144 const SvgStyleAttributes
& rSvgStyleAttributes
) const;
148 SvgDocument
& rDocument
,
150 const OUString
& rText
);
151 virtual ~SvgCharacterNode() override
;
153 virtual const SvgStyleAttributes
* getSvgStyleAttributes() const override
;
154 void decomposeText(drawinglayer::primitive2d::Primitive2DContainer
& rTarget
, SvgTextPosition
& rSvgTextPosition
) const;
155 void whiteSpaceHandling();
157 void concatenate(const OUString
& rText
);
160 const OUString
& getText() const { return maText
; }
162 } // end of namespace svgreader
163 } // end of namespace svgio
165 #endif // INCLUDED_SVGIO_INC_SVGCHARACTERNODE_HXX
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */