lib

kowmfread.h

00001 /* This file is part of the KDE libraries
00002    Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016  * Boston, MA 02110-1301, USA.
00017 */
00018 #ifndef _KOWMFREAD_H_
00019 #define _KOWMFREAD_H_
00020 
00021 #include <qpen.h>
00022 #include <qbrush.h>
00023 #include <qfont.h>
00024 #include <qcolor.h>
00025 #include <qrect.h>
00026 #include <qregion.h>
00027 #include <qimage.h>
00028 #include <qwmatrix.h>
00029 #include <qstring.h>
00030 #include <qptrlist.h>
00031 #include <qpointarray.h>
00032 
00033 #include <../kofficecore/koffice_export.h>
00034 class KoWmfReadPrivate;
00035 
00046 class KOWMF_EXPORT KoWmfRead
00047 {
00048 public:
00049     KoWmfRead();
00050     virtual ~KoWmfRead();
00051 
00055     virtual bool load( const QString& fileName );
00056     virtual bool load( const QByteArray& array );
00057 
00061     virtual bool play(  );
00062 
00066     bool isStandard( void ) const;
00067     bool isPlaceable( void ) const;
00068     bool isEnhanced( void ) const;
00069     bool isValid( void ) const;
00070 
00077     virtual QRect boundingRect( void ) const;
00078 
00083     int defaultDpi( void ) const;
00084 
00090     void setDebug( int nbFunc );
00091 
00092     // -------------------------------------------------------------------------
00093     // A virtual QPainter : inherit those virtuals functions
00094     // for a good documentation : check QPainter documentation
00095     virtual bool  begin() = 0;
00096     virtual bool  end() = 0;
00097     virtual void  save() = 0;
00098     virtual void  restore() = 0;
00099 
00100     // Drawing tools
00101     virtual void  setFont( const QFont & ) = 0;
00102     // the pen : the width of the pen is in logical coordinate
00103     virtual void  setPen( const QPen &p ) = 0;
00104     virtual const QPen &pen() const = 0;
00105     virtual void  setBrush( const QBrush & ) = 0;
00106 
00107     // Drawing attributes/modes
00108     virtual void  setBackgroundColor( const QColor & ) = 0;
00109     virtual void  setBackgroundMode( Qt::BGMode ) = 0;
00110     virtual void  setRasterOp( Qt::RasterOp ) = 0;
00111 
00112     // Change logical Coordinate
00113     // some wmf files call those functions several times in the middle of a drawing
00114     // others doesn't call setWindow* at all
00115     virtual void  setWindowOrg( int left, int top ) = 0;
00116     virtual void  setWindowExt( int width, int height ) = 0;
00117 
00118     // Clipping
00119     // the 'CoordinateMode' parameter is ommitted : always CoordPainter in wmf
00120     // setClipRegion() is often used with save() and restore() => implement all or none
00121     virtual void  setClipRegion( const QRegion & ) = 0;
00122     virtual QRegion clipRegion() = 0;
00123 
00124     // Graphics drawing functions
00125     virtual void  moveTo( int x, int y ) = 0;
00126     virtual void  lineTo( int x, int y ) = 0;
00127     virtual void  drawRect( int x, int y, int w, int h ) = 0;
00128     virtual void  drawRoundRect( int x, int y, int w, int h, int = 25, int = 25 ) = 0;
00129     virtual void  drawEllipse( int x, int y, int w, int h ) = 0;
00130     virtual void  drawArc( int x, int y, int w, int h, int a, int alen ) = 0;
00131     virtual void  drawPie( int x, int y, int w, int h, int a, int alen ) = 0;
00132     virtual void  drawChord( int x, int y, int w, int h, int a, int alen ) = 0;
00133     virtual void  drawPolyline( const QPointArray &pa ) = 0;
00134     virtual void  drawPolygon( const QPointArray &pa, bool winding=FALSE ) = 0;
00135     // drawPolyPolygon draw the XOR of a list of polygons
00136     // listPa : list of polygons
00137     virtual void  drawPolyPolygon( QPtrList<QPointArray>& listPa, bool winding=FALSE ) = 0;
00138     virtual void  drawImage( int x, int y, const QImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 ) = 0;
00139 
00140     // Text drawing functions
00141     // rotation = the degrees of rotation in counterclockwise
00142     // not yet implemented in KWinMetaFile
00143     virtual void  drawText( int x, int y, int w, int h, int flags, const QString &s, double rotation ) = 0;
00144 
00145     // matrix transformation : only used for bitmap manipulation
00146     virtual void  setWorldMatrix( const QWMatrix &, bool combine=FALSE ) = 0;
00147 
00148 private:
00149     KoWmfReadPrivate  *mKwmf;
00150 
00151 };
00152 
00153 #endif
00154 
KDE Home | KDE Accessibility Home | Description of Access Keys