filters

kugarnopimport.cpp

00001 /***************************************************************************
00002                           kugarnopimport.cpp  -  description
00003                              -------------------
00004     copyright            : (C) 2002 by Joseph Wenninger
00005     email                : jowenn@kde.org
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License verstion 2 as    *
00012  *   published by the Free Software Foundation                             *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 #include "kugarnopimport.h"
00017 #include "kugarnopimport.moc"
00018 #include <KoFilterChain.h>
00019 #include <kgenericfactory.h>
00020 #include <kdebug.h>
00021 #include <qfile.h>
00022 #include "KoDocument.h"
00023 #include <qdom.h>
00024 
00025 typedef KGenericFactory<KugarNOPImport, KoFilter> KugarNOPImportFactory;
00026 K_EXPORT_COMPONENT_FACTORY( libkugarnopimport, KugarNOPImportFactory( "kugarnopimport" ) )
00027 
00028 
00029 KugarNOPImport::KugarNOPImport( KoFilter *, const char *, const QStringList& )
00030     : KoFilter()
00031 {
00032 }
00033 
00034 KoFilter::ConversionStatus KugarNOPImport::convert( const QCString& /*from*/, const QCString& /*to*/ )
00035 {
00036 
00037     QFile in( m_chain->inputFile());
00038     if (!in.open( IO_ReadOnly ))
00039     {
00040             kdError() << "Unable to open input file!" << endl;
00041             in.close();
00042             return KoFilter::FileNotFound;
00043     }
00044     
00045     KoDocument *doc=m_chain->outputDocument();
00046     doc->loadXML(&in,QDomDocument());
00047     in.close();
00048     doc->resetURL();
00049 
00050     return KoFilter::OK;
00051 }
KDE Home | KDE Accessibility Home | Description of Access Keys