blob: 906804efee84134d2475e74ff6efb1aff213a171 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SC_INC_FORMULAOPT_HXX
#define INCLUDED_SC_INC_FORMULAOPT_HXX
#include <map>
#include <svl/poolitem.hxx>
#include <unotools/configitem.hxx>
#include <unotools/localedatawrapper.hxx>
#include <formula/grammar.hxx>
#include "scdllapi.h"
#include "global.hxx"
#include "calcconfig.hxx"
class SC_DLLPUBLIC ScFormulaOptions
{
private:
bool bUseEnglishFuncName; // use English function name even if the locale is not English.
formula::FormulaGrammar::Grammar eFormulaGrammar; // formula grammar used to switch different formula syntax
ScCalcConfig aCalcConfig;
OUString aFormulaSepArg;
OUString aFormulaSepArrayRow;
OUString aFormulaSepArrayCol;
ScRecalcOptions meOOXMLRecalc;
ScRecalcOptions meODFRecalc;
public:
ScFormulaOptions();
ScFormulaOptions( const ScFormulaOptions& rCpy );
~ScFormulaOptions();
void SetDefaults();
void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
ScCalcConfig& GetCalcConfig() { return aCalcConfig; }
const ScCalcConfig& GetCalcConfig() const { return aCalcConfig; }
void SetCalcConfig(const ScCalcConfig& rConfig) { aCalcConfig = rConfig; }
void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; }
bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; }
void SetFormulaSepArg(const OUString& rSep) { aFormulaSepArg = rSep; }
OUString GetFormulaSepArg() const { return aFormulaSepArg; }
void SetFormulaSepArrayRow(const OUString& rSep) { aFormulaSepArrayRow = rSep; }
OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
void SetFormulaSepArrayCol(const OUString& rSep) { aFormulaSepArrayCol = rSep; }
OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
void SetODFRecalcOptions( ScRecalcOptions eOpt ) { meODFRecalc = eOpt; }
ScRecalcOptions GetODFRecalcOptions() const { return meODFRecalc; }
void ResetFormulaSeparators();
static void GetDefaultFormulaSeparators(OUString& rSepArg, OUString& rSepArrayCol, OUString& rSepArrayRow);
static const LocaleDataWrapper& GetLocaleDataWrapper();
ScFormulaOptions& operator= ( const ScFormulaOptions& rCpy );
bool operator== ( const ScFormulaOptions& rOpt ) const;
bool operator!= ( const ScFormulaOptions& rOpt ) const;
};
// item for the dialog / options page
class SC_DLLPUBLIC ScTpFormulaItem : public SfxPoolItem
{
public:
TYPEINFO_OVERRIDE();
ScTpFormulaItem( sal_uInt16 nWhich,
const ScFormulaOptions& rOpt );
ScTpFormulaItem( const ScTpFormulaItem& rItem );
virtual ~ScTpFormulaItem();
virtual OUString GetValueText() const;
virtual bool operator==( const SfxPoolItem& ) const SAL_OVERRIDE;
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
const ScFormulaOptions& GetFormulaOptions() const { return theOptions; }
private:
ScFormulaOptions theOptions;
};
// config item
class ScFormulaCfg : public ScFormulaOptions, public utl::ConfigItem
{
typedef std::map<OUString,sal_uInt16> PropsToIds;
com::sun::star::uno::Sequence<OUString> GetPropertyNames();
ScFormulaCfg::PropsToIds GetPropNamesToId();
void UpdateFromProperties( const com::sun::star::uno::Sequence<OUString>& rNames );
public:
ScFormulaCfg();
void SetOptions( const ScFormulaOptions& rNew );
virtual void Commit() SAL_OVERRIDE;
virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|