File indexing completed on 2024-05-12 16:34:59

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2010 Thomas Zander <zander@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 #ifndef TEXTEDITINGPLUGINCONTAINER_H
0020 #define TEXTEDITINGPLUGINCONTAINER_H
0021 
0022 #include <QObject>
0023 #include <QHash>
0024 #include <QString>
0025 #include <QVariant>
0026 
0027 class KoTextEditingPlugin;
0028 
0029 /// This class holds on to the text editing plugins.
0030 /// the goal of this class is to have one plugin instance per calligra-document
0031 /// instead of one per tool.
0032 class TextEditingPluginContainer : public QObject
0033 {
0034     Q_OBJECT
0035 public:
0036     enum ResourceManagerId {
0037         ResourceId = 345681743
0038     };
0039 
0040     explicit TextEditingPluginContainer(QObject *parent = 0);
0041     ~TextEditingPluginContainer() override;
0042 
0043     KoTextEditingPlugin *spellcheck() const;
0044 
0045     KoTextEditingPlugin *plugin(const QString &pluginId) const {
0046         if (m_textEditingPlugins.contains(pluginId)) {
0047             return m_textEditingPlugins.value(pluginId);
0048         }
0049         return 0;
0050     }
0051 
0052     QList<KoTextEditingPlugin*> values() const {
0053         return m_textEditingPlugins.values();
0054     }
0055 
0056 private:
0057     QHash<QString, KoTextEditingPlugin*> m_textEditingPlugins;
0058 };
0059 
0060 Q_DECLARE_METATYPE(TextEditingPluginContainer*)
0061 
0062 #endif