lib

kowmfread.h
1/* This file is part of the KDE libraries
2 Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17*/
18#ifndef _KOWMFREAD_H_
19#define _KOWMFREAD_H_
20
21#include <tqpen.h>
22#include <tqbrush.h>
23#include <tqfont.h>
24#include <tqcolor.h>
25#include <tqrect.h>
26#include <tqregion.h>
27#include <tqimage.h>
28#include <tqwmatrix.h>
29#include <tqstring.h>
30#include <tqptrlist.h>
31#include <tqpointarray.h>
32
33#include <../kofficecore/koffice_export.h>
35
46class KOWMF_EXPORT KoWmfRead
47{
48public:
49 KoWmfRead();
50 virtual ~KoWmfRead();
51
55 virtual bool load( const TQString& fileName );
56 virtual bool load( const TQByteArray& array );
57
61 virtual bool play( );
62
66 bool isStandard( void ) const;
67 bool isPlaceable( void ) const;
68 bool isEnhanced( void ) const;
69 bool isValid( void ) const;
70
77 virtual TQRect boundingRect( void ) const;
78
83 int defaultDpi( void ) const;
84
90 void setDebug( int nbFunc );
91
92 // -------------------------------------------------------------------------
93 // A virtual TQPainter : inherit those virtuals functions
94 // for a good documentation : check TQPainter documentation
95 virtual bool begin() = 0;
96 virtual bool end() = 0;
97 virtual void save() = 0;
98 virtual void restore() = 0;
99
100 // Drawing tools
101 virtual void setFont( const TQFont & ) = 0;
102 // the pen : the width of the pen is in logical coordinate
103 virtual void setPen( const TQPen &p ) = 0;
104 virtual const TQPen &pen() const = 0;
105 virtual void setBrush( const TQBrush & ) = 0;
106
107 // Drawing attributes/modes
108 virtual void setBackgroundColor( const TQColor & ) = 0;
109 virtual void setBackgroundMode( TQt::BGMode ) = 0;
110 virtual void setRasterOp( TQt::RasterOp ) = 0;
111
112 // Change logical Coordinate
113 // some wmf files call those functions several times in the middle of a drawing
114 // others doesn't call setWindow* at all
115 virtual void setWindowOrg( int left, int top ) = 0;
116 virtual void setWindowExt( int width, int height ) = 0;
117
118 // Clipping
119 // the 'CoordinateMode' parameter is ommitted : always CoordPainter in wmf
120 // setClipRegion() is often used with save() and restore() => implement all or none
121 virtual void setClipRegion( const TQRegion & ) = 0;
122 virtual TQRegion clipRegion() = 0;
123
124 // Graphics drawing functions
125 virtual void moveTo( int x, int y ) = 0;
126 virtual void lineTo( int x, int y ) = 0;
127 virtual void drawRect( int x, int y, int w, int h ) = 0;
128 virtual void drawRoundRect( int x, int y, int w, int h, int = 25, int = 25 ) = 0;
129 virtual void drawEllipse( int x, int y, int w, int h ) = 0;
130 virtual void drawArc( int x, int y, int w, int h, int a, int alen ) = 0;
131 virtual void drawPie( int x, int y, int w, int h, int a, int alen ) = 0;
132 virtual void drawChord( int x, int y, int w, int h, int a, int alen ) = 0;
133 virtual void drawPolyline( const TQPointArray &pa ) = 0;
134 virtual void drawPolygon( const TQPointArray &pa, bool winding=false ) = 0;
135 // drawPolyPolygon draw the XOR of a list of polygons
136 // listPa : list of polygons
137 virtual void drawPolyPolygon( TQPtrList<TQPointArray>& listPa, bool winding=false ) = 0;
138 virtual void drawImage( int x, int y, const TQImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 ) = 0;
139
140 // Text drawing functions
141 // rotation = the degrees of rotation in counterclockwise
142 // not yet implemented in KWinMetaFile
143 virtual void drawText( int x, int y, int w, int h, int flags, const TQString &s, double rotation ) = 0;
144
145 // matrix transformation : only used for bitmap manipulation
146 virtual void setWorldMatrix( const TQWMatrix &, bool combine=false ) = 0;
147
148private:
149 KoWmfReadPrivate *mKwmf;
150
151};
152
153#endif
154
KoWmfReadPrivate allows to read WMF files.
KoWmfRead allows the redirection of the actions stored in a WMF file.
Definition kowmfread.h:47