Basic openoffice.org control, and listening for new presentation documents, still...
[kworship.git] / kworship / KwFilterManager.h
blobad4657d354a679f71a7617d025362590f5973f6f
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwFilterManager_h_
21 #define _KwFilterManager_h_
23 /**
24 * @file KwFilterManager.h
25 * @brief Manages file filters.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwExport.h"
31 #include <QList>
32 #include <QHash>
33 #include <QStringList>
35 class KwImportFilter;
36 class KwExportFilter;
37 class KwLoadSaveFilter;
39 /// Manages file filter.
40 class KWMAIN_EXPORT KwFilterManager
42 public:
45 * Constructors + destructor
48 /// Primary constructor.
49 KwFilterManager();
51 /// Destructor.
52 virtual ~KwFilterManager();
55 * Main interface
58 /// Add a load save filter.
59 void addLoadSaveFilter(KwLoadSaveFilter* loadSaveFilter, bool makeDefault = false);
61 /// Add an import filter.
62 void addImportFilter(KwImportFilter* importFilter);
64 /// Add an export filter.
65 void addExportFilter(KwExportFilter* exportFilter);
67 /// Get load mime types.
68 QStringList loadMimeTypes() const;
70 /// Get save mime types.
71 QStringList saveMimeTypes() const;
73 /// Get import mime types.
74 QStringList importMimeTypes() const;
76 /// Get export mime types.
77 QStringList exportMimeTypes() const;
79 /// Get the default save mime type.
80 const QString& defaultSaveMimeType() const;
82 /// Get the load filter for a mime type.
83 KwLoadSaveFilter* loadFilterFromMimeType(const QString& mimeType);
85 /// Get the save filter for a mime type.
86 KwLoadSaveFilter* saveFilterFromMimeType(const QString& mimeType);
88 /// Get the import filter for a mime type.
89 KwImportFilter* importFilterFromMimeType(const QString& mimeType);
91 /// Get the export filter for a mime type.
92 KwExportFilter* exportFilterFromMimeType(const QString& mimeType);
94 private:
97 * Variables
100 /// Default load save filter.
101 KwLoadSaveFilter* m_defaultLoadSaveFilter;
103 /// List of load save filters.
104 QList<KwLoadSaveFilter*> m_loadSaveFilters;
106 /// List of import filters.
107 QList<KwImportFilter*> m_importFilters;
109 /// List of export filters.
110 QList<KwExportFilter*> m_exportFilters;
112 /// Hash of filters for each load mime type.
113 QHash<QString, KwLoadSaveFilter*> m_loadMimeFilters;
115 /// Hash of filters for each save mime type.
116 QHash<QString, KwLoadSaveFilter*> m_saveMimeFilters;
118 /// Hash of filters for each import mime type.
119 QHash<QString, KwImportFilter*> m_importMimeFilters;
121 /// Hash of filters for each export mime type.
122 QHash<QString, KwExportFilter*> m_exportMimeFilters;
124 /// Default save mime type.
125 QString m_defaultSaveMimeType;
128 #endif // _KwFilterManager_h_