filters
pngexport.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qpixmap.h>
00021 #include <qpainter.h>
00022
00023 #include <kmessagebox.h>
00024
00025 #include <KoFilterChain.h>
00026 #include <KoStore.h>
00027 #include <kgenericfactory.h>
00028 #include <KoDocument.h>
00029
00030 #include "pngexport.h"
00031 #include "exportsizedia.h"
00032
00033 typedef KGenericFactory<PngExport, KoFilter> PngExportFactory;
00034 K_EXPORT_COMPONENT_FACTORY( libkpresenterpngexport, PngExportFactory( "pngexport" ) )
00035
00036 PngExport::PngExport(KoFilter *fil, const char *name, const QStringList&lst)
00037 : ImageExport(fil,name,lst)
00038 {
00039 }
00040
00041 PngExport::~PngExport()
00042 {
00043 }
00044
00045 bool PngExport::extraImageAttribute()
00046 {
00047 bool ret = false;
00048 ExportSizeDia *exportDialog = new ExportSizeDia( width, height,
00049 0, "exportdialog");
00050 if (exportDialog->exec()) {
00051 width = exportDialog->width();
00052 height = exportDialog->height();
00053 ret = true;
00054 kdDebug() << "PNG Export: size = [" << width << "," << height << "]" << endl;
00055 }
00056 delete exportDialog;
00057 return ret;
00058 }
00059
00060 const char * PngExport::exportFormat()
00061 {
00062 return "image/png";
00063 }
00064
00065 bool PngExport::saveImage( QString fileName)
00066 {
00067 bool ret = pixmap.save( fileName, "PNG" );
00068
00069 if ( !ret ) {
00070 KMessageBox::error( 0, i18n( "Failed to write file." ),
00071 i18n( "PNG Export Error" ) );
00072 }
00073 return ret;
00074 }
00075
00076
00077 #include "pngexport.moc"
00078
|