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/.
13 #include <svl/poolitem.hxx>
14 #include <unotools/configitem.hxx>
15 #include <formula/grammar.hxx>
17 #include "calcconfig.hxx"
19 class SC_DLLPUBLIC ScFormulaOptions
22 bool bUseEnglishFuncName
; // use English function name even if the locale is not English.
23 formula::FormulaGrammar::Grammar eFormulaGrammar
; // formula grammar used to switch different formula syntax
24 ScCalcConfig aCalcConfig
;
25 bool mbWriteCalcConfig
;
27 OUString aFormulaSepArg
;
28 OUString aFormulaSepArrayRow
;
29 OUString aFormulaSepArrayCol
;
31 ScRecalcOptions meOOXMLRecalc
;
32 ScRecalcOptions meODFRecalc
;
33 ScRecalcOptions meReCalcOptiRowHeights
;
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 SetReCalcOptiRowHeights( ScRecalcOptions eOpt
) { meReCalcOptiRowHeights
= eOpt
; }
69 ScRecalcOptions
GetReCalcOptiRowHeights() const { return meReCalcOptiRowHeights
; }
71 void ResetFormulaSeparators();
73 static void GetDefaultFormulaSeparators(OUString
& rSepArg
, OUString
& rSepArrayCol
, OUString
& rSepArrayRow
);
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 final
: public SfxPoolItem
84 ScTpFormulaItem( ScFormulaOptions aOpt
);
85 virtual ~ScTpFormulaItem() override
;
87 ScTpFormulaItem(ScTpFormulaItem
const &) = default;
88 ScTpFormulaItem(ScTpFormulaItem
&&) = default;
89 ScTpFormulaItem
& operator =(ScTpFormulaItem
const &) = delete; // due to SfxPoolItem
90 ScTpFormulaItem
& operator =(ScTpFormulaItem
&&) = delete; // due to SfxPoolItem
92 virtual bool operator==( const SfxPoolItem
& ) const override
;
93 virtual ScTpFormulaItem
* Clone( SfxItemPool
*pPool
= nullptr ) const override
;
95 const ScFormulaOptions
& GetFormulaOptions() const { return theOptions
; }
98 ScFormulaOptions theOptions
;
103 class ScFormulaCfg final
: public ScFormulaOptions
, public utl::ConfigItem
105 typedef std::map
<OUString
,sal_uInt16
> PropsToIds
;
106 static css::uno::Sequence
<OUString
> GetPropertyNames();
107 static ScFormulaCfg::PropsToIds
GetPropNamesToId();
108 void UpdateFromProperties( const css::uno::Sequence
<OUString
>& rNames
);
110 virtual void ImplCommit() override
;
115 void SetOptions( const ScFormulaOptions
& rNew
);
117 virtual void Notify( const css::uno::Sequence
< OUString
>& aPropertyNames
) override
;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */