filters
pngexport.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qstring.h>
00021 #include <qtextstream.h>
00022 #include <qfile.h>
00023 #include <qobject.h>
00024
00025 #include <kapplication.h>
00026 #include <kdebug.h>
00027 #include <kgenericfactory.h>
00028 #include <kmessagebox.h>
00029
00030 #include <KoFilterChain.h>
00031 #include <KoStore.h>
00032 #include <KoStoreDevice.h>
00033
00034
00035 #include "pngexport.h"
00036 #include "pngexportdia.h"
00037
00038
00039 typedef KGenericFactory<PNGExport, KoFilter> PNGExportFactory;
00040 K_EXPORT_COMPONENT_FACTORY( libkfopngexport, PNGExportFactory( "kofficefilters" ) )
00041
00042
00043 PNGExport::PNGExport( KoFilter *, const char *, const QStringList& )
00044 : KoFilter()
00045 {
00046 }
00047
00048
00049 KoFilter::ConversionStatus PNGExport::convert( const QCString& from, const QCString& to )
00050 {
00051 if ( to != "image/png" || from != "application/x-kformula" )
00052 return KoFilter::NotImplemented;
00053
00054 KoStoreDevice* in = m_chain->storageFile( "root", KoStore::Read );
00055 if(!in) {
00056 kapp->restoreOverrideCursor();
00057 KMessageBox::error( 0, i18n( "Failed to read data." ), i18n( "PNG Export Error" ) );
00058 return KoFilter::FileNotFound;
00059 }
00060
00061 QDomDocument dom( "KFORMULA" );
00062 if ( !dom.setContent( in, false ) ) {
00063 kapp->restoreOverrideCursor();
00064 KMessageBox::error( 0, i18n( "Malformed XML data." ), i18n( "PNG Export Error" ) );
00065 return KoFilter::WrongFormat;
00066 }
00067
00068 PNGExportDia* dialog = new PNGExportDia( dom, m_chain->outputFile() );
00069 dialog->exec();
00070 delete dialog;
00071 return KoFilter::OK;
00072 }
00073
00074 #include "pngexport.moc"
|