lib

KoFilterManager.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 2000, 2001 Werner Trobin <trobin@kde.org>
4 Copyright (C) 2004 Nicolas Goutte <goutte@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef __koffice_filter_manager_h__
23#define __koffice_filter_manager_h__
24
25#include <tqobject.h>
26#include <tqmap.h>
27#include <KoFilterChain.h>
28#include <koffice_export.h>
29class KoDocument;
30
44class KOFFICECORE_EXPORT KoFilterManager : public TQObject
45{
46 TQ_OBJECT
47
48public:
52 enum Direction { Import = 1, Export = 2 };
53
57 KoFilterManager( KoDocument* document );
72 KoFilterManager( const TQString& url, const TQCString& mimetypeHint = "",
73 KoFilterChain* const parentChain = 0 );
74
75 virtual ~KoFilterManager();
76
84 TQString import( const TQString& url, KoFilter::ConversionStatus& status );
92 KoFilter::ConversionStatus exp0rt( const TQString& url, TQCString& mimeType );
93
94
95
97
98
104 KOFFICECORE_EXPORT static TQStringList mimeFilter( const TQCString& mimetype, Direction direction,
105 const TQStringList& extraNativeMimeTypes = TQStringList() );
106
114 static TQStringList mimeFilter();
115
120 static bool filterAvailable( KoFilterEntry::Ptr entry );
121
123
129 void setBatchMode ( const bool batch );
130
136 bool getBatchMode ( void ) const;
137
138signals:
139 void sigProgress( int );
140
141private:
142 // === API for KoFilterChains === (internal)
143 // The friend methods are private in KoFilterChain and
144 // just forward calls to the methods here. Should be
145 // pretty save.
146 friend TQString KoFilterChain::filterManagerImportFile() const;
147 TQString importFile() const { return m_importUrl; }
148 friend TQString KoFilterChain::filterManagerExportFile() const;
149 TQString exportFile() const { return m_exportUrl; }
150 friend KoDocument* KoFilterChain::filterManagerKoDocument() const;
151 KoDocument* document() const { return m_document; }
152 friend int KoFilterChain::filterManagerDirection() const;
153 int direction() const { return static_cast<int>( m_direction ); }
154 friend KoFilterChain* const KoFilterChain::filterManagerParentChain() const;
155 KoFilterChain* const parentChain() const { return m_parentChain; }
156
157 // Private API
158 KoFilterManager( const KoFilterManager& rhs );
159 KoFilterManager &operator=( const KoFilterManager& rhs );
160
161 void importErrorHelper( const TQString& mimeType, const bool suppressDialog = false );
162
163 static const int s_area;
164
165 KoDocument* m_document;
166 KoFilterChain* const m_parentChain;
167 TQString m_importUrl, m_exportUrl;
168 TQCString m_importUrlMimetypeHint;
169 KOffice::Graph m_graph;
170 Direction m_direction;
171
173 static TQMap<TQString, bool> m_filterAvailable;
174
175 class Private;
176 Private *d;
177};
178
179#endif // __koffice_filter_manager_h__
The KOffice document class.
Definition KoDocument.h:61
This class represents a chain of plain KoFilter instances.
The class managing all the filters.
Direction
This enum is used to distinguish the import/export cases.
KoFilterManager(KoDocument *document)
Create a filter manager for a document.
ConversionStatus
This enum is used to signal the return state of your filter.
Definition KoFilter.h:64