filters

oowriterexport.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002, 2003, 2004 Nicolas GOUTTE <goutte@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/*
21 This file is based on the old file:
22 /home/kde/koffice/filters/kword/ascii/asciiexport.cpp
23
24 The old file was copyrighted by
25 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
26 Copyright (c) 2000 ID-PRO Deutschland GmbH. All rights reserved.
27 Contact: Wolf-Michael Bolle <Bolle@ID-PRO.de>
28
29 The old file was licensed under the terms of the GNU Library General Public
30 License version 2.
31*/
32
33#include <kdebug.h>
34#include <kgenericfactory.h>
35#include <kimageio.h>
36
37#include <KoFilterChain.h>
38
39#include "ExportFilter.h"
40#include "oowriterexport.h"
41
42class OOWRITERExportFactory : KGenericFactory<OOWRITERExport, KoFilter>
43{
44public:
45 OOWRITERExportFactory(void) : KGenericFactory<OOWRITERExport, KoFilter> ("kwordoowriterexport")
46 {}
47};
48
49K_EXPORT_COMPONENT_FACTORY( liboowriterexport, OOWRITERExportFactory() )
50
51OOWRITERExport::OOWRITERExport(KoFilter */*parent*/, const char */*name*/, const TQStringList &) :
52 KoFilter() {
53}
54
55KoFilter::ConversionStatus OOWRITERExport::convert( const TQCString& from, const TQCString& to )
56{
57 if ( to != "application/vnd.sun.xml.writer" || from != "application/x-kword" )
58 {
59 return KoFilter::NotImplemented;
60 }
61
62 // We need KimageIO's help in OOWriterWorker::convertUnknownImage
63 KImageIO::registerFormats();
64
65 OOWriterWorker* worker=new OOWriterWorker();
66
67 if (!worker)
68 {
69 kdError(30506) << "Cannot create Worker! Aborting!" << endl;
70 return KoFilter::StupidError;
71 }
72
73 KWEFKWordLeader* leader=new KWEFKWordLeader(worker);
74
75 if (!leader)
76 {
77 kdError(30506) << "Cannot create Worker! Aborting!" << endl;
78 delete worker;
79 return KoFilter::StupidError;
80 }
81
82 KoFilter::ConversionStatus result=leader->convert(m_chain,from,to);
83
84 delete leader;
85 delete worker;
86
87 return result;
88}
89
90#include "oowriterexport.moc"