lib Library API Documentation

koQueryTrader.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@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 #ifndef __ko_query_trader_h__
00021 #define __ko_query_trader_h__
00022 
00023 #include <kservice.h>
00024 #include <ksharedptr.h>
00025 #include <qvaluelist.h>
00026 
00027 class QObject;
00028 class QStringList;
00029 class KoDocument;
00030 class KoFilter;
00031 class KoFilterChain;
00032 
00037 class KoDocumentEntry
00038 {
00039 
00040 public:
00041   KoDocumentEntry() { m_service = 0L; } // for QValueList
00042   KoDocumentEntry( KService::Ptr service );
00043   ~KoDocumentEntry() { }
00044 
00045   KService::Ptr service() const { return m_service; }
00046 
00050   bool isEmpty() const { return m_service == 0L; }
00051 
00055   QString name() const { return m_service->name(); }
00056 
00060   QStringList mimeTypes() const { return m_service->serviceTypes(); }
00061 
00065   bool supportsMimeType( const QString & _mimetype ) const
00066   { return mimeTypes().contains( _mimetype ); }
00067 
00072   KoDocument* createDoc( KoDocument* parent = 0, const char* name = 0 ) const;
00073 
00082   static QValueList<KoDocumentEntry> query( const QString &  _constr = QString::null );
00083 
00095   // MERGE WITH ABOVE METHODE WHEN BIC CHANGES ARE ALLOWED
00096   static QValueList<KoDocumentEntry> query( bool _onlyDocEmb,const QString& _constr);
00097   /* this is how the signature should be looking after merging
00098   static QValueList<KoDocumentEntry> query( bool _onlyDocEmb =true,const QString& _constr = QString::null );
00099   */
00100 
00101 
00108   static KoDocumentEntry queryByMimeType( const QString & mimetype );
00109 
00110 private:
00111   KService::Ptr m_service;
00112 };
00113 
00117 class KoFilterEntry : public KShared
00118 {
00119 
00120 public:
00121   typedef KSharedPtr<KoFilterEntry> Ptr;
00122 
00123   KoFilterEntry() : weight( 0 ) { m_service = 0L; } // for QValueList
00124   KoFilterEntry( KService::Ptr service );
00125   ~KoFilterEntry() { }
00126 
00127   KoFilter* createFilter( KoFilterChain* chain, QObject* parent = 0, const char* name = 0 );
00128 
00132   QStringList import;
00133 
00137   QStringList export_;
00138 
00142   unsigned int weight;
00143 
00147   QString available;
00148 
00152   bool imports( const QString& _mimetype ) const
00153   { return ( import.contains( _mimetype ) ); }
00154 
00158   bool exports( const QString& _m ) const
00159   { return ( export_.contains( _m ) ); }
00160 
00168   static QValueList<KoFilterEntry::Ptr> query( const QString& _constr = QString::null );
00169 
00170   KService::Ptr service() const { return m_service; }
00171 
00172 private:
00173   KService::Ptr m_service;
00174 };
00175 
00176 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:24 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003