1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef SC_FORMULAOPT_HXX
11 #define SC_FORMULAOPT_HXX
14 #include <svl/poolitem.hxx>
15 #include <unotools/configitem.hxx>
16 #include <unotools/localedatawrapper.hxx>
17 #include "formula/grammar.hxx"
20 #include "calcconfig.hxx"
22 class SC_DLLPUBLIC ScFormulaOptions
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
;
38 ScFormulaOptions( const ScFormulaOptions
& rCpy
);
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
85 ScTpFormulaItem( sal_uInt16 nWhich
,
86 const ScFormulaOptions
& rOpt
);
87 ScTpFormulaItem( const ScTpFormulaItem
& rItem
);
90 virtual OUString
GetValueText() const;
91 virtual int operator==( const SfxPoolItem
& ) const;
92 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
94 const ScFormulaOptions
& GetFormulaOptions() const { return theOptions
; }
97 ScFormulaOptions theOptions
;
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
);
111 void SetOptions( const ScFormulaOptions
& rNew
);
113 virtual void Commit();
114 virtual void Notify( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
);
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */