0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the QtSvg module of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
#ifndef QSVGNODE_P_H
|
|
43 |
#define QSVGNODE_P_H
|
|
44 |
|
|
45 |
//
|
|
46 |
// W A R N I N G
|
|
47 |
// -------------
|
|
48 |
//
|
|
49 |
// This file is not part of the Qt API. It exists purely as an
|
|
50 |
// implementation detail. This header file may change from version to
|
|
51 |
// version without notice, or even be removed.
|
|
52 |
//
|
|
53 |
// We mean it.
|
|
54 |
//
|
|
55 |
|
|
56 |
#include "qsvgstyle_p.h"
|
|
57 |
|
|
58 |
#ifndef QT_NO_SVG
|
|
59 |
|
|
60 |
#include "QtCore/qstring.h"
|
|
61 |
#include "QtCore/qhash.h"
|
|
62 |
|
|
63 |
QT_BEGIN_NAMESPACE
|
|
64 |
|
|
65 |
class QPainter;
|
|
66 |
class QSvgTinyDocument;
|
|
67 |
|
|
68 |
class QSvgNode
|
|
69 |
{
|
|
70 |
public:
|
|
71 |
enum Type
|
|
72 |
{
|
|
73 |
DOC,
|
|
74 |
G,
|
|
75 |
DEFS,
|
|
76 |
SWITCH,
|
|
77 |
ANIMATION,
|
|
78 |
ARC,
|
|
79 |
CIRCLE,
|
|
80 |
ELLIPSE,
|
|
81 |
IMAGE,
|
|
82 |
LINE,
|
|
83 |
PATH,
|
|
84 |
POLYGON,
|
|
85 |
POLYLINE,
|
|
86 |
RECT,
|
|
87 |
TEXT,
|
|
88 |
TEXTAREA,
|
|
89 |
TSPAN,
|
|
90 |
USE,
|
|
91 |
VIDEO
|
|
92 |
};
|
|
93 |
enum DisplayMode {
|
|
94 |
InlineMode,
|
|
95 |
BlockMode,
|
|
96 |
ListItemMode,
|
|
97 |
RunInMode,
|
|
98 |
CompactMode,
|
|
99 |
MarkerMode,
|
|
100 |
TableMode,
|
|
101 |
InlineTableMode,
|
|
102 |
TableRowGroupMode,
|
|
103 |
TableHeaderGroupMode,
|
|
104 |
TableFooterGroupMode,
|
|
105 |
TableRowMode,
|
|
106 |
TableColumnGroupMode,
|
|
107 |
TableColumnMode,
|
|
108 |
TableCellMode,
|
|
109 |
TableCaptionMode,
|
|
110 |
NoneMode,
|
|
111 |
InheritMode
|
|
112 |
};
|
|
113 |
public:
|
|
114 |
QSvgNode(QSvgNode *parent=0);
|
|
115 |
virtual ~QSvgNode();
|
|
116 |
virtual void draw(QPainter *p, QSvgExtraStates &states) =0;
|
|
117 |
|
|
118 |
QSvgNode *parent() const;
|
|
119 |
|
|
120 |
void appendStyleProperty(QSvgStyleProperty *prop, const QString &id);
|
|
121 |
void applyStyle(QPainter *p, QSvgExtraStates &states);
|
|
122 |
void revertStyle(QPainter *p, QSvgExtraStates &states);
|
|
123 |
QSvgStyleProperty *styleProperty(QSvgStyleProperty::Type type) const;
|
|
124 |
QSvgFillStyleProperty *styleProperty(const QString &id) const;
|
|
125 |
|
|
126 |
QSvgTinyDocument *document() const;
|
|
127 |
|
|
128 |
virtual Type type() const =0;
|
|
129 |
virtual QRectF bounds() const;
|
|
130 |
virtual QRectF transformedBounds(const QTransform &transform) const;
|
|
131 |
|
|
132 |
void setRequiredFeatures(const QStringList &lst);
|
|
133 |
const QStringList & requiredFeatures() const;
|
|
134 |
|
|
135 |
void setRequiredExtensions(const QStringList &lst);
|
|
136 |
const QStringList & requiredExtensions() const;
|
|
137 |
|
|
138 |
void setRequiredLanguages(const QStringList &lst);
|
|
139 |
const QStringList & requiredLanguages() const;
|
|
140 |
|
|
141 |
void setRequiredFormats(const QStringList &lst);
|
|
142 |
const QStringList & requiredFormats() const;
|
|
143 |
|
|
144 |
void setRequiredFonts(const QStringList &lst);
|
|
145 |
const QStringList & requiredFonts() const;
|
|
146 |
|
|
147 |
void setVisible(bool visible);
|
|
148 |
bool isVisible() const;
|
|
149 |
|
|
150 |
void setDisplayMode(DisplayMode display);
|
|
151 |
DisplayMode displayMode() const;
|
|
152 |
|
|
153 |
QString nodeId() const;
|
|
154 |
void setNodeId(const QString &i);
|
|
155 |
|
|
156 |
QString xmlClass() const;
|
|
157 |
void setXmlClass(const QString &str);
|
|
158 |
protected:
|
|
159 |
QSvgStyle m_style;
|
|
160 |
|
|
161 |
qreal strokeWidth() const;
|
|
162 |
private:
|
|
163 |
QSvgNode *m_parent;
|
|
164 |
|
|
165 |
QStringList m_requiredFeatures;
|
|
166 |
QStringList m_requiredExtensions;
|
|
167 |
QStringList m_requiredLanguages;
|
|
168 |
QStringList m_requiredFormats;
|
|
169 |
QStringList m_requiredFonts;
|
|
170 |
|
|
171 |
bool m_visible;
|
|
172 |
|
|
173 |
QString m_id;
|
|
174 |
QString m_class;
|
|
175 |
|
|
176 |
DisplayMode m_displayMode;
|
|
177 |
|
|
178 |
friend class QSvgTinyDocument;
|
|
179 |
};
|
|
180 |
|
|
181 |
inline QSvgNode *QSvgNode::parent() const
|
|
182 |
{
|
|
183 |
return m_parent;
|
|
184 |
}
|
|
185 |
|
|
186 |
inline bool QSvgNode::isVisible() const
|
|
187 |
{
|
|
188 |
return m_visible;
|
|
189 |
}
|
|
190 |
|
|
191 |
inline QString QSvgNode::nodeId() const
|
|
192 |
{
|
|
193 |
return m_id;
|
|
194 |
}
|
|
195 |
|
|
196 |
inline QString QSvgNode::xmlClass() const
|
|
197 |
{
|
|
198 |
return m_class;
|
|
199 |
}
|
|
200 |
|
|
201 |
QT_END_NAMESPACE
|
|
202 |
|
|
203 |
#endif // QT_NO_SVG
|
|
204 |
#endif // QSVGNODE_P_H
|