filters

jpegexport.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Laurent Montel <montel@kde.org>
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 as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
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 "jpegexport.h"
00034 #include "exportsizedia.h"
00035 
00036 typedef KGenericFactory<JpegExport, KoFilter> jpegExportFactory;
00037 K_EXPORT_COMPONENT_FACTORY( libkpresenterjpegexport, jpegExportFactory( "jpegexport" ) )
00038 
00039 JpegExport::JpegExport(KoFilter *fil, const char *name, const QStringList&lst)
00040     : ImageExport(fil,name,lst)
00041 {
00042 }
00043 
00044 JpegExport::~JpegExport()
00045 {
00046 }
00047 
00048 bool JpegExport::extraImageAttribute()
00049 {
00050     bool ret = false;
00051     ExportSizeDia  *exportDialog = new ExportSizeDia( width, height,
00052                            0, "exportdialog");
00053     if (exportDialog->exec()) {
00054     width  = exportDialog->width();
00055     height = exportDialog->height();
00056 
00057     kdDebug() << "MNG Export: size = [" << width << "," << height << "]" << endl;
00058         ret = true;
00059     }
00060     delete exportDialog;
00061     return ret;
00062 }
00063 
00064 
00065 bool JpegExport::saveImage( QString fileName)
00066 {
00067     bool ret = pixmap.save( fileName, "JPEG" );
00068     // Save the image.
00069     if ( !ret ) {
00070         KMessageBox::error( 0, i18n( "Failed to write file." ),
00071                             i18n( "JPEG Export Error" ) );
00072     }
00073     return ret;
00074 }
00075 
00076 const char * JpegExport::exportFormat()
00077 {
00078             return "image/jpeg";
00079 }
00080 
00081 #include "jpegexport.moc"
00082 
KDE Home | KDE Accessibility Home | Description of Access Keys