lib

KoFilterManager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003                  2000, 2001 Werner Trobin <trobin@kde.org>
00004    Copyright (C) 2004 Nicolas Goutte <goutte@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef __koffice_filter_manager_h__
00023 #define __koffice_filter_manager_h__
00024 
00025 #include <qobject.h>
00026 #include <qmap.h>
00027 #include <KoFilterChain.h>
00028 #include <koffice_export.h>
00029 class KoDocument;
00030 
00044 class KOFFICECORE_EXPORT KoFilterManager : public QObject
00045 {
00046     Q_OBJECT
00047 public:
00051     enum Direction { Import = 1,  Export = 2 };
00052 
00056     KoFilterManager( KoDocument* document );
00071     KoFilterManager( const QString& url, const QCString& mimetypeHint = "",
00072                      KoFilterChain* const parentChain = 0 );
00073 
00074     virtual ~KoFilterManager();
00075 
00083     QString import( const QString& url, KoFilter::ConversionStatus& status );
00091     KoFilter::ConversionStatus exp0rt( const QString& url, QCString& mimeType );
00092 
00093 
00094 
00096 
00097 
00103     KOFFICECORE_EXPORT static QStringList mimeFilter( const QCString& mimetype, Direction direction,
00104                                                       const QStringList& extraNativeMimeTypes = QStringList() );
00105 
00113     static QStringList mimeFilter();
00114 
00119     static bool filterAvailable( KoFilterEntry::Ptr entry );
00120 
00122 
00128     void setBatchMode ( const bool batch );
00129 
00135     bool getBatchMode ( void ) const;
00136 
00137 signals:
00138     void sigProgress( int );
00139 
00140 private:
00141     // === API for KoFilterChains === (internal)
00142     // The friend methods are private in KoFilterChain and
00143     // just forward calls to the methods here. Should be
00144     // pretty save.
00145     friend QString KoFilterChain::filterManagerImportFile() const;
00146     QString importFile() const { return m_importUrl; }
00147     friend QString KoFilterChain::filterManagerExportFile() const;
00148     QString exportFile() const { return m_exportUrl; }
00149     friend KoDocument* KoFilterChain::filterManagerKoDocument() const;
00150     KoDocument* document() const { return m_document; }
00151     friend int KoFilterChain::filterManagerDirection() const;
00152     int direction() const { return static_cast<int>( m_direction ); }
00153     friend KoFilterChain* const KoFilterChain::filterManagerParentChain() const;
00154     KoFilterChain* const parentChain() const { return m_parentChain; }
00155 
00156     // Private API
00157     KoFilterManager( const KoFilterManager& rhs );
00158     KoFilterManager &operator=( const KoFilterManager& rhs );
00159 
00160     void importErrorHelper( const QString& mimeType, const bool suppressDialog = false );
00161 
00162     static const int s_area;
00163 
00164     KoDocument* m_document;
00165     KoFilterChain* const m_parentChain;
00166     QString m_importUrl, m_exportUrl;
00167     QCString m_importUrlMimetypeHint;  
00168     KOffice::Graph m_graph;
00169     Direction m_direction;
00170 
00172     static QMap<QString, bool> m_filterAvailable;
00173 
00174     class Private;
00175     Private *d;
00176 };
00177 
00178 #endif  // __koffice_filter_manager_h__
KDE Home | KDE Accessibility Home | Description of Access Keys