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 00019 #include <QFile> 00020 #include <kdebug.h> 00021 00022 #include "kowmfread.h" 00023 #include "kowmfreadprivate.h" 00024 00025 KoWmfRead::KoWmfRead() { 00026 mKwmf = new KoWmfReadPrivate(); 00027 } 00028 00029 KoWmfRead::~KoWmfRead() { 00030 delete mKwmf; 00031 } 00032 00033 00034 bool KoWmfRead::load( const QString& filename ) 00035 { 00036 QFile file( filename ); 00037 00038 if ( !file.open( QIODevice::ReadOnly ) ) 00039 { 00040 kDebug() << "KoWmfRead : Cannot open file " << QFile::encodeName(filename) << endl; 00041 return false; 00042 } 00043 00044 bool ret = mKwmf->load( file.readAll() ); 00045 file.close(); 00046 00047 return ret; 00048 } 00049 00050 00051 bool KoWmfRead::load( const QByteArray& array ) 00052 { 00053 return mKwmf->load( array ); 00054 } 00055 00056 00057 bool KoWmfRead::play( ) 00058 { 00059 return mKwmf->play( this ); 00060 } 00061 00062 00063 bool KoWmfRead::isValid( void ) const { 00064 return mKwmf->mValid; 00065 } 00066 00067 00068 bool KoWmfRead::isStandard( void ) const { 00069 return mKwmf->mStandard; 00070 } 00071 00072 00073 bool KoWmfRead::isPlaceable( void ) const { 00074 return mKwmf->mPlaceable; 00075 } 00076 00077 00078 bool KoWmfRead::isEnhanced( void ) const { 00079 return mKwmf->mEnhanced; 00080 } 00081 00082 00083 QRect KoWmfRead::boundingRect( void ) const { 00084 return mKwmf->mBBox; 00085 } 00086 00087 00088 int KoWmfRead::defaultDpi( void ) const { 00089 if ( mKwmf->mPlaceable ) { 00090 return mKwmf->mDpi; 00091 } 00092 else { 00093 return 0; 00094 } 00095 } 00096 00097 00098 void KoWmfRead::setDebug( int nbrFunc ) { 00099 mKwmf->mNbrFunc = nbrFunc; 00100 } 00101