lib Library API Documentation

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 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __koffice_filter_manager_h__
00022 #define __koffice_filter_manager_h__
00023 
00024 #include <qobject.h>
00025 #include <qmap.h>
00026 #include <koFilterChain.h>
00027 
00028 class KoDocument;
00029 
00043 class KoFilterManager : public QObject
00044 {
00045     Q_OBJECT
00046 public:
00050     enum Direction { Import = 1,  Export = 2 };
00051 
00055     KoFilterManager( KoDocument* document );
00070     KoFilterManager( const QString& url, const QCString& mimetypeHint = "",
00071                      KoFilterChain* const parentChain = 0 );
00072 
00073     virtual ~KoFilterManager();
00074 
00082     QString import( const QString& url, KoFilter::ConversionStatus& status );
00089     KoFilter::ConversionStatus exp0rt( const QString& url, QCString& mimeType );
00090 
00091 
00092     // ### Static API ###
00098     static QStringList mimeFilter( const QCString& mimetype, Direction direction );
00099 
00107     static QStringList mimeFilter();
00108 
00113     static bool filterAvailable( KoFilterEntry::Ptr entry );
00114 
00115 signals:
00116     void sigProgress( int );
00117 
00118 private:
00119     // ### API for KoFilterChains ### (internal)
00120     // The friend methods are private in KoFilterChain and
00121     // just forward calls to the methods here. Should be
00122     // pretty save.
00123     friend QString KoFilterChain::filterManagerImportFile() const;
00124     QString importFile() const { return m_importUrl; }
00125     friend QString KoFilterChain::filterManagerExportFile() const;
00126     QString exportFile() const { return m_exportUrl; }
00127     friend KoDocument* KoFilterChain::filterManagerKoDocument() const;
00128     KoDocument* document() const { return m_document; }
00129     friend int KoFilterChain::filterManagerDirection() const;
00130     int direction() const { return static_cast<int>( m_direction ); }
00131     friend KoFilterChain* const KoFilterChain::filterManagerParentChain() const;
00132     KoFilterChain* const parentChain() const { return m_parentChain; }
00133 
00134     // Private API
00135     KoFilterManager( const KoFilterManager& rhs );
00136     KoFilterManager &operator=( const KoFilterManager& rhs );
00137 
00138     void importErrorHelper( const QString& mimeType, const bool suppressDialog = false );
00139 
00140     static const int s_area;
00141 
00142     KoDocument* m_document;
00143     KoFilterChain* const m_parentChain;
00144     QString m_importUrl, m_exportUrl;
00145     QCString m_importUrlMimetypeHint;  // suggested mimetype
00146     KOffice::Graph m_graph;
00147     Direction m_direction;
00148 
00149     // A static cache for the availability checks of filters
00150     static QMap<QString, bool> m_filterAvailable;
00151 
00152     // unused right now
00153     class Private;
00154     Private *d;
00155 };
00156 
00157 #endif  // __koffice_filter_manager_h__
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Mar 20 14:25:25 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003