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

0001 /* This file is part of the KDE project
0002    Copyright 2007 Stefan Nikolaus <stefan.nikolaus@kdemail.net>
0003    Copyright 2007 Thorsten Zachmann <zachmann@kde.org>
0004    Copyright 2004 Ariya Hidayat <ariya@kde.org>
0005    Copyright 2002-2003 Norbert Andres <nandres@web.de>
0006    Copyright 2000-2005 Laurent Montel <montel@kde.org>
0007    Copyright 2002 John Dailey <dailey@vt.edu>
0008    Copyright 2002 Phillip Mueller <philipp.mueller@gmx.de>
0009    Copyright 2000 Werner Trobin <trobin@kde.org>
0010    Copyright 1999-2000 Simon Hausmann <hausmann@kde.org>
0011    Copyright 1999 David Faure <faure@kde.org>
0012    Copyright 1998-2000 Torben Weis <weis@kde.org>
0013 
0014    This library is free software; you can redistribute it and/or
0015    modify it under the terms of the GNU Library General Public
0016    License as published by the Free Software Foundation; either
0017    version 2 of the License, or (at your option) any later version.
0018 
0019    This library is distributed in the hope that it will be useful,
0020    but WITHOUT ANY WARRANTY; without even the implied warranty of
0021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0022    Library General Public License for more details.
0023 
0024    You should have received a copy of the GNU Library General Public License
0025    along with this library; see the file COPYING.LIB.  If not, write to
0026    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0027    Boston, MA 02110-1301, USA.
0028 */
0029 
0030 #ifndef CALLIGRA_SHEETS_CALCULATION_SETTINGS
0031 #define CALLIGRA_SHEETS_CALCULATION_SETTINGS
0032 
0033 #include "sheets_odf_export.h"
0034 
0035 #include <QDate>
0036 
0037 class KLocale;
0038 
0039 namespace Calligra
0040 {
0041 namespace Sheets
0042 {
0043 
0044 /**
0045  * Calculation settings
0046  * \ingroup Value
0047  */
0048 class CALLIGRA_SHEETS_ODF_EXPORT CalculationSettings
0049 {
0050 public:
0051     /**
0052      * Constructor.
0053      */
0054     CalculationSettings();
0055 
0056     /**
0057      * Destructor.
0058      */
0059     ~CalculationSettings();
0060 
0061     /**
0062      * A document could use a different localization as the KDE default.
0063      * @return the KLocale associated with this document
0064      */
0065     KLocale *locale() const;
0066 
0067     /**
0068      * Sets the reference year.
0069      *
0070      * \param year the new reference year
0071      */
0072     void setReferenceYear(int year);
0073 
0074     /**
0075      * Returns the reference year all two-digit-year dates are stored relative to.
0076      *
0077      * This defines how to convert a two-digit year into a four-digit year. All
0078      * two-digit year values are interpreted as a year that equals or follows this year.
0079      *
0080      * \return the reference year (default: 1930)
0081      */
0082     int referenceYear() const;
0083 
0084     /**
0085      * Sets the reference date.
0086      * All dates are stored as numbers relative to a reference date.
0087      *
0088      * \param date the new reference date
0089      */
0090     void setReferenceDate(const QDate& date);
0091 
0092     /**
0093      * Returns the reference date all date are stored relative to.
0094      *
0095      * \return the reference date (default: 1899-12-30)
0096      */
0097     QDate referenceDate() const;
0098 
0099     void setPrecisionAsShown(bool enable);
0100     bool precisionAsShown() const;
0101 
0102     /**
0103      * Sets the default decimal precision.
0104      * It is used to format decimal numbers, if the cell style does not define
0105      * one.
0106      *
0107      * \param precision the default decimal precision
0108      */
0109     void setDefaultDecimalPrecision(int precision);
0110 
0111     /**
0112      * Returns the default decimal precision, which is used, if the cell style
0113      * does not define one.
0114      *
0115      * \return the default decimal precision
0116      */
0117     int defaultDecimalPrecision() const;
0118 
0119     /**
0120      * Sets the file name used in the FILENAME function.
0121      */
0122     void setFileName(const QString& fileName);
0123 
0124     /**
0125      * \return The file name used in the FILENAME function.
0126      */
0127     const QString& fileName() const;
0128 
0129     /**
0130      * Sets the activation state of the active sheet's automatic recalculation
0131      * setting.
0132      * Used in the INFO function.
0133      */
0134     void setAutoCalculationEnabled(bool enable);
0135 
0136     /**
0137      * Returns the activation state of the active sheet's automatic
0138      * recalculation setting.
0139      * Used in the INFO function.
0140      *
0141      * \return the activation state
0142      */
0143     bool isAutoCalculationEnabled() const;
0144 
0145     void setAutomaticFindLabels(bool enabled);
0146     bool automaticFindLabels() const;
0147 
0148     /**
0149      * Sets the comparisons on this document to be case sensitive or not.
0150      */
0151     void setCaseSensitiveComparisons(Qt::CaseSensitivity caseSensitive);
0152 
0153     /**
0154      * Returns whether comparisons in this document are case sensitive.
0155      */
0156     Qt::CaseSensitivity caseSensitiveComparisons() const;
0157 
0158     void setWholeCellSearchCriteria(bool enabled);
0159     bool wholeCellSearchCriteria() const;
0160 
0161     /**
0162      * If true, regular expressions are used for character string
0163      * comparisons and when searching.
0164      *
0165      * This option is mutually exclusive with \a useWildcards but
0166      * calling this method will not call \a setUseWildcards and
0167      * its also not guaranteed that both are not set to true when
0168      * calling \a loadOdf and the ODF defines both to be true.
0169      *
0170      * This is the default character string comparisons mode in ODF.
0171      */
0172     void setUseRegularExpressions(bool enabled);
0173     bool useRegularExpressions() const;
0174 
0175     /**
0176      * If true, wildcards question mark '?' and asterisk '*' are used for
0177      * character string comparisons and when searching. Wildcards may be
0178      * escaped with a tilde '~' character.
0179      *
0180      * This is the only comparison mode supported by Excel.
0181      */
0182     void setUseWildcards(bool enabled);
0183     bool useWildcards() const;
0184 
0185 private:
0186     class Private;
0187     Private * const d;
0188 };
0189 
0190 } // namespace Sheets
0191 } // namespace Calligra
0192 
0193 #endif // CALLIGRA_SHEETS_CALCULATION_SETTINGS