00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _WMFIMPORTPARSER_H_
00019 #define _WMFIMPORTPARSER_H_
00020
00021 #include <qpainter.h>
00022 #include <qdom.h>
00023 #include <core/vdocument.h>
00024 #include <core/vcomposite.h>
00025 #include <kowmfread.h>
00026
00027
00034 class WMFImportParser : public KoWmfRead
00035 {
00036 public:
00037 WMFImportParser();
00038 ~WMFImportParser() { }
00039
00043 bool play( VDocument& doc );
00044
00045
00046 private:
00047
00048
00049 bool begin();
00050 bool end();
00051 void save();
00052 void restore();
00053
00054
00055 void setFont( const QFont &font );
00056
00057 void setPen( const QPen &pen );
00058 const QPen &pen() const;
00059 void setBrush( const QBrush &brush );
00060
00061
00062 void setBackgroundColor( const QColor &c );
00063 void setBackgroundMode( Qt::BGMode mode );
00064 void setRasterOp( Qt::RasterOp op );
00065
00072 void setWindowOrg( int left, int top );
00073 void setWindowExt( int width, int height );
00074
00075
00076
00077
00078 void setClipRegion( const QRegion &rec );
00079 QRegion clipRegion();
00080
00081
00082 void moveTo( int x, int y );
00083 void lineTo( int x, int y );
00084 void drawRect( int x, int y, int w, int h );
00085 void drawRoundRect( int x, int y, int w, int h, int = 25, int = 25 );
00086 void drawEllipse( int x, int y, int w, int h );
00087 void drawArc( int x, int y, int w, int h, int a, int alen );
00088 void drawPie( int x, int y, int w, int h, int a, int alen );
00089 void drawChord( int x, int y, int w, int h, int a, int alen );
00090 void drawPolyline( const QPointArray &pa );
00091 void drawPolygon( const QPointArray &pa, bool winding=FALSE );
00096 void drawPolyPolygon( QPtrList<QPointArray>& listPa, bool winding=FALSE );
00097 void drawImage( int x, int y, const QImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 );
00098
00099
00100
00101
00102 void drawText( int x, int y, int w, int h, int flags, const QString &s, double rotation );
00103
00104
00105 void setWorldMatrix( const QWMatrix &, bool combine=FALSE );
00106
00107
00108
00109
00110 void appendPen( VObject& obj );
00111 void appendBrush( VObject& obj );
00112 void appendPoints(VPath& path, const QPointArray& pa);
00113
00114
00115
00116
00117 double coordX( int left )
00118 { return ((double)(left - mCurrentOrg.x()) * mScaleX); }
00119 double coordY( int top )
00120 { return (mDoc->height() - ((double)(top - mCurrentOrg.y()) * mScaleY)); }
00121 double scaleW( int width )
00122 { return (width * mScaleX); }
00123 double scaleH( int height )
00124 { return (height * mScaleY); }
00125
00126 private:
00127 VDocument *mDoc;
00128 QRegion mClippingRegion;
00129 QPen mPen;
00130 QBrush mBrush;
00131 Qt::BGMode mBackgroundMode;
00132 QColor mBackgroundColor;
00133
00134 QPoint mCurrentOrg;
00135 double mScaleX;
00136 double mScaleY;
00137
00138 QPoint mCurrentPoint;
00139 };
00140
00141 #endif