filters

filterbase.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 // This class is the base class for all the filters (excel97, powerpoint97,
00021 // winword97)
00022 // If you want to write a filter you'll have to derive your class from
00023 // this one.
00024 
00025 #ifndef FILTERBASE_H
00026 #define FILTERBASE_H
00027 
00028 #include <qobject.h>
00029 #include <qdom.h>
00030 #include <qstringlist.h>
00031 
00032 class myFile;
00033 class QCString;
00034 
00035 // Attention: The nameOUT Strings are allocated with new[] in the
00036 //            slots. Therefore you have to delete [] them!
00037 //            If you call slotGetStream you have to delete [] the
00038 //            stream.data prt after use!
00039 class FilterBase : public QObject {
00040 
00041     Q_OBJECT
00042 
00043 public:
00044 
00045     // Default constructor used by subclasses.
00046     FilterBase();
00047     // This filter only ever gets used in error cases, when we could not find a
00048     // real filter. So, pass in the names of the OLE streams making up the item
00049     // item that could not be converted.
00050     FilterBase(QStringList &oleStreams);
00051     virtual ~FilterBase() {}
00052 
00053     // Manages the filtering process
00054     virtual bool filter();
00055 
00056     // override this to return true if you want to return a plain QCString
00057     virtual bool plainString() const { return false; }
00058     // okay -- let's get the QDomDocument
00059     virtual const QDomDocument *const part() { return &m_part; }
00060     // or get the plain QCString ;)
00061     virtual QCString CString() const { return QCString(); }
00062 
00063 signals:
00064     // See olefilter.h for information
00065     void signalSaveDocumentInformation(
00066         const QString &fullName,
00067         const QString &title,
00068         const QString &company,
00069         const QString &email,
00070         const QString &telephone,
00071         const QString &fax,
00072         const QString &postalCode,
00073         const QString &country,
00074         const QString &city,
00075     const QString &street,
00076     const QString &docTitle,
00077     const QString &docAbstract);
00078     void signalSavePic(
00079         const QString &nameIN,
00080         QString &storageId,
00081         const QString &extension,
00082         unsigned int length,
00083         const char *data);
00084     void signalSavePart(
00085         const QString &nameIN,
00086         QString &storageId,
00087         QString &mimeType,
00088         const QString &extension,
00089         unsigned int length,
00090         const char *data);
00091     void signalPart(const QString& nameIN, QString &storageId, QString &mimeType);
00092     void signalGetStream(const int &handle, myFile &stream);
00093     // Note: might return wrong stream as names are NOT unique!!!
00094     // (searching only in current dir)
00095     void signalGetStream(const QString &name, myFile &stream);
00096     void sigProgress(int value);
00097 
00098 protected:
00099     bool m_success;        // ok, the filtering process was successful
00100     bool m_ready;          // filtering took place, you may fetch the file now
00101     QDomDocument m_part;   // this represents the part (document)
00102 
00103 private:
00104     // Don't copy or assign me...
00105     FilterBase(const FilterBase &);
00106     const FilterBase &operator=(const FilterBase &);
00107     QStringList m_oleStreams;
00108 };
00109 #endif // FILTERBASE_H
KDE Home | KDE Accessibility Home | Description of Access Keys