filters

oowriterexport.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, 2002, 2003, 2004 Nicolas GOUTTE <goutte@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 /*
00021    This file is based on the old file:
00022     /home/kde/koffice/filters/kword/ascii/asciiexport.cc
00023 
00024    The old file was copyrighted by
00025     Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00026     Copyright (c) 2000 ID-PRO Deutschland GmbH. All rights reserved.
00027                        Contact: Wolf-Michael Bolle <Bolle@ID-PRO.de>
00028 
00029    The old file was licensed under the terms of the GNU Library General Public
00030    License version 2.
00031 */
00032 
00033 #include <kdebug.h>
00034 #include <kgenericfactory.h>
00035 #include <kimageio.h>
00036 
00037 #include <KoFilterChain.h>
00038 
00039 #include "ExportFilter.h"
00040 #include "oowriterexport.h"
00041 
00042 class OOWRITERExportFactory : KGenericFactory<OOWRITERExport, KoFilter>
00043 {
00044 public:
00045     OOWRITERExportFactory(void) : KGenericFactory<OOWRITERExport, KoFilter> ("kwordoowriterexport")
00046     {}
00047 };
00048 
00049 K_EXPORT_COMPONENT_FACTORY( liboowriterexport, OOWRITERExportFactory() )
00050 
00051 OOWRITERExport::OOWRITERExport(KoFilter */*parent*/, const char */*name*/, const QStringList &) :
00052                      KoFilter() {
00053 }
00054 
00055 KoFilter::ConversionStatus OOWRITERExport::convert( const QCString& from, const QCString& to )
00056 {
00057     if ( to != "application/vnd.sun.xml.writer" || from != "application/x-kword" )
00058     {
00059         return KoFilter::NotImplemented;
00060     }
00061 
00062     // We need KimageIO's help in OOWriterWorker::convertUnknownImage
00063     KImageIO::registerFormats();
00064 
00065     OOWriterWorker* worker=new OOWriterWorker();
00066 
00067     if (!worker)
00068     {
00069         kdError(30506) << "Cannot create Worker! Aborting!" << endl;
00070         return KoFilter::StupidError;
00071     }
00072 
00073     KWEFKWordLeader* leader=new KWEFKWordLeader(worker);
00074 
00075     if (!leader)
00076     {
00077         kdError(30506) << "Cannot create Worker! Aborting!" << endl;
00078         delete worker;
00079         return KoFilter::StupidError;
00080     }
00081 
00082     KoFilter::ConversionStatus result=leader->convert(m_chain,from,to);
00083 
00084     delete leader;
00085     delete worker;
00086 
00087     return result;
00088 }
00089 
00090 #include "oowriterexport.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys