filters
wpexport.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #ifdef HAVE_UNISTD_H
00023 #include <unistd.h>
00024 #endif
00025
00026 #include <qtextcodec.h>
00027 #include <qfile.h>
00028 #include <qfileinfo.h>
00029 #include <qtextstream.h>
00030
00031 #include <kdebug.h>
00032 #include <KoFilterChain.h>
00033 #include <kgenericfactory.h>
00034
00035 #include <KWEFBaseWorker.h>
00036 #include <KWEFKWordLeader.h>
00037
00038 #include <wpexport.h>
00039 #include <wp5.h>
00040 #include <wp6.h>
00041
00042 typedef KGenericFactory<WPExport, KoFilter> WPExportFactory;
00043 K_EXPORT_COMPONENT_FACTORY( libwpexport, WPExportFactory( "kofficefilters" ) )
00044
00045 WPExport::WPExport( KoFilter *, const char *, const QStringList& ):
00046 KoFilter()
00047 {
00048 }
00049
00050 KoFilter::ConversionStatus
00051 WPExport::convert( const QCString& from,
00052 const QCString& to )
00053 {
00054
00055 if( to!= "application/wordperfect" || from != "application/x-kword" )
00056 return KoFilter::NotImplemented;
00057
00058
00059
00060
00061
00062 QString outfile = m_chain->outputFile();
00063 QString extension = QFileInfo( outfile ).extension().lower();
00064 int version = ( extension == "wp" ) ? 5 : 6 ;
00065
00066 KWEFBaseWorker* worker;
00067 if( version == 5 ) worker = new WPFiveWorker();
00068 else worker = new WPSixWorker();
00069
00070 KWEFKWordLeader* leader = new KWEFKWordLeader( worker );
00071
00072 KoFilter::ConversionStatus result;
00073 result = leader->convert( m_chain, from, to );
00074
00075 delete worker;
00076 delete leader;
00077
00078 return result;
00079 }
00080
00081 #include "wpexport.moc"
|