filters

rtfexport.cc

00001 // $Header$
00002 
00003 /*
00004    This file is part of the KDE project
00005    Copyright 2001, 2002 Nicolas GOUTTE <goutte@kde.org>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 /*
00024    This file is based on the old file:
00025     /home/kde/koffice/filters/kword/ascii/asciiexport.cc
00026 
00027    The old file was copyrighted by
00028     Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00029     Copyright (c) 2000 ID-PRO Deutschland GmbH. All rights reserved.
00030                        Contact: Wolf-Michael Bolle <Bolle@ID-PRO.de>
00031 
00032    The old file was licensed under the terms of the GNU Library General Public
00033    License version 2.
00034 */
00035 
00036 #include <kdebug.h>
00037 #include <kgenericfactory.h>
00038 #include <kimageio.h>
00039 #include <KoFilterChain.h>
00040 
00041 #include <KWEFBaseWorker.h>
00042 #include <KWEFKWordLeader.h>
00043 
00044 #include "ExportFilter.h"
00045 
00046 #include <rtfexport.h>
00047 #include <rtfexport.moc>
00048 
00049 typedef KGenericFactory<RTFExport, KoFilter> RTFExportFactory;
00050 K_EXPORT_COMPONENT_FACTORY( librtfexport, RTFExportFactory( "kofficefilters" ) )
00051 
00052 //
00053 // RTFExport
00054 //
00055 
00056 RTFExport::RTFExport(KoFilter *, const char *, const QStringList &) :
00057                      KoFilter() {
00058 }
00059 
00060 KoFilter::ConversionStatus RTFExport::convert( const QCString& from, const QCString& to )
00061 {
00062     if ((from != "application/x-kword") || (to != "text/rtf"))
00063     {
00064         return KoFilter::NotImplemented;
00065     }
00066 
00067     KImageIO::registerFormats();
00068 
00069     RTFWorker* worker=new RTFWorker();
00070 
00071     KWEFKWordLeader* leader=new KWEFKWordLeader(worker);
00072 
00073     if (!leader)
00074     {
00075         kdError(30515) << "Cannot create Worker! Aborting!" << endl;
00076         delete worker;
00077         return KoFilter::StupidError;
00078     }
00079     
00080     KoFilter::ConversionStatus result=leader->convert(m_chain, from,to );
00081 
00082     delete leader;
00083     delete worker;
00084 
00085     return result;
00086 }
00087 
KDE Home | KDE Accessibility Home | Description of Access Keys