File indexing completed on 2024-04-28 16:21:23
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003,2004 Ariya Hidayat <ariya@kde.org> 0003 Copyright (C) 2005 Tomas Mecir <mecirt@gmail.com> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; only 0008 version 2 of the License. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 0022 #ifndef CALLIGRA_SHEETS_FUNCTION_REPOSITORY 0023 #define CALLIGRA_SHEETS_FUNCTION_REPOSITORY 0024 0025 #include <QSharedPointer> 0026 #include <QStringList> 0027 0028 #include "sheets_odf_export.h" 0029 0030 namespace Calligra 0031 { 0032 namespace Sheets 0033 { 0034 class Function; 0035 class FunctionDescription; 0036 0037 /** 0038 * \ingroup Value 0039 * The function repository. 0040 */ 0041 class CALLIGRA_SHEETS_ODF_EXPORT FunctionRepository 0042 { 0043 public: 0044 FunctionRepository(); 0045 ~FunctionRepository(); 0046 0047 static FunctionRepository *self(); 0048 0049 /** 0050 * Adds \p function to the repository. 0051 */ 0052 void add(const QSharedPointer<Function>& function); 0053 void add(FunctionDescription *desc); 0054 0055 /** 0056 * Removes \p function from the repository. 0057 * The Function object and the appropriate description will be destroyed. 0058 */ 0059 void remove(const QSharedPointer<Function>& function); 0060 0061 QSharedPointer<Function> function(const QString& name); 0062 0063 FunctionDescription *functionInfo(const QString& name); 0064 0065 /** return functions within a group, or all if no group given */ 0066 QStringList functionNames(const QString& group = QString()); 0067 0068 const QStringList &groups() const; 0069 void addGroup(const QString& groupname); 0070 0071 /** 0072 * Loads function descriptions from an XML file. 0073 */ 0074 void loadFunctionDescriptions(const QString& filename); 0075 0076 private: 0077 0078 class Private; 0079 Private * const d; 0080 0081 // no copy or assign 0082 FunctionRepository(const FunctionRepository&); 0083 FunctionRepository& operator=(const FunctionRepository&); 0084 }; 0085 0086 } // namespace Sheets 0087 } // namespace Calligra 0088 0089 #endif // CALLIGRA_SHEETS_FUNCTION_REPOSITORY