summaryrefslogtreecommitdiff
path: root/qmake/include/private/qsvgdevice_p.h
Unidiff
Diffstat (limited to 'qmake/include/private/qsvgdevice_p.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/private/qsvgdevice_p.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/qmake/include/private/qsvgdevice_p.h b/qmake/include/private/qsvgdevice_p.h
new file mode 100644
index 0000000..c1cc389
--- a/dev/null
+++ b/qmake/include/private/qsvgdevice_p.h
@@ -0,0 +1,134 @@
1/****************************************************************************
2** $Id$
3**
4** Definition of the QSvgDevice class
5**
6** Created : 20001024
7**
8** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
9**
10** This file is part of the xml module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition licenses may use this
22** file in accordance with the Qt Commercial License Agreement provided
23** with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36*****************************************************************************/
37
38#ifndef QSVGDEVICE_H
39#define QSVGDEVICE_H
40
41//
42// W A R N I N G
43// -------------
44//
45// This file is not part of the Qt API. It exists for the convenience
46// of the QPicture class. This header file may change from
47// version to version without notice, or even be removed.
48//
49// We mean it.
50//
51//
52
53#ifndef QT_H
54#include "qpaintdevice.h"
55#include "qrect.h"
56#include "qdom.h"
57#endif // QT_H
58
59#if !defined(QT_MODULE_XML) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_XML )
60#define QM_EXPORT_SVG
61#else
62#define QM_EXPORT_SVG Q_EXPORT
63#endif
64
65#ifndef QT_NO_SVG
66
67class QPainter;
68class QDomNode;
69class QDomNamedNodeMap;
70struct QSvgDeviceState;
71class QSvgDevicePrivate;
72
73class QM_EXPORT_SVG QSvgDevice : public QPaintDevice
74{
75public:
76 QSvgDevice();
77 ~QSvgDevice();
78
79 bool play( QPainter *p );
80
81 QString toString() const;
82
83 bool load( QIODevice *dev );
84 bool save( QIODevice *dev );
85 bool save( const QString &fileName );
86
87 QRect boundingRect() const;
88 void setBoundingRect( const QRect &r );
89
90protected:
91 virtual bool cmd ( int, QPainter*, QPDevCmdParam* );
92 virtual int metric( int ) const;
93
94private:
95 // reading
96 bool play( const QDomNode &node );
97 void saveAttributes();
98 void restoreAttributes();
99 QColor parseColor( const QString &col );
100 double parseLen( const QString &str, bool *ok=0, bool horiz=TRUE ) const;
101 int lenToInt( const QDomNamedNodeMap &map, const QString &attr,
102 int def=0 ) const;
103 void setStyleProperty( const QString &prop, const QString &val,
104 QPen *pen, QFont *font, int *talign );
105 void setStyle( const QString &s );
106 void setTransform( const QString &tr );
107 void drawPath( const QString &data );
108
109 // writing
110 void applyStyle( QDomElement *e, int c ) const;
111 void applyTransform( QDomElement *e ) const;
112
113 // reading
114 QRect brect; // bounding rectangle
115 QDomDocument doc; // document tree
116 QDomNode current;
117 QPoint curPt;
118 QSvgDeviceState *curr;
119 QPainter *pt; // used by play() et al
120
121 // writing
122 bool dirtyTransform, dirtyStyle;
123
124 QSvgDevicePrivate *d;
125};
126
127inline QRect QSvgDevice::boundingRect() const
128{
129 return brect;
130}
131
132#endif // QT_NO_SVG
133
134#endif // QSVGDEVICE_H