1 | /* This file is part of the KDE project |
2 | Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net> |
3 | Copyright 2007 Thorsten Zachmann <zachmann@kde.org> |
4 | Copyright 2004 Ariya Hidayat <ariya@kde.org> |
5 | Copyright 2002-2003 Norbert Andres <nandres@web.de> |
6 | Copyright 2000-2005 Laurent Montel <montel@kde.org> |
7 | Copyright 2002 John Dailey <dailey@vt.edu> |
8 | Copyright 2002 Phillip Mueller <philipp.mueller@gmx.de> |
9 | Copyright 2000 Werner Trobin <trobin@kde.org> |
10 | Copyright 1999-2000 Simon Hausmann <hausmann@kde.org> |
11 | Copyright 1999 David Faure <faure@kde.org> |
12 | Copyright 1998-2000 Torben Weis <weis@kde.org> |
13 | |
14 | This library is free software; you can redistribute it and/or |
15 | modify it under the terms of the GNU Library General Public |
16 | License as published by the Free Software Foundation; either |
17 | version 2 of the License, or (at your option) any later version. |
18 | |
19 | This library is distributed in the hope that it will be useful, |
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 | Library General Public License for more details. |
23 | |
24 | You should have received a copy of the GNU Library General Public License |
25 | along with this library; see the file COPYING.LIB. If not, write to |
26 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 | Boston, MA 02110-1301, USA. |
28 | */ |
29 | |
30 | #ifndef CALLIGRA_SHEETS_CALCULATION_SETTINGS |
31 | #define CALLIGRA_SHEETS_CALCULATION_SETTINGS |
32 | |
33 | #include "calligra_sheets_export.h" |
34 | |
35 | #include <KoXmlReader.h> |
36 | |
37 | #include <QDate> |
38 | |
39 | class KLocale; |
40 | |
41 | class KoXmlWriter; |
42 | |
43 | namespace Calligra |
44 | { |
45 | namespace Sheets |
46 | { |
47 | |
48 | /** |
49 | * Calculation settings |
50 | * \ingroup Value |
51 | */ |
52 | class CALLIGRA_SHEETS_ODF_EXPORT CalculationSettings |
53 | { |
54 | public: |
55 | /** |
56 | * Constructor. |
57 | */ |
58 | CalculationSettings(); |
59 | |
60 | /** |
61 | * Destructor. |
62 | */ |
63 | ~CalculationSettings(); |
64 | |
65 | /** |
66 | * \ingroup OpenDocument |
67 | */ |
68 | void loadOdf(const KoXmlElement& body); |
69 | |
70 | /** |
71 | * \ingroup OpenDocument |
72 | */ |
73 | bool saveOdf(KoXmlWriter &settingsWriter) const; |
74 | |
75 | /** |
76 | * A document could use a different localization as the KDE default. |
77 | * @return the KLocale associated with this document |
78 | */ |
79 | KLocale *locale() const; |
80 | |
81 | /** |
82 | * Sets the reference year. |
83 | * |
84 | * \param year the new reference year |
85 | */ |
86 | void setReferenceYear(int year); |
87 | |
88 | /** |
89 | * Returns the reference year all two-digit-year dates are stored relative to. |
90 | * |
91 | * This defines how to convert a two-digit year into a four-digit year. All |
92 | * two-digit year values are interpreted as a year that equals or follows this year. |
93 | * |
94 | * \return the reference year (default: 1930) |
95 | */ |
96 | int referenceYear() const; |
97 | |
98 | /** |
99 | * Sets the reference date. |
100 | * All dates are stored as numbers relative to a reference date. |
101 | * |
102 | * \param date the new reference date |
103 | */ |
104 | void setReferenceDate(const QDate& date); |
105 | |
106 | /** |
107 | * Returns the reference date all date are stored relative to. |
108 | * |
109 | * \return the reference date (default: 1899-12-30) |
110 | */ |
111 | QDate referenceDate() const; |
112 | |
113 | void setPrecisionAsShown(bool enable); |
114 | bool precisionAsShown() const; |
115 | |
116 | /** |
117 | * Sets the default decimal precision. |
118 | * It is used to format decimal numbers, if the cell style does not define |
119 | * one. |
120 | * |
121 | * \param precision the default decimal precision |
122 | */ |
123 | void setDefaultDecimalPrecision(int precision); |
124 | |
125 | /** |
126 | * Returns the default decimal precision, which is used, if the cell style |
127 | * does not define one. |
128 | * |
129 | * \return the default decimal precision |
130 | */ |
131 | int defaultDecimalPrecision() const; |
132 | |
133 | /** |
134 | * Sets the file name used in the FILENAME function. |
135 | */ |
136 | void setFileName(const QString& fileName); |
137 | |
138 | /** |
139 | * \return The file name used in the FILENAME function. |
140 | */ |
141 | const QString& fileName() const; |
142 | |
143 | /** |
144 | * Sets the activation state of the active sheet's automatic recalculation |
145 | * setting. |
146 | * Used in the INFO function. |
147 | */ |
148 | void setAutoCalculationEnabled(bool enable); |
149 | |
150 | /** |
151 | * Returns the activation state of the active sheet's automatic |
152 | * recalculation setting. |
153 | * Used in the INFO function. |
154 | * |
155 | * \return the activation state |
156 | */ |
157 | bool isAutoCalculationEnabled() const; |
158 | |
159 | void setAutomaticFindLabels(bool enabled); |
160 | bool automaticFindLabels() const; |
161 | |
162 | /** |
163 | * Sets the comparisons on this document to be case sensitive or not. |
164 | */ |
165 | void setCaseSensitiveComparisons(Qt::CaseSensitivity caseSensitive); |
166 | |
167 | /** |
168 | * Returns whether comparisons in this document are case sensitive. |
169 | */ |
170 | Qt::CaseSensitivity caseSensitiveComparisons() const; |
171 | |
172 | void setWholeCellSearchCriteria(bool enabled); |
173 | bool wholeCellSearchCriteria() const; |
174 | |
175 | /** |
176 | * If true, regular expressions are used for character string |
177 | * comparisons and when searching. |
178 | * |
179 | * This option is mutually exclusive with \a useWildcards but |
180 | * calling this method will not call \a setUseWildcards and |
181 | * its also not guaranteed that both are not set to true when |
182 | * calling \a loadOdf and the ODF defines both to be true. |
183 | * |
184 | * This is the default character string comparisons mode in ODF. |
185 | */ |
186 | void setUseRegularExpressions(bool enabled); |
187 | bool useRegularExpressions() const; |
188 | |
189 | /** |
190 | * If true, wildcards question mark '?' and asterisk '*' are used for |
191 | * character string comparisons and when searching. Wildcards may be |
192 | * escaped with a tilde '~' character. |
193 | * |
194 | * This is the only comparision mode supported by Excel. |
195 | */ |
196 | void setUseWildcards(bool enabled); |
197 | bool useWildcards() const; |
198 | |
199 | private: |
200 | class Private; |
201 | Private * const d; |
202 | }; |
203 | |
204 | } // namespace Sheets |
205 | } // namespace Calligra |
206 | |
207 | #endif // CALLIGRA_SHEETS_CALCULATION_SETTINGS |
208 | |