F:/KPlato/koffice/libs/kwmf/qwmf.h

Aller à la documentation de ce fichier.
00001 /* Windows Meta File Loader
00002  *
00003  * Copyright ( C ) 1998 Stefan Taferner
00004  * Modified 2002 thierry lorthiois
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the
00008  * Free Software Foundation; either version 2 of the License, or ( at your
00009  * option ) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014  * General Public License for more details. You should have received a copy
00015  * of the GNU General Public License along with this program; if not, write
00016  * to the Free Software Foundation, Inc, 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 #ifndef qwmf_h
00020 #define qwmf_h
00021 
00022 #include <QString>
00023 #include <QPainter>
00024 #include <QMatrix>
00025 #include <q3pointarray.h>
00026 #include <QPen>
00027 #include <QColor>
00028 #include <QImage>
00029 #include <QRect>
00030 
00031 class QBuffer;
00032 class QString;
00033 class WmfCmd;
00034 class WinObjHandle;
00035 class WinObjPenHandle;
00036 class WinObjBrushHandle;
00037 struct WmfPlaceableHeader;
00038 
00051 class QWinMetaFile
00052 {
00053 public:
00054     QWinMetaFile();
00055     virtual ~QWinMetaFile();
00056 
00061     virtual bool load( const QString &fileName );
00062     virtual bool load( QBuffer &buffer );
00063 
00071     virtual bool paint( QPaintDevice* target, bool absolute=false );
00072 
00076     bool isPlaceable( void ) const { return mIsPlaceable; }
00077 
00081     bool isEnhanced( void ) const { return mIsEnhanced; }
00082 
00086     QRect bbox( void ) const { return mBBox; }
00087 
00088 public: // should be protected but cannot
00089     /* Metafile painter methods */
00090 
00092     void setWindowOrg( long num, short* parms );
00094     void setWindowExt( long num, short* parms );
00095 
00096     /****************** Drawing *******************/
00098     void lineTo( long num, short* parms );
00100     void moveTo( long num, short* parms );
00102     void ellipse( long num, short* parms );
00104     void polygon( long num, short* parms );
00106     void polyPolygon( long num, short* parms );
00108     void polyline( long num, short* parms );
00110     void rectangle( long num, short* parms );
00112     void roundRect( long num, short* parms );
00114     void arc( long num, short* parms );
00116     void chord( long num, short* parms );
00118     void pie( long num, short* parms );
00120     void setPolyFillMode( long num, short* parms );
00122     void setBkColor( long num, short* parms );
00124     void setBkMode( long num, short* parms );
00126     void setPixel( long num, short* parms );
00128     void setRop( long num, short* parms );
00130     void saveDC( long num, short* parms );
00132     void restoreDC( long num, short* parms );
00134     void intersectClipRect( long num, short* parms );
00136     void excludeClipRect( long num, short* parms );
00137 
00138     /****************** Text *******************/
00140     void setTextColor( long num, short* parms );
00142     void setTextAlign( long num, short* parms );
00144     void textOut( long num, short* parms );
00145     void extTextOut( long num, short* parms );
00146 
00147     /****************** Bitmap *******************/
00149     void dibBitBlt( long num, short* parms );
00151     void dibStretchBlt( long num, short* parms );
00152     void stretchDib( long num, short* parms );
00154     void dibCreatePatternBrush( long num, short* parms );
00155 
00156     /****************** Object handle *******************/
00158     void selectObject( long num, short* parms );
00160     void deleteObject( long num, short* parms );
00162     void createEmptyObject( long num, short* parms );
00164     void createBrushIndirect( long num, short* parms );
00166     void createPenIndirect( long num, short* parms );
00168     void createFontIndirect( long num, short* parms );
00169 
00170     /****************** misc *******************/
00172     void noop( long , short* );
00174     void end( long /*num*/, short* /*parms*/ );
00176     int dpi( void ) const { return mDpi; }
00177 
00178 protected:
00180     unsigned short calcCheckSum( WmfPlaceableHeader* );
00181 
00184     virtual int findFunc( unsigned short aFunc ) const;
00185 
00187     QPolygon* pointArray( short num, short* parms );
00188 
00190     QColor color( short* parm );
00191 
00193     unsigned int toDWord( short* parm );
00194 
00196     void xyToAngle( int xStart, int yStart, int xEnd, int yEnd, int& angle, int& aLength );
00197 
00199     void addHandle( WinObjHandle*  );
00200     void deleteHandle( int );
00201 
00203     QPainter::CompositionMode winToQtComposition( short parm ) const;
00204     QPainter::CompositionMode winToQtComposition( long parm ) const;
00205 
00207     bool dibToBmp( QImage& bmp, const char* dib, long size);
00208 
00209 protected:
00210     QPainter mPainter;
00211     bool mIsPlaceable, mIsEnhanced, mValid;
00212 
00213     // coordinate system
00214     bool   mAbsoluteCoord;
00215     QMatrix  mInternalWorldMatrix;   // memorisation of WMF matrix transformation
00216     QRect mHeaderBoundingBox;
00217     QRect mBBox;
00218 
00219     // information shared between Metafile Functions
00220     QColor mTextColor;
00221     int mTextAlign, mRotation;
00222     bool mWinding;
00223 
00224     WmfCmd* mFirstCmd;
00225     WinObjHandle** mObjHandleTab;
00226     QPolygon mPoints;
00227     int mDpi;
00228     QPoint mLastPos;
00229 };
00230 
00231 #endif /*qwmf_h*/

Généré le Wed Nov 22 23:41:13 2006 pour KPlato par  doxygen 1.5.1-p1