summaryrefslogtreecommitdiffstats
path: root/filters/olefilters/lib/filterbase.h
blob: 8bcae6030e132077141ea585b357bb85f7cde5e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* This file is part of the KDE project
   Copyright (C) 1999 Werner Trobin <trobin@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

// This class is the base class for all the filters (excel97, powerpoint97,
// winword97)
// If you want to write a filter you'll have to derive your class from
// this one.

#ifndef FILTERBASE_H
#define FILTERBASE_H

#include <tqobject.h>
#include <tqdom.h>
#include <tqstringlist.h>

class myFile;
class TQCString;

// Attention: The nameOUT Strings are allocated with new[] in the
//            slots. Therefore you have to delete [] them!
//            If you call slotGetStream you have to delete [] the
//            stream.data prt after use!
class FilterBase : public TQObject {

    TQ_OBJECT
  

public:

    // Default constructor used by subclasses.
    FilterBase();
    // This filter only ever gets used in error cases, when we could not find a
    // real filter. So, pass in the names of the OLE streams making up the item
    // item that could not be converted.
    FilterBase(TQStringList &oleStreams);
    virtual ~FilterBase() {}

    // Manages the filtering process
    virtual bool filter();

    // override this to return true if you want to return a plain TQCString
    virtual bool plainString() const { return false; }
    // okay -- let's get the TQDomDocument
    virtual const TQDomDocument *const part() { return &m_part; }
    // or get the plain TQCString ;)
    virtual TQCString CString() const { return TQCString(); }

signals:
    // See olefilter.h for information
    void signalSaveDocumentInformation(
        const TQString &fullName,
        const TQString &title,
        const TQString &company,
        const TQString &email,
        const TQString &telephone,
        const TQString &fax,
        const TQString &postalCode,
        const TQString &country,
        const TQString &city,
	const TQString &street,
	const TQString &docTitle,
	const TQString &docAbstract);
    void signalSavePic(
        const TQString &nameIN,
        TQString &storageId,
        const TQString &extension,
        unsigned int length,
        const char *data);
    void signalSavePart(
        const TQString &nameIN,
        TQString &storageId,
        TQString &mimeType,
        const TQString &extension,
        unsigned int length,
        const char *data);
    void signalPart(const TQString& nameIN, TQString &storageId, TQString &mimeType);
    void signalGetStream(const int &handle, myFile &stream);
    // Note: might return wrong stream as names are NOT unique!!!
    // (searching only in current dir)
    void signalGetStream(const TQString &name, myFile &stream);
    void sigProgress(int value);

protected:
    bool m_success;        // ok, the filtering process was successful
    bool m_ready;          // filtering took place, you may fetch the file now
    TQDomDocument m_part;   // this represents the part (document)

private:
    // Don't copy or assign me...
    FilterBase(const FilterBase &);
    const FilterBase &operator=(const FilterBase &);
    TQStringList m_oleStreams;
};
#endif // FILTERBASE_H