Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qsvgdevice_p.h 3.3.8 edited Jan 11 14:46 $ 00003 ** 00004 ** Definition of the QSvgDevice class 00005 ** 00006 ** Created : 001024 00007 ** 00008 ** Copyright (C) 2000-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the xml module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition licenses may use this 00022 ** file in accordance with the Qt Commercial License Agreement provided 00023 ** with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 *****************************************************************************/ 00037 00038 #ifndef QSVGDEVICE_P_H 00039 #define QSVGDEVICE_P_H 00040 00041 // 00042 // W A R N I N G 00043 // ------------- 00044 // 00045 // This file is not part of the Qt API. It exists for the convenience 00046 // of the QPicture class. This header file may change from 00047 // version to version without notice, or even be removed. 00048 // 00049 // We mean it. 00050 // 00051 // 00052 00053 #ifndef QT_H 00054 #include "qpaintdevice.h" 00055 #include "qrect.h" 00056 #include "qdom.h" 00057 #endif // QT_H 00058 00059 #if !defined(QT_MODULE_XML) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_XML ) 00060 #define QM_EXPORT_SVG 00061 #else 00062 #define QM_EXPORT_SVG Q_EXPORT 00063 #endif 00064 00065 #ifndef QT_NO_SVG 00066 00067 class QPainter; 00068 class QDomNode; 00069 class QDomNamedNodeMap; 00070 struct QSvgDeviceState; 00071 class QSvgDevicePrivate; 00072 00073 class QM_EXPORT_SVG QSvgDevice : public QPaintDevice 00074 { 00075 public: 00076 QSvgDevice(); 00077 ~QSvgDevice(); 00078 00079 bool play( QPainter *p ); 00080 00081 QString toString() const; 00082 00083 bool load( QIODevice *dev ); 00084 bool save( QIODevice *dev ); 00085 bool save( const QString &fileName ); 00086 00087 QRect boundingRect() const; 00088 void setBoundingRect( const QRect &r ); 00089 00090 protected: 00091 virtual bool cmd ( int, QPainter*, QPDevCmdParam* ); 00092 virtual int metric( int ) const; 00093 00094 private: 00095 // reading 00096 bool play( const QDomNode &node ); 00097 void saveAttributes(); 00098 void restoreAttributes(); 00099 QColor parseColor( const QString &col ); 00100 double parseLen( const QString &str, bool *ok=0, bool horiz=TRUE ) const; 00101 int lenToInt( const QDomNamedNodeMap &map, const QString &attr, 00102 int def=0 ) const; 00103 double lenToDouble( const QDomNamedNodeMap &map, const QString &attr, 00104 int def=0 ) const; 00105 void setStyleProperty( const QString &prop, const QString &val, 00106 QPen *pen, QFont *font, int *talign ); 00107 void setStyle( const QString &s ); 00108 void setTransform( const QString &tr ); 00109 void drawPath( const QString &data ); 00110 00111 // writing 00112 void appendChild( QDomElement &e, int c ); 00113 void applyStyle( QDomElement *e, int c ) const; 00114 void applyTransform( QDomElement *e ) const; 00115 00116 // reading 00117 QRect brect; // bounding rectangle 00118 QDomDocument doc; // document tree 00119 QDomNode current; 00120 QPoint curPt; 00121 QSvgDeviceState *curr; 00122 QPainter *pt; // used by play() et al 00123 00124 // writing 00125 bool dirtyTransform, dirtyStyle; 00126 00127 QSvgDevicePrivate *d; 00128 }; 00129 00130 inline QRect QSvgDevice::boundingRect() const 00131 { 00132 return brect; 00133 } 00134 00135 #endif // QT_NO_SVG 00136 00137 #endif // QSVGDEVICE_P_H