1 /*
2  *  Copyright (c) 2017 Dmitry Kazakov <dimula73@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include "KoSvgTextChunkShape.h"
20 
21 #include "KoSvgText.h"
22 #include "KoSvgTextProperties.h"
23 #include <QSharedData>
24 #include <QPainterPath>
25 #include <QTextCharFormat>
26 
27 #include <KoShapeContainer_p.h>
28 
29 class SvgGraphicsContext;
30 
31 class KoSvgTextChunkShape::SharedData : public QSharedData
32 {
33 public:
34 
35     SharedData();
36     SharedData(const SharedData &rhs);
37     ~SharedData();
38 
39     KoSvgTextProperties properties;
40     QFont font;
41     QStringList fontFamiliesList;
42 
43     QVector<KoSvgText::CharTransformation> localTransformations;
44 
45     KoSvgText::AutoValue textLength;
46     KoSvgText::LengthAdjust lengthAdjust = KoSvgText::LengthAdjustSpacing;
47 
48     QString text;
49 
50     QPainterPath associatedOutline;
51 
52     void loadContextBasedProperties(SvgGraphicsContext *gc);
53     bool isRichTextPreferred = true;
54 };
55 
56 class KoSvgTextChunkShape::Private
57 {
58 public:
59     struct LayoutInterface;
60     QScopedPointer<LayoutInterface> layoutInterface;
61 };
62 
63