lib

KoQueryTrader.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@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#ifndef __ko_query_trader_h__
21#define __ko_query_trader_h__
22
23#include <kservice.h>
24#include <ksharedptr.h>
25#include <tqvaluelist.h>
26#include <koffice_export.h>
27
28class TQObject;
29class TQStringList;
30class KoDocument;
31class KoFilter;
32class KoFilterChain;
33
38class KOFFICECORE_EXPORT KoDocumentEntry
39{
40
41public:
42 KoDocumentEntry() { m_service = 0L; } // for TQValueList
43 KoDocumentEntry( KService::Ptr service );
44 ~KoDocumentEntry() { }
45
46 KService::Ptr service() const { return m_service; }
47
51 bool isEmpty() const { return m_service == 0L; }
52
56 TQString name() const { return m_service->name(); }
57
61 TQStringList mimeTypes() const { return m_service->serviceTypes(); }
62
66 bool supportsMimeType( const TQString & _mimetype ) const
67 { return mimeTypes().contains( _mimetype ); }
68
73 KoDocument* createDoc( KoDocument* parent = 0, const char* name = 0 ) const;
74
83 static TQValueList<KoDocumentEntry> query( const TQString & _constr = TQString() );
84
96 // ### TODO: MERGE WITH ABOVE METHODE WHEN BIC+SIC CHANGES ARE ALLOWED
97 static TQValueList<KoDocumentEntry> query( bool _onlyDocEmb,const TQString& _constr);
98 /* this is how the signature should be looking after merging
99 static TQValueList<KoDocumentEntry> query( bool _onlyDocEmb =true, const TQString& _constr = TQString() );
100 or better: use an enum for the first arg.
101 */
102
103
110 static KoDocumentEntry queryByMimeType( const TQString & mimetype );
111
112private:
113 KService::Ptr m_service;
114};
115
119class KoFilterEntry : public TDEShared
120{
121
122public:
123 typedef TDESharedPtr<KoFilterEntry> Ptr;
124
125 KoFilterEntry() : weight( 0 ) { m_service = 0L; } // for TQValueList
126 KoFilterEntry( KService::Ptr service );
127 ~KoFilterEntry() { }
128
129 KoFilter* createFilter( KoFilterChain* chain, TQObject* parent = 0, const char* name = 0 );
130
134 TQStringList import;
135
139 TQStringList export_;
140
144 unsigned int weight;
145
149 TQString available;
150
154 bool imports( const TQString& _mimetype ) const
155 { return ( import.contains( _mimetype ) ); }
156
160 bool exports( const TQString& _m ) const
161 { return ( export_.contains( _m ) ); }
162
170 static TQValueList<KoFilterEntry::Ptr> query( const TQString& _constr = TQString() );
171
172 KService::Ptr service() const { return m_service; }
173
174private:
175 KService::Ptr m_service;
176};
177
178#endif
Represents an available KOffice component that supports the document interface.
bool isEmpty() const
bool supportsMimeType(const TQString &_mimetype) const
TQStringList mimeTypes() const
Mimetypes (and other service types) which this document can handle.
TQString name() const
The KOffice document class.
Definition KoDocument.h:61
This class represents a chain of plain KoFilter instances.
bool imports(const TQString &_mimetype) const
static TQValueList< KoFilterEntry::Ptr > query(const TQString &_constr=TQString())
This function will query KDED to find all available filters.
TQString available
Do we have to check during runtime?
bool exports(const TQString &_m) const
unsigned int weight
The "weight" of this filter path.
TQStringList export_
The exported mimetype(s).
The base class for import and export filters.
Definition KoFilter.h:50