filters
htmlimport.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <htmlimport.h>
00022 #include <htmlimport.moc>
00023
00024 #include <kdebug.h>
00025 #include <kgenericfactory.h>
00026 #include <KoFilterChain.h>
00027
00028 #include <KoStore.h>
00029
00030 #include <khtmlreader.h>
00031 #include <kwdwriter.h>
00032
00033 typedef KGenericFactory<HTMLImport, KoFilter> HTMLImportFactory;
00034 K_EXPORT_COMPONENT_FACTORY( libhtmlimport, HTMLImportFactory( "kofficefilters" ) )
00035
00036
00037 HTMLImport::HTMLImport(KoFilter *, const char*, const QStringList &) :
00038 KoFilter() {
00039
00040 }
00041
00042 KoFilter::ConversionStatus HTMLImport::convert( const QCString& from, const QCString& to )
00043 {
00044 if(to!="application/x-kword" || from!="text/html")
00045 return KoFilter::NotImplemented;
00046
00047 KoStore *k= KoStore::createStore(m_chain->outputFile(), KoStore::Write, "application/x-kword");
00048 KWDWriter *w= new KWDWriter(k);
00049 KHTMLReader h(w);
00050 KURL url;
00051 url.setPath(m_chain->inputFile());
00052 bool b= h.filter(url);
00053 delete(w);
00054 delete(k);
00055
00056 if ( b )
00057 return KoFilter::OK;
00058 else
00059 return KoFilter::StupidError;
00060 }
|