File indexing completed on 2024-04-28 16:21:23

0001 /* This file is part of the KDE project
0002    Copyright 2008 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
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 
0020 #ifndef CALLIGRA_SHEETS_FUNCTION_MODULE_REGISTRY
0021 #define CALLIGRA_SHEETS_FUNCTION_MODULE_REGISTRY
0022 
0023 #include <QObject>
0024 
0025 #include <KoGenericRegistry.h>
0026 
0027 #include "sheets_odf_export.h"
0028 #include "FunctionModule.h"
0029 
0030 namespace Calligra
0031 {
0032 namespace Sheets
0033 {
0034 
0035 /**
0036  * \ingroup Plugin
0037  * \ingroup Value
0038  * Registry for function modules.
0039  */
0040 class CALLIGRA_SHEETS_ODF_EXPORT FunctionModuleRegistry : public KoGenericRegistry<FunctionModule*>
0041 {
0042 public:
0043     /**
0044      * Creates the registry and loads the function modules.
0045      */
0046     FunctionModuleRegistry();
0047     ~FunctionModuleRegistry() override;
0048 
0049     /**
0050      * \return the singleton instance
0051      */
0052     static FunctionModuleRegistry* instance();
0053 
0054     /**
0055      * Loads the function modules.
0056      * Depending on their activation state read from the config,
0057      * the modules are added or removed from the registry.
0058      */
0059     void loadFunctionModules();
0060 
0061     /**
0062      * Registers the functions from all modules in the function repository
0063      * and adds their descriptions.
0064      */
0065     void registerFunctions();
0066 
0067 private:
0068     class Private;
0069     Private * const d;
0070 };
0071 
0072 } // namespace Sheets
0073 } // namespace Calligra
0074 
0075 #endif // CALLIGRA_SHEETS_FUNCTION_MODULE_REGISTRY