1 | /* This file is part of the KDE project |
2 | Copyright (C) 2003,2004 Ariya Hidayat <ariya@kde.org> |
3 | Copyright (C) 2005 Tomas Mecir <mecirt@gmail.com> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; only |
8 | version 2 of the License. |
9 | |
10 | This library 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 GNU |
13 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | |
22 | #ifndef CALLIGRA_SHEETS_FUNCTION_REPOSITORY |
23 | #define CALLIGRA_SHEETS_FUNCTION_REPOSITORY |
24 | |
25 | #include <QSharedPointer> |
26 | #include <QStringList> |
27 | |
28 | #include "calligra_sheets_export.h" |
29 | |
30 | namespace Calligra |
31 | { |
32 | namespace Sheets |
33 | { |
34 | class Function; |
35 | class FunctionDescription; |
36 | |
37 | /** |
38 | * \ingroup Value |
39 | * The function repository. |
40 | */ |
41 | class CALLIGRA_SHEETS_ODF_EXPORT FunctionRepository |
42 | { |
43 | public: |
44 | FunctionRepository(); |
45 | ~FunctionRepository(); |
46 | |
47 | static FunctionRepository *self(); |
48 | |
49 | /** |
50 | * Adds \p function to the repository. |
51 | */ |
52 | void add(const QSharedPointer<Function>& function); |
53 | void add(FunctionDescription *desc); |
54 | |
55 | /** |
56 | * Removes \p function from the repository. |
57 | * The Function object and the appropriate description will be destroyed. |
58 | */ |
59 | void remove(const QSharedPointer<Function>& function); |
60 | |
61 | QSharedPointer<Function> function(const QString& name); |
62 | |
63 | FunctionDescription *functionInfo(const QString& name); |
64 | |
65 | /** return functions within a group, or all if no group given */ |
66 | QStringList functionNames(const QString& group = QString()); |
67 | |
68 | const QStringList &groups() const; |
69 | void addGroup(const QString& groupname); |
70 | |
71 | /** |
72 | * Loads function descriptions from an XML file. |
73 | */ |
74 | void loadFunctionDescriptions(const QString& filename); |
75 | |
76 | private: |
77 | |
78 | class Private; |
79 | Private * const d; |
80 | |
81 | // no copy or assign |
82 | FunctionRepository(const FunctionRepository&); |
83 | FunctionRepository& operator=(const FunctionRepository&); |
84 | }; |
85 | |
86 | } // namespace Sheets |
87 | } // namespace Calligra |
88 | |
89 | #endif // CALLIGRA_SHEETS_FUNCTION_REPOSITORY |
90 | |