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_DESCRIPTION |
23 | #define CALLIGRA_SHEETS_FUNCTION_DESCRIPTION |
24 | |
25 | #include <QList> |
26 | #include <QStringList> |
27 | |
28 | #include "calligra_sheets_export.h" |
29 | |
30 | class QDomElement; |
31 | |
32 | namespace Calligra |
33 | { |
34 | namespace Sheets |
35 | { |
36 | |
37 | enum ParameterType { KSpread_Int, KSpread_Float, KSpread_String, KSpread_Boolean, KSpread_Any, KSpread_Date }; |
38 | |
39 | /** |
40 | * \ingroup Value |
41 | * A function parameter. |
42 | */ |
43 | class CALLIGRA_SHEETS_ODF_EXPORT FunctionParameter |
44 | { |
45 | public: |
46 | FunctionParameter(); |
47 | FunctionParameter(const FunctionParameter& param); |
48 | explicit FunctionParameter(const QDomElement& element); |
49 | |
50 | QString helpText() const { |
51 | return m_help; |
52 | } |
53 | ParameterType type() const { |
54 | return m_type; |
55 | } |
56 | bool hasRange() const { |
57 | return m_range; |
58 | } |
59 | |
60 | private: |
61 | QString m_help; |
62 | ParameterType m_type; |
63 | bool m_range; |
64 | }; |
65 | |
66 | /** |
67 | * \ingroup Value |
68 | * A function description. |
69 | */ |
70 | class CALLIGRA_SHEETS_ODF_EXPORT FunctionDescription |
71 | { |
72 | public: |
73 | FunctionDescription(); |
74 | explicit FunctionDescription(const QDomElement& element); |
75 | FunctionDescription(const FunctionDescription& desc); |
76 | |
77 | const QStringList& examples() { |
78 | return m_examples; |
79 | } |
80 | const QStringList& syntax() { |
81 | return m_syntax; |
82 | } |
83 | const QStringList& related() { |
84 | return m_related; |
85 | } |
86 | const QStringList& helpText() const { |
87 | return m_help; |
88 | } |
89 | QString name() const { |
90 | return m_name; |
91 | } |
92 | ParameterType type() const { |
93 | return m_type; |
94 | } |
95 | |
96 | int params() const { |
97 | return m_params.count(); |
98 | } |
99 | FunctionParameter& param(int i) { |
100 | return m_params[ i ]; |
101 | } |
102 | |
103 | void setGroup(const QString& g) { |
104 | m_group = g; |
105 | } |
106 | QString group() const { |
107 | return m_group; |
108 | } |
109 | |
110 | QString toQML() const; |
111 | |
112 | private: |
113 | QString m_group; |
114 | QStringList m_examples; |
115 | QStringList m_syntax; |
116 | QStringList m_related; |
117 | QStringList m_help; |
118 | QString m_name; |
119 | ParameterType m_type; |
120 | QList<FunctionParameter> m_params; |
121 | }; |
122 | |
123 | } // namespace Sheets |
124 | } // namespace Calligra |
125 | |
126 | #endif // CALLIGRA_SHEETS_FUNCTION_DESCRIPTION |
127 | |