home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / private / qsvgdevice_p.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  129 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qsvgdevice_p.h   3.0.0   edited Oct 1 16:29 $
  3. **
  4. ** Definition of the QSvgDevice class
  5. **
  6. ** Created : 20001024
  7. **
  8. ** Copyright (C) 2000-2001 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.  
  67. class QPainter;
  68. class QDomNode;
  69. class QDomNamedNodeMap;
  70. class QSvgDevicePrivate;
  71.  
  72. class QM_EXPORT_SVG QSvgDevice : public QPaintDevice
  73. {
  74. public:
  75.     QSvgDevice();
  76.     ~QSvgDevice();
  77.  
  78.     bool play( QPainter *p );
  79.  
  80.     QString toString() const;
  81.  
  82.     bool load( QIODevice *dev );
  83.     bool save( QIODevice *dev );
  84.     bool save( const QString &fileName );
  85.  
  86.     QRect boundingRect() const;
  87.     void setBoundingRect( const QRect &r );
  88.  
  89. protected:
  90.     virtual bool cmd ( int, QPainter*, QPDevCmdParam* );
  91.     virtual int     metric( int ) const;
  92.  
  93. private:
  94.     // reading
  95.     bool play( const QDomNode &node );
  96.     QColor parseColor( const QString &col );
  97.     double parseLen( const QString &str, bool *ok=0, bool horiz=TRUE ) const;
  98.     int lenToInt( const QDomNamedNodeMap &map, const QString &attr,
  99.           int def=0 ) const;
  100.     void setStyle( const QString &s );
  101.     void setTransform( const QString &tr );
  102.     void drawPath( const QString &data );
  103.  
  104.     // writing
  105.     void applyStyle( QDomElement *e, int c ) const;
  106.     void applyTransform( QDomElement *e ) const;
  107.  
  108.     // reading
  109.     QRect brect;            // bounding rectangle
  110.     QDomDocument doc;            // document tree
  111.     QDomNode current;
  112.     QPoint curPt;
  113.     QPainter *pt;            // used by play() et al
  114.  
  115.     // writing
  116.     bool dirtyTransform, dirtyStyle;
  117.  
  118.     QSvgDevicePrivate *d;
  119. };
  120.  
  121. inline QRect QSvgDevice::boundingRect() const
  122. {
  123.     return brect;
  124. }
  125.  
  126. #endif // QT_NO_SVG
  127.  
  128. #endif // QSVGDEVICE_H
  129.