Bump version to 4.3-4
[LibreOffice.git] / sc / inc / formulaopt.hxx
blob906804efee84134d2475e74ff6efb1aff213a171
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_SC_INC_FORMULAOPT_HXX
11 #define INCLUDED_SC_INC_FORMULAOPT_HXX
13 #include <map>
14 #include <svl/poolitem.hxx>
15 #include <unotools/configitem.hxx>
16 #include <unotools/localedatawrapper.hxx>
17 #include <formula/grammar.hxx>
18 #include "scdllapi.h"
19 #include "global.hxx"
20 #include "calcconfig.hxx"
22 class SC_DLLPUBLIC ScFormulaOptions
24 private:
25 bool bUseEnglishFuncName; // use English function name even if the locale is not English.
26 formula::FormulaGrammar::Grammar eFormulaGrammar; // formula grammar used to switch different formula syntax
27 ScCalcConfig aCalcConfig;
29 OUString aFormulaSepArg;
30 OUString aFormulaSepArrayRow;
31 OUString aFormulaSepArrayCol;
33 ScRecalcOptions meOOXMLRecalc;
34 ScRecalcOptions meODFRecalc;
36 public:
37 ScFormulaOptions();
38 ScFormulaOptions( const ScFormulaOptions& rCpy );
39 ~ScFormulaOptions();
41 void SetDefaults();
43 void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
44 ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
46 ScCalcConfig& GetCalcConfig() { return aCalcConfig; }
47 const ScCalcConfig& GetCalcConfig() const { return aCalcConfig; }
48 void SetCalcConfig(const ScCalcConfig& rConfig) { aCalcConfig = rConfig; }
50 void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; }
51 bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; }
53 void SetFormulaSepArg(const OUString& rSep) { aFormulaSepArg = rSep; }
54 OUString GetFormulaSepArg() const { return aFormulaSepArg; }
56 void SetFormulaSepArrayRow(const OUString& rSep) { aFormulaSepArrayRow = rSep; }
57 OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
59 void SetFormulaSepArrayCol(const OUString& rSep) { aFormulaSepArrayCol = rSep; }
60 OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
62 void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
63 ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
65 void SetODFRecalcOptions( ScRecalcOptions eOpt ) { meODFRecalc = eOpt; }
66 ScRecalcOptions GetODFRecalcOptions() const { return meODFRecalc; }
68 void ResetFormulaSeparators();
70 static void GetDefaultFormulaSeparators(OUString& rSepArg, OUString& rSepArrayCol, OUString& rSepArrayRow);
72 static const LocaleDataWrapper& GetLocaleDataWrapper();
74 ScFormulaOptions& operator= ( const ScFormulaOptions& rCpy );
75 bool operator== ( const ScFormulaOptions& rOpt ) const;
76 bool operator!= ( const ScFormulaOptions& rOpt ) const;
79 // item for the dialog / options page
81 class SC_DLLPUBLIC ScTpFormulaItem : public SfxPoolItem
83 public:
84 TYPEINFO_OVERRIDE();
85 ScTpFormulaItem( sal_uInt16 nWhich,
86 const ScFormulaOptions& rOpt );
87 ScTpFormulaItem( const ScTpFormulaItem& rItem );
88 virtual ~ScTpFormulaItem();
90 virtual OUString GetValueText() const;
91 virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
92 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
94 const ScFormulaOptions& GetFormulaOptions() const { return theOptions; }
96 private:
97 ScFormulaOptions theOptions;
100 // config item
102 class ScFormulaCfg : public ScFormulaOptions, public utl::ConfigItem
104 typedef std::map<OUString,sal_uInt16> PropsToIds;
105 com::sun::star::uno::Sequence<OUString> GetPropertyNames();
106 ScFormulaCfg::PropsToIds GetPropNamesToId();
107 void UpdateFromProperties( const com::sun::star::uno::Sequence<OUString>& rNames );
108 public:
109 ScFormulaCfg();
111 void SetOptions( const ScFormulaOptions& rNew );
113 virtual void Commit() SAL_OVERRIDE;
114 virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
117 #endif
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */