Branch data 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 : : class SC_DLLPUBLIC ScFormulaOptions
41 : : {
42 : : private:
43 : : bool bUseEnglishFuncName; // use English function name even if the locale is not English.
44 : : formula::FormulaGrammar::Grammar eFormulaGrammar; // formula grammar used to switch different formula syntax
45 : : ScCalcConfig aCalcConfig;
46 : :
47 : : ::rtl::OUString aFormulaSepArg;
48 : : ::rtl::OUString aFormulaSepArrayRow;
49 : : ::rtl::OUString aFormulaSepArrayCol;
50 : :
51 : : public:
52 : : ScFormulaOptions();
53 : : ScFormulaOptions( const ScFormulaOptions& rCpy );
54 : : ~ScFormulaOptions();
55 : :
56 : : void SetDefaults();
57 : :
58 : 0 : void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
59 : 412 : ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
60 : :
61 : 102 : ScCalcConfig& GetCalcConfig() { return aCalcConfig; }
62 : 412 : const ScCalcConfig& GetCalcConfig() const { return aCalcConfig; }
63 : 0 : void SetCalcConfig(const ScCalcConfig& rConfig) { aCalcConfig = rConfig; }
64 : :
65 : 51 : void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; }
66 : 412 : bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; }
67 : :
68 : 0 : void SetFormulaSepArg(const ::rtl::OUString& rSep) { aFormulaSepArg = rSep; }
69 : 633 : ::rtl::OUString GetFormulaSepArg() const { return aFormulaSepArg; }
70 : :
71 : 0 : void SetFormulaSepArrayRow(const ::rtl::OUString& rSep) { aFormulaSepArrayRow = rSep; }
72 : 633 : ::rtl::OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
73 : :
74 : 0 : void SetFormulaSepArrayCol(const ::rtl::OUString& rSep) { aFormulaSepArrayCol = rSep; }
75 : 633 : ::rtl::OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
76 : :
77 : : void ResetFormulaSeparators();
78 : :
79 : : static void GetDefaultFormulaSeparators(rtl::OUString& rSepArg, rtl::OUString& rSepArrayCol, rtl::OUString& rSepArrayRow);
80 : :
81 : : static const LocaleDataWrapper& GetLocaleDataWrapper();
82 : :
83 : : ScFormulaOptions& operator= ( const ScFormulaOptions& rCpy );
84 : : bool operator== ( const ScFormulaOptions& rOpt ) const;
85 : : bool operator!= ( const ScFormulaOptions& rOpt ) const;
86 : : };
87 : :
88 : : //==================================================================
89 : : // item for the dialog / options page
90 : : //==================================================================
91 : :
92 : : class SC_DLLPUBLIC ScTpFormulaItem : public SfxPoolItem
93 : : {
94 : : public:
95 : : TYPEINFO();
96 : : ScTpFormulaItem( sal_uInt16 nWhich,
97 : : const ScFormulaOptions& rOpt );
98 : : ScTpFormulaItem( const ScTpFormulaItem& rItem );
99 : : ~ScTpFormulaItem();
100 : :
101 : : virtual String GetValueText() const;
102 : : virtual int operator==( const SfxPoolItem& ) const;
103 : : virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
104 : :
105 : 0 : const ScFormulaOptions& GetFormulaOptions() const { return theOptions; }
106 : :
107 : : private:
108 : : ScFormulaOptions theOptions;
109 : : };
110 : :
111 : : //==================================================================
112 : : // config item
113 : : //==================================================================
114 : :
115 [ + - ][ - + ]: 36 : class ScFormulaCfg : public ScFormulaOptions, public utl::ConfigItem
116 : : {
117 : : com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
118 : : public:
119 : : ScFormulaCfg();
120 : :
121 : : void SetOptions( const ScFormulaOptions& rNew );
122 : :
123 : : virtual void Commit();
124 : : virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
125 : : };
126 : :
127 : : #endif
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|