F:/KPlato/koffice/libs/kofficecore/KoFilter.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KOffice libraries
00002    Copyright (C) 2001 Werner Trobin <trobin@kde.org>
00003                  2002 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 version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __koffice_filter_h__
00021 #define __koffice_filter_h__
00022 
00023 #include <QObject>
00024 #include <QMap>
00025 #include <q3ptrstack.h>
00026 #include <koffice_export.h>
00027 class QIODevice;
00028 class KoFilterChain;
00029 
00048 class KOFFICECORE_EXPORT KoFilter : public QObject
00049 {
00050     Q_OBJECT
00051 
00052     friend class KoFilterEntry;  // needed for the filter chain pointer :(
00053     friend class KoFilterChain;
00054 
00055 public:
00062     enum ConversionStatus { OK, StupidError, UsageError, CreationError, FileNotFound,
00063                             StorageCreationError, BadMimeType, BadConversionGraph,
00064                             EmbeddedDocError, WrongFormat, NotImplemented,
00065                             ParsingError, InternalError, UnexpectedEOF,
00066                             UnexpectedOpcode, UserCancelled, OutOfMemory,
00067                             PasswordProtected,
00068                             JustInCaseSomeBrokenCompilerUsesLessThanAByte = 255 };
00069 
00070     virtual ~KoFilter();
00071 
00083     virtual ConversionStatus convert( const QByteArray& from, const QByteArray& to ) = 0;
00084 
00085 signals:
00093     void sigProgress( int value );
00094 
00095 protected:
00099     KoFilter( QObject* parent = 0 );
00100 
00106     KoFilterChain* m_chain;
00107 
00108 private:
00109     KoFilter( const KoFilter& rhs );
00110     KoFilter& operator=( const KoFilter& rhs );
00111 
00112     class Private;
00113     Private* d;
00114 };
00115 
00116 
00145 class KOFFICECORE_EXPORT KoEmbeddingFilter : public KoFilter
00146 {
00147     Q_OBJECT
00148 
00149     friend class KoFilterChain;
00150 
00151 public:
00152     virtual ~KoEmbeddingFilter();
00153 
00162     int lruPartIndex() const;
00163 
00170     static QString mimeTypeByExtension( const QString& extension );
00171 
00172 protected:
00177     KoEmbeddingFilter();
00178 
00200     int embedPart( const QByteArray& from, QByteArray& to,
00201                    KoFilter::ConversionStatus& status,
00202                    const QString& key = QString::null );
00203 
00214     void startInternalEmbedding( const QString& key, const QByteArray& mimeType );
00215 
00222     void endInternalEmbedding();
00223 
00233     int internalPartReference( const QString& key ) const;
00234 
00243     QByteArray internalPartMimeType( const QString& key ) const;
00244 
00245 private:
00251     struct PartReference
00252     {
00253         PartReference( int index = -1, const QByteArray& mimeType = "" );
00254         bool isValid() const;
00255 
00256         int m_index;
00257         QByteArray m_mimeType;
00258     };
00259 
00267     struct PartState
00268     {
00269         PartState();
00270 
00271         int m_lruPartIndex;
00272         QMap<QString, PartReference> m_partReferences;
00273     };
00274 
00276     KoEmbeddingFilter( const KoEmbeddingFilter& rhs );
00278     KoEmbeddingFilter& operator=( const KoEmbeddingFilter& rhs );
00279 
00290     virtual void savePartContents( QIODevice* file );
00291 
00297     void filterChainEnterDirectory( const QString& directory ) const;
00303     void filterChainLeaveDirectory() const;
00304 
00309     Q3PtrStack<PartState> m_partStack;
00310 
00311     class Private;
00312     Private* d;
00313 };
00314 
00315 #endif

Généré le Wed Nov 22 23:41:02 2006 pour KPlato par  doxygen 1.5.1-p1