lib

kowmfread.cpp
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
19#include <tqfile.h>
20#include <kdebug.h>
21
22#include "kowmfread.h"
23#include "kowmfreadprivate.h"
24
25KoWmfRead::KoWmfRead() {
26 mKwmf = new KoWmfReadPrivate();
27}
28
29KoWmfRead::~KoWmfRead() {
30 delete mKwmf;
31}
32
33
34bool KoWmfRead::load( const TQString& filename )
35{
36 TQFile file( filename );
37
38 if ( !file.open( IO_ReadOnly ) )
39 {
40 kdDebug() << "KoWmfRead : Cannot open file " << TQString(TQFile::encodeName(filename)) << endl;
41 return false;
42 }
43
44 bool ret = mKwmf->load( file.readAll() );
45 file.close();
46
47 return ret;
48}
49
50
51bool KoWmfRead::load( const TQByteArray& array )
52{
53 return mKwmf->load( array );
54}
55
56
58{
59 return mKwmf->play( this );
60}
61
62
63bool KoWmfRead::isValid( void ) const {
64 return mKwmf->mValid;
65}
66
67
68bool KoWmfRead::isStandard( void ) const {
69 return mKwmf->mStandard;
70}
71
72
73bool KoWmfRead::isPlaceable( void ) const {
74 return mKwmf->mPlaceable;
75}
76
77
78bool KoWmfRead::isEnhanced( void ) const {
79 return mKwmf->mEnhanced;
80}
81
82
83TQRect KoWmfRead::boundingRect( void ) const {
84 return mKwmf->mBBox;
85}
86
87
88int KoWmfRead::defaultDpi( void ) const {
89 if ( mKwmf->mPlaceable ) {
90 return mKwmf->mDpi;
91 }
92 else {
93 return 0;
94 }
95}
96
97
98void KoWmfRead::setDebug( int nbrFunc ) {
99 mKwmf->mNbrFunc = nbrFunc;
100}
101
KoWmfReadPrivate allows to read WMF files.
TQRect mBBox
bounding rectangle
bool load(const TQByteArray &array)
Load WMF file.
int mDpi
number of points per inch for the default size
int mNbrFunc
number of functions to draw (==0 for all)
bool play(KoWmfRead *readKwmf)
Plays a metafile in readKwmf and returns true on success.
void setDebug(int nbFunc)
Activate debug mode.
Definition kowmfread.cpp:98
virtual bool load(const TQString &fileName)
Load WMF file.
Definition kowmfread.cpp:34
virtual bool play()
play the WMF file => call virtuals functions
Definition kowmfread.cpp:57
int defaultDpi(void) const
Returns the default DotPerInch for placeable meta file, return 0 for Standard meta file.
Definition kowmfread.cpp:88
virtual TQRect boundingRect(void) const
Returns the bounding rectangle Standard Meta File : return the bounding box from setWindowOrg and set...
Definition kowmfread.cpp:83
bool isStandard(void) const
Returns true if the metafile is standard / placeable / enhanced / valid.
Definition kowmfread.cpp:68