filters

xsltexport.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 <xsltexport.h>
21
22#include <kdebug.h>
23#include <KoFilterChain.h>
24#include <kgenericfactory.h>
25
26#include <xsltexportdia.h>
27
28typedef KGenericFactory<XSLTExport, KoFilter> XSLTExportFactory;
29K_EXPORT_COMPONENT_FACTORY( libxsltexport, XSLTExportFactory( "kofficefilters" ) )
30
31// Check for XSLT files
32extern "C" {
33 int check_libxsltexport() {
34 return 0;
35 }
36}
37
38
39XSLTExport::XSLTExport(KoFilter *, const char *, const TQStringList&) :
40 KoFilter() {
41}
42
43KoFilter::ConversionStatus XSLTExport::convert( const TQCString& from, const TQCString&)
44{
45 if(from != "application/x-kword" &&
46 from != "application/x-kontour" && from != "application/x-kspread" &&
47 from != "application/x-kivio" && from != "application/x-kchart" &&
48 from != "application/x-kpresenter")
49 return KoFilter::NotImplemented;
50 kdDebug() << "In the xslt filter" << endl;
51
52 KoStoreDevice* in = m_chain->storageFile("root", KoStore::Read);
53
54 if(!in) {
55 kdError() << "Unable to open input file!" << endl;
56 return KoFilter::FileNotFound;
57 }
58
59 XSLTExportDia* dialog = new XSLTExportDia(in, from, 0, "Exportation", true);
60 dialog->setOutputFile(m_chain->outputFile());
61 dialog->exec();
62 delete dialog;
63 return KoFilter::OK;
64}
65
66#include <xsltexport.moc>