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 #pragma once
11 
12 #include <map>
13 #include <svl/poolitem.hxx>
14 #include <unotools/configitem.hxx>
15 #include <formula/grammar.hxx>
16 #include "scdllapi.h"
17 #include "calcconfig.hxx"
18 
20 {
21 private:
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
26 
27  OUString aFormulaSepArg;
30 
33 
34 public:
36 
37  void SetDefaults();
38 
39  void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
40  ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
41 
42  ScCalcConfig& GetCalcConfig() { return aCalcConfig; }
43  const ScCalcConfig& GetCalcConfig() const { return aCalcConfig; }
44  void SetCalcConfig(const ScCalcConfig& rConfig) { aCalcConfig = rConfig; }
45 
46  void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; }
47  bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; }
48 
49  void SetWriteCalcConfig( bool bVal ) { mbWriteCalcConfig = bVal; }
50  bool GetWriteCalcConfig() const { return mbWriteCalcConfig; }
51 
52  void SetFormulaSepArg(const OUString& rSep) { aFormulaSepArg = rSep; }
53  const OUString& GetFormulaSepArg() const { return aFormulaSepArg; }
54 
55  void SetFormulaSepArrayRow(const OUString& rSep) { aFormulaSepArrayRow = rSep; }
56  const OUString& GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
57 
58  void SetFormulaSepArrayCol(const OUString& rSep) { aFormulaSepArrayCol = rSep; }
59  const OUString& GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
60 
61  void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
62  ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
63 
64  void SetODFRecalcOptions( ScRecalcOptions eOpt ) { meODFRecalc = eOpt; }
65  ScRecalcOptions GetODFRecalcOptions() const { return meODFRecalc; }
66 
67  void ResetFormulaSeparators();
68 
69  static void GetDefaultFormulaSeparators(OUString& rSepArg, OUString& rSepArrayCol, OUString& rSepArrayRow);
70 
71  bool operator== ( const ScFormulaOptions& rOpt ) const;
72  bool operator!= ( const ScFormulaOptions& rOpt ) const;
73 };
74 
75 // item for the dialog / options page
76 
78 {
79 public:
80  ScTpFormulaItem( const ScFormulaOptions& rOpt );
81  virtual ~ScTpFormulaItem() override;
82 
83  ScTpFormulaItem(ScTpFormulaItem const &) = default;
84  ScTpFormulaItem(ScTpFormulaItem &&) = default;
85  ScTpFormulaItem & operator =(ScTpFormulaItem const &) = delete; // due to SfxPoolItem
86  ScTpFormulaItem & operator =(ScTpFormulaItem &&) = delete; // due to SfxPoolItem
87 
88  virtual bool operator==( const SfxPoolItem& ) const override;
89  virtual ScTpFormulaItem* Clone( SfxItemPool *pPool = nullptr ) const override;
90 
91  const ScFormulaOptions& GetFormulaOptions() const { return theOptions; }
92 
93 private:
95 };
96 
97 // config item
98 
99 class ScFormulaCfg final : public ScFormulaOptions, public utl::ConfigItem
100 {
101  typedef std::map<OUString,sal_uInt16> PropsToIds;
102  static css::uno::Sequence<OUString> GetPropertyNames();
104  void UpdateFromProperties( const css::uno::Sequence<OUString>& rNames );
105 
106  virtual void ImplCommit() override;
107 
108 public:
109  ScFormulaCfg();
110 
111  void SetOptions( const ScFormulaOptions& rNew );
112 
113  virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames ) override;
114 };
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:518
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
Definition: formulaopt.cxx:647
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
Definition: xestring.hxx:250
virtual bool operator==(const SfxPoolItem &) const =0
ScRecalcOptions GetODFRecalcOptions() const
Definition: formulaopt.hxx:65
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
const ScFormulaOptions & GetFormulaOptions() const
Definition: formulaopt.hxx:91
OUString aFormulaSepArg
Definition: formulaopt.hxx:27
void SetOOXMLRecalcOptions(ScRecalcOptions eOpt)
Definition: formulaopt.hxx:61
bool GetUseEnglishFuncName() const
Definition: formulaopt.hxx:47
SfxPoolItem & operator=(const SfxPoolItem &)=delete
const OUString & GetFormulaSepArrayRow() const
Definition: formulaopt.hxx:56
void SetFormulaSyntax(::formula::FormulaGrammar::Grammar eGram)
Definition: formulaopt.hxx:39
static css::uno::Sequence< OUString > GetPropertyNames()
Definition: formulaopt.cxx:167
const ScCalcConfig & GetCalcConfig() const
Definition: formulaopt.hxx:43
bool bUseEnglishFuncName
Definition: formulaopt.hxx:22
ScRecalcOptions meOOXMLRecalc
Definition: formulaopt.hxx:31
std::map< OUString, sal_uInt16 > PropsToIds
Definition: formulaopt.hxx:101
ScRecalcOptions meODFRecalc
Definition: formulaopt.hxx:32
ScCalcConfig aCalcConfig
Definition: formulaopt.hxx:24
ScCalcConfig & GetCalcConfig()
Definition: formulaopt.hxx:42
void SetFormulaSepArg(const OUString &rSep)
Definition: formulaopt.hxx:52
static ScFormulaCfg::PropsToIds GetPropNamesToId()
Definition: formulaopt.cxx:186
void SetFormulaSepArrayCol(const OUString &rSep)
Definition: formulaopt.hxx:58
void SetFormulaSepArrayRow(const OUString &rSep)
Definition: formulaopt.hxx:55
void SetUseEnglishFuncName(bool bVal)
Definition: formulaopt.hxx:46
const OUString & GetFormulaSepArg() const
Definition: formulaopt.hxx:53
const OUString & GetFormulaSepArrayCol() const
Definition: formulaopt.hxx:59
Configuration options for formula interpreter.
Definition: calcconfig.hxx:43
void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: formulaopt.hxx:44
ScRecalcOptions GetOOXMLRecalcOptions() const
Definition: formulaopt.hxx:62
ScRecalcOptions
Definition: calcconfig.hxx:23
::formula::FormulaGrammar::Grammar GetFormulaSyntax() const
Definition: formulaopt.hxx:40
ScFormulaOptions theOptions
Definition: formulaopt.hxx:94
virtual void ImplCommit() override
Definition: formulaopt.cxx:461
void UpdateFromProperties(const css::uno::Sequence< OUString > &rNames)
Definition: formulaopt.cxx:221
OUString aFormulaSepArrayCol
Definition: formulaopt.hxx:29
bool GetWriteCalcConfig() const
Definition: formulaopt.hxx:50
OUString aFormulaSepArrayRow
Definition: formulaopt.hxx:28
void SetWriteCalcConfig(bool bVal)
Definition: formulaopt.hxx:49
formula::FormulaGrammar::Grammar eFormulaGrammar
Definition: formulaopt.hxx:23
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
void SetOptions(const ScFormulaOptions &rNew)
Definition: formulaopt.cxx:641
void SetODFRecalcOptions(ScRecalcOptions eOpt)
Definition: formulaopt.hxx:64