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 INCLUDED_SC_INC_FORMULAOPT_HXX
11 #define INCLUDED_SC_INC_FORMULAOPT_HXX
14 #include <svl/poolitem.hxx>
15 #include <unotools/configitem.hxx>
16 #include <formula/grammar.hxx>
18 #include "calcconfig.hxx"
20 class SC_DLLPUBLIC ScFormulaOptions
23 bool bUseEnglishFuncName
; // use English function name even if the locale is not English.
24 formula::FormulaGrammar::Grammar eFormulaGrammar
; // formula grammar used to switch different formula syntax
25 ScCalcConfig aCalcConfig
;
26 bool mbWriteCalcConfig
;
28 OUString aFormulaSepArg
;
29 OUString aFormulaSepArrayRow
;
30 OUString aFormulaSepArrayCol
;
32 ScRecalcOptions meOOXMLRecalc
;
33 ScRecalcOptions meODFRecalc
;
40 void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram
) { eFormulaGrammar
= eGram
; }
41 ::formula::FormulaGrammar::Grammar
GetFormulaSyntax() const { return eFormulaGrammar
; }
43 ScCalcConfig
& GetCalcConfig() { return aCalcConfig
; }
44 const ScCalcConfig
& GetCalcConfig() const { return aCalcConfig
; }
45 void SetCalcConfig(const ScCalcConfig
& rConfig
) { aCalcConfig
= rConfig
; }
47 void SetUseEnglishFuncName( bool bVal
) { bUseEnglishFuncName
= bVal
; }
48 bool GetUseEnglishFuncName() const { return bUseEnglishFuncName
; }
50 void SetWriteCalcConfig( bool bVal
) { mbWriteCalcConfig
= bVal
; }
51 bool GetWriteCalcConfig() const { return mbWriteCalcConfig
; }
53 void SetFormulaSepArg(const OUString
& rSep
) { aFormulaSepArg
= rSep
; }
54 const OUString
& GetFormulaSepArg() const { return aFormulaSepArg
; }
56 void SetFormulaSepArrayRow(const OUString
& rSep
) { aFormulaSepArrayRow
= rSep
; }
57 const OUString
& GetFormulaSepArrayRow() const { return aFormulaSepArrayRow
; }
59 void SetFormulaSepArrayCol(const OUString
& rSep
) { aFormulaSepArrayCol
= rSep
; }
60 const 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 bool operator== ( const ScFormulaOptions
& rOpt
) const;
73 bool operator!= ( const ScFormulaOptions
& rOpt
) const;
76 // item for the dialog / options page
78 class SC_DLLPUBLIC ScTpFormulaItem final
: public SfxPoolItem
81 ScTpFormulaItem( const ScFormulaOptions
& rOpt
);
82 virtual ~ScTpFormulaItem() override
;
84 ScTpFormulaItem(ScTpFormulaItem
const &) = default;
85 ScTpFormulaItem(ScTpFormulaItem
&&) = default;
86 ScTpFormulaItem
& operator =(ScTpFormulaItem
const &) = delete; // due to SfxPoolItem
87 ScTpFormulaItem
& operator =(ScTpFormulaItem
&&) = delete; // due to SfxPoolItem
89 virtual bool operator==( const SfxPoolItem
& ) const override
;
90 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
92 const ScFormulaOptions
& GetFormulaOptions() const { return theOptions
; }
95 ScFormulaOptions
const theOptions
;
100 class ScFormulaCfg final
: public ScFormulaOptions
, public utl::ConfigItem
102 typedef std::map
<OUString
,sal_uInt16
> PropsToIds
;
103 static css::uno::Sequence
<OUString
> GetPropertyNames();
104 static ScFormulaCfg::PropsToIds
GetPropNamesToId();
105 void UpdateFromProperties( const css::uno::Sequence
<OUString
>& rNames
);
107 virtual void ImplCommit() override
;
112 void SetOptions( const ScFormulaOptions
& rNew
);
114 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */