lib

kowmfwrite.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 _KOWMFWRITE_H_
00019 #define _KOWMFWRITE_H_
00020 
00021 #include <qpen.h>
00022 #include <qbrush.h>
00023 #include <qcolor.h>
00024 #include <qfont.h>
00025 #include <qrect.h>
00026 #include <qbuffer.h>
00027 #include <qregion.h>
00028 #include <qstring.h>
00029 #include <qwmatrix.h>
00030 #include <qimage.h>
00031 #include <qptrlist.h>
00032 #include <qpointarray.h>
00033 #include <koffice_export.h>
00034 class KoWmfWritePrivate;
00035 
00049 class KOWMF_EXPORT KoWmfWrite
00050 {
00051 public:
00052     KoWmfWrite( const QString& fileName );
00053     virtual ~KoWmfWrite();
00054 
00055 
00056     // -------------------------------------------------------------------------
00057     // virtual Painter
00058     // for a good documentation : check QPainter documentation
00062     bool  begin();
00066     bool  end();
00067     void  save();
00068     void  restore();
00069 
00075     void setDefaultDpi( int dpi );
00076 
00077     // Drawing tools
00078     void  setFont( const QFont& f );
00079     // the width of the pen is in logical coordinate
00080     void  setPen( const QPen& p );
00081     void  setBrush( const QBrush& b );
00082 
00083     // Drawing attributes/modes
00084     void  setBackgroundColor( const QColor& r );
00085     void  setBackgroundMode( Qt::BGMode );
00086     void  setRasterOp( Qt::RasterOp );
00087 
00088     // Change logical Coordinate
00089     void  setWindow( int left, int top , int width, int height );
00090 
00091     // Clipping
00092     // the 'CoordinateMode' parameter is ommitted : always CoordPainter in wmf
00093     // not yet implemented
00094     void  setClipRegion( const QRegion& r );
00095     void  clipping( bool enable );
00096 
00097     // Graphics drawing functions
00098     void  moveTo( int left, int top );
00099     void  lineTo( int left, int top );
00100     void  drawRect( int left, int top, int width, int height );
00101     void  drawRoundRect( int left, int top, int width, int height, int = 25, int = 25 );
00102     void  drawEllipse( int left, int top, int width, int height );
00103     void  drawArc( int left, int top, int width, int height, int a, int alen );
00104     void  drawPie( int left, int top, int width, int height, int a, int alen );
00105     void  drawChord( int left, int top, int width, int height, int a, int alen );
00106     void  drawPolyline( const QPointArray& pa );
00107     void  drawPolygon( const QPointArray& pa, bool winding=FALSE );
00108     // drawPolyPolygon draw the XOR of a list of polygons
00109     // listPa : list of polygons
00110     void  drawPolyPolygon( QPtrList<QPointArray>& listPa, bool winding=FALSE );
00111     void  drawImage( int left, int top, const QImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 );
00112 
00113     // Text drawing functions
00114     // rotation = the degrees of rotation in counterclockwise
00115     // not yet implemented
00116     void  drawText( int x, int y, int w, int h, int flags, const QString &s, double rotation );
00117 
00118 private:
00119     //-----------------------------------------------------------------------------
00120     // Utilities and conversion Qt --> Wmf
00121 
00123     void pointArray( const QPointArray& pa );
00124 
00126     Q_UINT32 winColor( QColor color );
00127 
00129     void angleToxy( int& xStart, int& yStart, int& xEnd, int& yEnd, int a, int alen );
00130 
00132     Q_UINT16 qtRasterToWin16( Qt::RasterOp op ) const;
00133     Q_UINT32 qtRasterToWin32( Qt::RasterOp op ) const;
00134 
00135 
00136 private:
00137     KoWmfWritePrivate *d;
00138 
00139 };
00140 
00141 #endif
00142 
KDE Home | KDE Accessibility Home | Description of Access Keys