Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Albert Thuswaldner <albert.thuswaldner@gmail.com>
17 : * Portions created by the Initial Developer are Copyright (C) 2012 the
18 : * Initial Developer. All Rights Reserved.
19 : *
20 : * Contributor(s):
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 :
29 : #ifndef SC_FORMULAOPT_HXX
30 : #define SC_FORMULAOPT_HXX
31 :
32 : #include <svl/poolitem.hxx>
33 : #include <unotools/configitem.hxx>
34 : #include <unotools/localedatawrapper.hxx>
35 : #include "formula/grammar.hxx"
36 : #include "scdllapi.h"
37 : #include "global.hxx"
38 : #include "calcconfig.hxx"
39 :
40 : // have to match the registry values
41 : enum ScRecalcOptions
42 : {
43 : RECALC_ALWAYS = 0,
44 : RECALC_ASK = 1,
45 : RECALC_NEVER = 2
46 : };
47 :
48 : class SC_DLLPUBLIC ScFormulaOptions
49 : {
50 : private:
51 : bool bUseEnglishFuncName; // use English function name even if the locale is not English.
52 : formula::FormulaGrammar::Grammar eFormulaGrammar; // formula grammar used to switch different formula syntax
53 : ScCalcConfig aCalcConfig;
54 :
55 : ::rtl::OUString aFormulaSepArg;
56 : ::rtl::OUString aFormulaSepArrayRow;
57 : ::rtl::OUString aFormulaSepArrayCol;
58 :
59 : ScRecalcOptions meOOXMLRecalc;
60 :
61 : public:
62 : ScFormulaOptions();
63 : ScFormulaOptions( const ScFormulaOptions& rCpy );
64 : ~ScFormulaOptions();
65 :
66 : void SetDefaults();
67 :
68 0 : void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
69 172 : ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
70 :
71 64 : ScCalcConfig& GetCalcConfig() { return aCalcConfig; }
72 172 : const ScCalcConfig& GetCalcConfig() const { return aCalcConfig; }
73 0 : void SetCalcConfig(const ScCalcConfig& rConfig) { aCalcConfig = rConfig; }
74 :
75 32 : void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; }
76 172 : bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; }
77 :
78 0 : void SetFormulaSepArg(const ::rtl::OUString& rSep) { aFormulaSepArg = rSep; }
79 198 : ::rtl::OUString GetFormulaSepArg() const { return aFormulaSepArg; }
80 :
81 0 : void SetFormulaSepArrayRow(const ::rtl::OUString& rSep) { aFormulaSepArrayRow = rSep; }
82 198 : ::rtl::OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
83 :
84 0 : void SetFormulaSepArrayCol(const ::rtl::OUString& rSep) { aFormulaSepArrayCol = rSep; }
85 198 : ::rtl::OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
86 :
87 32 : void SetOOXMLRecalcOptions( ScRecalcOptions eOpt ) { meOOXMLRecalc = eOpt; }
88 0 : ScRecalcOptions GetOOXMLRecalcOptions() const { return meOOXMLRecalc; }
89 :
90 : void ResetFormulaSeparators();
91 :
92 : static void GetDefaultFormulaSeparators(rtl::OUString& rSepArg, rtl::OUString& rSepArrayCol, rtl::OUString& rSepArrayRow);
93 :
94 : static const LocaleDataWrapper& GetLocaleDataWrapper();
95 :
96 : ScFormulaOptions& operator= ( const ScFormulaOptions& rCpy );
97 : bool operator== ( const ScFormulaOptions& rOpt ) const;
98 : bool operator!= ( const ScFormulaOptions& rOpt ) const;
99 : };
100 :
101 : //==================================================================
102 : // item for the dialog / options page
103 : //==================================================================
104 :
105 : class SC_DLLPUBLIC ScTpFormulaItem : public SfxPoolItem
106 : {
107 : public:
108 : TYPEINFO();
109 : ScTpFormulaItem( sal_uInt16 nWhich,
110 : const ScFormulaOptions& rOpt );
111 : ScTpFormulaItem( const ScTpFormulaItem& rItem );
112 : ~ScTpFormulaItem();
113 :
114 : virtual String GetValueText() const;
115 : virtual int operator==( const SfxPoolItem& ) const;
116 : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
117 :
118 0 : const ScFormulaOptions& GetFormulaOptions() const { return theOptions; }
119 :
120 : private:
121 : ScFormulaOptions theOptions;
122 : };
123 :
124 : //==================================================================
125 : // config item
126 : //==================================================================
127 :
128 0 : class ScFormulaCfg : public ScFormulaOptions, public utl::ConfigItem
129 : {
130 : com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
131 : public:
132 : ScFormulaCfg();
133 :
134 : void SetOptions( const ScFormulaOptions& rNew );
135 :
136 : virtual void Commit();
137 : virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
138 : };
139 :
140 : #endif
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|