filters
bmpexport.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 "KPrDocument.h"
00031 #include "KPrView.h"
00032 #include "KPrCanvas.h"
00033 #include "bmpexport.h"
00034 #include "exportsizedia.h"
00035
00036 typedef KGenericFactory<BmpExport, KoFilter> bmpExportFactory;
00037 K_EXPORT_COMPONENT_FACTORY( libkpresenterbmpexport, bmpExportFactory( "bmpexport" ) )
00038
00039 BmpExport::BmpExport(KoFilter *fil, const char *name, const QStringList&lst)
00040 : ImageExport(fil,name,lst)
00041 {
00042 }
00043
00044 BmpExport::~BmpExport()
00045 {
00046 }
00047
00048 bool BmpExport::extraImageAttribute()
00049 {
00050 ExportSizeDia *exportDialog = new ExportSizeDia( width, height,
00051 0, "exportdialog");
00052 bool ret = false;
00053 if (exportDialog->exec()) {
00054 width = exportDialog->width();
00055 height = exportDialog->height();
00056 ret = true;
00057 kdDebug() << "PNG Export: size = [" << width << "," << height << "]" << endl;
00058 }
00059 delete exportDialog;
00060 return ret;
00061 }
00062
00063
00064 bool BmpExport::saveImage( QString fileName)
00065 {
00066 bool ret = pixmap.save( fileName, "BMP" );
00067
00068 if ( !ret ) {
00069 KMessageBox::error( 0, i18n( "Failed to write file." ),
00070 i18n( "BMP Export Error" ) );
00071 }
00072 return ret;
00073 }
00074
00075 const char * BmpExport::exportFormat()
00076 {
00077 return "image/x-bmp";
00078 }
00079
00080 #include "bmpexport.moc"
00081
|