kugarnopimport.cpp
1/***************************************************************************
2 kugarnopimport.cpp - description
3 -------------------
4 copyright : (C) 2002 by Joseph Wenninger
5 email : jowenn@kde.org
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License verstion 2 as *
12 * published by the Free Software Foundation *
13 * *
14 ***************************************************************************/
15
16#include "kugarnopimport.h"
17#include "kugarnopimport.moc"
18#include <KoFilterChain.h>
19#include <kgenericfactory.h>
20#include <kdebug.h>
21#include <tqfile.h>
22#include "KoDocument.h"
23#include <tqdom.h>
24
25typedef KGenericFactory<KugarNOPImport, KoFilter> KugarNOPImportFactory;
26K_EXPORT_COMPONENT_FACTORY( libkugarnopimport, KugarNOPImportFactory( "kugarnopimport" ) )
27
28
29KugarNOPImport::KugarNOPImport( KoFilter *, const char *, const TQStringList& )
30 : KoFilter()
31{
32}
33
34KoFilter::ConversionStatus KugarNOPImport::convert( const TQCString& /*from*/, const TQCString& /*to*/ )
35{
36
37 TQFile in( m_chain->inputFile());
38 if (!in.open( IO_ReadOnly ))
39 {
40 kdError() << "Unable to open input file!" << endl;
41 in.close();
42 return KoFilter::FileNotFound;
43 }
44
45 KoDocument *doc=m_chain->outputDocument();
46 doc->loadXML(&in,TQDomDocument());
47 in.close();
48 doc->resetURL();
49
50 return KoFilter::OK;
51}