You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/filters/olefilters/lib/filterbase.h

111 lines
3.7 KiB

/* 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