filters

olefilter.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1999 Werner Trobin <trobin@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
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., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 // The OLEFilter class is the main filtering class. It manages the
00021 // correct handling of the input and output file and provides the
00022 // OLE 2 streams for the real filters (excel97, powerpoint97, winword97)
00023 
00024 #ifndef OLEFILTER_H
00025 #define OLEFILTER_H
00026 
00027 #include <filterbase.h>
00028 #include <KoFilter.h>
00029 #include <klaola.h>
00030 
00031 class KoStore;
00032 
00033 class OLEFilter : public KoEmbeddingFilter {
00034 
00035     Q_OBJECT
00036 
00037 public:
00038     OLEFilter(KoFilter *parent, const char *name, const QStringList&);
00039     virtual ~OLEFilter();
00040 
00041     virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to );
00042 
00043 public slots:
00044     void commSlotDelayStream( const char* delay );
00045     void commSlotShapeID( unsigned int& shapeID );
00046 
00047 protected slots:
00048     // This slot saves the document informations to the KOffice tar storage.
00049     void slotSaveDocumentInformation(
00050         const QString &fullName,
00051         const QString &title,
00052         const QString &company,
00053         const QString &email,
00054         const QString &telephone,
00055         const QString &fax,
00056         const QString &postalCode,
00057         const QString &country,
00058         const QString &city,
00059     const QString &street,
00060     const QString &docTitle,
00061     const QString &docAbstract);
00062 
00063     // This slot saves an embedded Picture to the KOffice tar storage.
00064     void slotSavePic(
00065         const QString &nameIN,
00066         QString &storageId,
00067         const QString &extension,
00068         unsigned int length,
00069         const char *data);
00070 
00071     // This slot saves an embedded object to the KOffice tar storage. Note that
00072     // this only applies to objects within an OLE stream (like embedded WMFs)
00073     // that we want to handle as parts rather than using slotSavePic() since OLE
00074     // objects are handled by us, and a filter need only call slotPart().
00075     void slotSavePart(
00076         const QString &nameIN,
00077         QString &storageId,
00078         QString &mimeType,
00079         const QString &extension,
00080         unsigned int length,
00081         const char *data);
00082 
00083     // Generate a name for a new part to store it in the KOffice tar storage,
00084     // or find the name and type of an existing one.
00085     void slotPart(
00086         const QString &nameIN,
00087         QString &storageId,
00088         QString &mimeType);
00089 
00090     // Get another OLE 2 stream for your filter.
00091     // Attention: You'll have to delete [] the stream.data ptr!
00092     void slotGetStream(const int &handle, myFile &stream);
00093 
00094     // Like above. Note: This method might return the wrong stream
00095     // as the stream names are NOT unique in the OLE 2 file!!!
00096     // (Therefore it's searching only in the current dir)
00097     // Attention: You'll have to delete [] the stream.data ptr!
00098     void slotGetStream(const QString &name, myFile &stream);
00099 
00100 signals:
00101     // Forwarding signals for inter-filter communication
00102     void internalCommShapeID( unsigned int& shapeID );
00103     void internalCommDelayStream( const char* delay );
00104 
00105 private:
00106     // Don't copy or assign me >:)
00107     OLEFilter(const OLEFilter &);
00108     const OLEFilter &operator=(const OLEFilter &);
00109 
00110     // Template method, triggered by embedPart calls
00111     virtual void savePartContents( QIODevice* file );
00112 
00113     void convert( const QCString& mimeTypeHint );
00114     void connectCommon(FilterBase **myFilter);
00115     QCString mimeTypeHelper();
00116 
00117     QMap<QString, QString> imageMap;
00118 
00119     myFile olefile;
00120     int numPic;                      // for the "unique name generation"
00121     KLaola *docfile;                 // used to split up the OLE 2 file
00122 
00123     // Needed for the template method callback savePartContents
00124     const char* m_embeddeeData;
00125     unsigned int m_embeddeeLength;
00126 
00127     bool success;
00128     static const int s_area;
00129 };
00130 
00131 #endif // OLEFILTER_H
KDE Home | KDE Accessibility Home | Description of Access Keys