lateximport.cpp
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include <lateximport.h>
21#include <lateximport.moc>
22#include <kdebug.h>
23#include <KoFilterChain.h>
24#include <kgenericfactory.h>
25#include <tdeglobal.h>
26#include <tdelocale.h>
27#include <tqtextcodec.h>
28#include "lateximportdia.h"
29
30typedef KGenericFactory<LATEXImport, KoFilter> LATEXImportFactory;
31K_EXPORT_COMPONENT_FACTORY( libkwordlateximport, LATEXImportFactory( "kofficefilters" ) )
32
33
34LATEXImport::LATEXImport(KoFilter *, const char *, const TQStringList&) :
35 KoFilter() {
36}
37
38KoFilter::ConversionStatus LATEXImport::convert( const TQCString& from, const TQCString& to )
39{
40 TQString config;
41
42 if(from != "text/x-tex" || to != "application/x-kword")
43 return KoFilter::NotImplemented;
44
45 KoStore* out = KoStore::createStore(TQString(m_chain->outputFile()),
46 KoStore::Write, "application/x-kword");
47 /*if(!out || !out->open("root")) {
48 kdError(30503) << "Unable to open output file!" << endl;
49 delete out;
50 return KoFilter::FileNotFound;
51 }
52
53 out->close();*/
54
55 LATEXImportDia* dialog = new LATEXImportDia(out);
56 dialog->setInputFile(m_chain->inputFile());
57
58 dialog->exec();
59 delete dialog;
60 delete out;
61
62 return KoFilter::OK;
63}
64