LibreOffice Module sc (master)  1
formulaopt.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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  */
9 
10 #ifndef INCLUDED_SC_INC_FORMULAOPT_HXX
11 #define INCLUDED_SC_INC_FORMULAOPT_HXX
12 
13 #include <map>
14 #include <svl/poolitem.hxx>
15 #include <unotools/configitem.hxx>
16 #include <formula/grammar.hxx>
17 #include "scdllapi.h"
18 #include "calcconfig.hxx"
19 
21 {
22 private:
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
27 
28  OUString aFormulaSepArg;
31 
34 
35 public:
37 
38  void SetDefaults();
39 
40  void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
41  ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
42 
43  ScCalcConfig& GetCalcConfig() { return aCalcConfig; }
44  const ScCalcConfig& GetCalcConfig() const { return aCalcConfig; }
45  void SetCalcConfig(const ScCalcConfig& rConfig) { aCalcConfig = rConfig; }
46 
47  void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; }
48  bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; }
49 
50  void SetWriteCalcConfig( bool bVal ) { mbWriteCalcConfig = bVal; }
51  bool GetWriteCalcConfig() const { return mbWriteCalcConfig; }
52 
53  void SetFormulaSepArg(const OUString& rSep) { aFormulaSepArg = rSep; }
54  const OUString& GetFormulaSepArg() const { return aFormulaSepArg; }
55 
56  void SetFormulaSepArrayRow(const OUString& rSep) { aFormulaSepArrayRow = rSep; }
57  const OUString& GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
58 
59  void SetFormulaSepArrayCol(const OUString& rSep) { aFormulaSepArrayCol = rSep; }
60  const OUString& GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
61 
62  void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
63  ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
64 
65  void SetODFRecalcOptions( ScRecalcOptions eOpt ) { meODFRecalc = eOpt; }
66  ScRecalcOptions GetODFRecalcOptions() const { return meODFRecalc; }
67 
68  void ResetFormulaSeparators();
69 
70  static void GetDefaultFormulaSeparators(OUString& rSepArg, OUString& rSepArrayCol, OUString& rSepArrayRow);
71 
72  bool operator== ( const ScFormulaOptions& rOpt ) const;
73  bool operator!= ( const ScFormulaOptions& rOpt ) const;
74 };
75 
76 // item for the dialog / options page
77 
79 {
80 public:
81  ScTpFormulaItem( const ScFormulaOptions& rOpt );
82  virtual ~ScTpFormulaItem() override;
83 
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
88 
89  virtual bool operator==( const SfxPoolItem& ) const override;
90  virtual ScTpFormulaItem* Clone( SfxItemPool *pPool = nullptr ) const override;
91 
92  const ScFormulaOptions& GetFormulaOptions() const { return theOptions; }
93 
94 private:
96 };
97 
98 // config item
99 
100 class ScFormulaCfg final : public ScFormulaOptions, public utl::ConfigItem
101 {
102  typedef std::map<OUString,sal_uInt16> PropsToIds;
103  static css::uno::Sequence<OUString> GetPropertyNames();
105  void UpdateFromProperties( const css::uno::Sequence<OUString>& rNames );
106 
107  virtual void ImplCommit() override;
108 
109 public:
110  ScFormulaCfg();
111 
112  void SetOptions( const ScFormulaOptions& rNew );
113 
114  virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
115 };
116 
117 #endif
118 
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:517
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: formulaopt.cxx:648
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
Definition: xestring.hxx:246
virtual bool operator==(const SfxPoolItem &) const =0
ScRecalcOptions GetODFRecalcOptions() const
Definition: formulaopt.hxx:66
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
const ScFormulaOptions & GetFormulaOptions() const
Definition: formulaopt.hxx:92
OUString aFormulaSepArg
Definition: formulaopt.hxx:28
void SetOOXMLRecalcOptions(ScRecalcOptions eOpt)
Definition: formulaopt.hxx:62
bool GetUseEnglishFuncName() const
Definition: formulaopt.hxx:48
SfxPoolItem & operator=(const SfxPoolItem &)=delete
const OUString & GetFormulaSepArrayRow() const
Definition: formulaopt.hxx:57
void SetFormulaSyntax(::formula::FormulaGrammar::Grammar eGram)
Definition: formulaopt.hxx:40
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: formulaopt.cxx:168
const ScCalcConfig & GetCalcConfig() const
Definition: formulaopt.hxx:44
bool bUseEnglishFuncName
Definition: formulaopt.hxx:23
ScRecalcOptions meOOXMLRecalc
Definition: formulaopt.hxx:32
std::map< OUString, sal_uInt16 > PropsToIds
Definition: formulaopt.hxx:102
ScRecalcOptions meODFRecalc
Definition: formulaopt.hxx:33
ScCalcConfig aCalcConfig
Definition: formulaopt.hxx:25
ScCalcConfig & GetCalcConfig()
Definition: formulaopt.hxx:43
void SetFormulaSepArg(const OUString &rSep)
Definition: formulaopt.hxx:53
static ScFormulaCfg::PropsToIds GetPropNamesToId()
Definition: formulaopt.cxx:187
void SetFormulaSepArrayCol(const OUString &rSep)
Definition: formulaopt.hxx:59
void SetFormulaSepArrayRow(const OUString &rSep)
Definition: formulaopt.hxx:56
void SetUseEnglishFuncName(bool bVal)
Definition: formulaopt.hxx:47
const OUString & GetFormulaSepArg() const
Definition: formulaopt.hxx:54
const OUString & GetFormulaSepArrayCol() const
Definition: formulaopt.hxx:60
Configuration options for formula interpreter.
Definition: calcconfig.hxx:43
void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: formulaopt.hxx:45
ScRecalcOptions GetOOXMLRecalcOptions() const
Definition: formulaopt.hxx:63
ScRecalcOptions
Definition: calcconfig.hxx:23
::formula::FormulaGrammar::Grammar GetFormulaSyntax() const
Definition: formulaopt.hxx:41
ScFormulaOptions theOptions
Definition: formulaopt.hxx:95
virtual void ImplCommit() override
Definition: formulaopt.cxx:462
void UpdateFromProperties(const css::uno::Sequence< OUString > &rNames)
Definition: formulaopt.cxx:222
OUString aFormulaSepArrayCol
Definition: formulaopt.hxx:30
bool GetWriteCalcConfig() const
Definition: formulaopt.hxx:51
OUString aFormulaSepArrayRow
Definition: formulaopt.hxx:29
void SetWriteCalcConfig(bool bVal)
Definition: formulaopt.hxx:50
formula::FormulaGrammar::Grammar eFormulaGrammar
Definition: formulaopt.hxx:24
#define SC_DLLPUBLIC
Definition: scdllapi.h:28
void SetOptions(const ScFormulaOptions &rNew)
Definition: formulaopt.cxx:642
void SetODFRecalcOptions(ScRecalcOptions eOpt)
Definition: formulaopt.hxx:65