filters

xsltimport.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@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 <xsltimport.h>
00021 #include <xsltimport.moc>
00022 #include <kdebug.h>
00023 #include <KoFilterChain.h>
00024 #include <kgenericfactory.h>
00025 #include <kglobal.h>
00026 #include <klocale.h>
00027 #include <qtextcodec.h>
00028 #include "xsltimportdia.h"
00029 
00030 
00031 typedef KGenericFactory<XSLTImport, KoFilter> XSLTImportFactory;
00032 K_EXPORT_COMPONENT_FACTORY( libxsltimport, XSLTImportFactory( "kofficefilters" ) )
00033 
00034 
00035 XSLTImport::XSLTImport(KoFilter *, const char *, const QStringList&) :
00036                      KoFilter() {
00037 }
00038 
00039 KoFilter::ConversionStatus XSLTImport::convert( const QCString&, const QCString& to )
00040 {
00041     QString config;
00042 
00043     if(to != "application/x-kword" &&
00044         to != "application/x-kontour" && to != "application/x-kspread" &&
00045         to != "application/x-kivio" && to != "application/x-kchart" &&
00046         to != "application/x-kpresenter")
00047         return KoFilter::NotImplemented;
00048 
00049     // ## missing appIdentification
00050     KoStore* out = KoStore::createStore(QString(m_chain->outputFile()), KoStore::Write);
00051     if(!out || !out->open("root"))
00052     {
00053         kdError() << "Unable to create output file!" << endl;
00054         delete out;
00055         return KoFilter::FileNotFound;
00056     }
00057     /* input file Reading */
00058     out->close();
00059     kdDebug() << "here" << endl;
00060     XSLTImportDia* dialog = new XSLTImportDia(out, to, 0, "Importation", true);
00061     dialog->setInputFile(m_chain->inputFile());
00062 
00063     dialog->exec();
00064     delete dialog;
00065     delete out;
00066 
00067     return KoFilter::OK;
00068 }
KDE Home | KDE Accessibility Home | Description of Access Keys