filterbase.h
1/* This file is part of the KDE project
2 Copyright (C) 1999 Werner Trobin <trobin@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20// This class is the base class for all the filters (excel97, powerpoint97,
21// winword97)
22// If you want to write a filter you'll have to derive your class from
23// this one.
24
25#ifndef FILTERBASE_H
26#define FILTERBASE_H
27
28#include <tqobject.h>
29#include <tqdom.h>
30#include <tqstringlist.h>
31
32class myFile;
33class TQCString;
34
35// Attention: The nameOUT Strings are allocated with new[] in the
36// slots. Therefore you have to delete [] them!
37// If you call slotGetStream you have to delete [] the
38// stream.data prt after use!
39class FilterBase : public TQObject {
40
41 TQ_OBJECT
42
43
44public:
45
46 // Default constructor used by subclasses.
47 FilterBase();
48 // This filter only ever gets used in error cases, when we could not find a
49 // real filter. So, pass in the names of the OLE streams making up the item
50 // item that could not be converted.
51 FilterBase(TQStringList &oleStreams);
52 virtual ~FilterBase() {}
53
54 // Manages the filtering process
55 virtual bool filter();
56
57 // override this to return true if you want to return a plain TQCString
58 virtual bool plainString() const { return false; }
59 // okay -- let's get the TQDomDocument
60 virtual const TQDomDocument *const part() { return &m_part; }
61 // or get the plain TQCString ;)
62 virtual TQCString CString() const { return TQCString(); }
63
64signals:
65 // See olefilter.h for information
66 void signalSaveDocumentInformation(
67 const TQString &fullName,
68 const TQString &title,
69 const TQString &company,
70 const TQString &email,
71 const TQString &telephone,
72 const TQString &fax,
73 const TQString &postalCode,
74 const TQString &country,
75 const TQString &city,
76 const TQString &street,
77 const TQString &docTitle,
78 const TQString &docAbstract);
79 void signalSavePic(
80 const TQString &nameIN,
81 TQString &storageId,
82 const TQString &extension,
83 unsigned int length,
84 const char *data);
85 void signalSavePart(
86 const TQString &nameIN,
87 TQString &storageId,
88 TQString &mimeType,
89 const TQString &extension,
90 unsigned int length,
91 const char *data);
92 void signalPart(const TQString& nameIN, TQString &storageId, TQString &mimeType);
93 void signalGetStream(const int &handle, myFile &stream);
94 // Note: might return wrong stream as names are NOT unique!!!
95 // (searching only in current dir)
96 void signalGetStream(const TQString &name, myFile &stream);
97 void sigProgress(int value);
98
99protected:
100 bool m_success; // ok, the filtering process was successful
101 bool m_ready; // filtering took place, you may fetch the file now
102 TQDomDocument m_part; // this represents the part (document)
103
104private:
105 // Don't copy or assign me...
106 FilterBase(const FilterBase &);
107 const FilterBase &operator=(const FilterBase &);
108 TQStringList m_oleStreams;
109};
110#endif // FILTERBASE_H