1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * Version: MPL 1.1 / GPLv3+ / LGPLv3+
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/
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
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.
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.
29 #ifndef SC_FORMULAOPT_HXX
30 #define SC_FORMULAOPT_HXX
32 #include <svl/poolitem.hxx>
33 #include <unotools/configitem.hxx>
34 #include <unotools/localedatawrapper.hxx>
35 #include "formula/grammar.hxx"
38 #include "calcconfig.hxx"
40 class SC_DLLPUBLIC ScFormulaOptions
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
;
47 ::rtl::OUString aFormulaSepArg
;
48 ::rtl::OUString aFormulaSepArrayRow
;
49 ::rtl::OUString aFormulaSepArrayCol
;
51 ScRecalcOptions meOOXMLRecalc
;
52 ScRecalcOptions meODFRecalc
;
56 ScFormulaOptions( const ScFormulaOptions
& rCpy
);
61 void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram
) { eFormulaGrammar
= eGram
; }
62 ::formula::FormulaGrammar::Grammar
GetFormulaSyntax() const { return eFormulaGrammar
; }
64 ScCalcConfig
& GetCalcConfig() { return aCalcConfig
; }
65 const ScCalcConfig
& GetCalcConfig() const { return aCalcConfig
; }
66 void SetCalcConfig(const ScCalcConfig
& rConfig
) { aCalcConfig
= rConfig
; }
68 void SetUseEnglishFuncName( bool bVal
) { bUseEnglishFuncName
= bVal
; }
69 bool GetUseEnglishFuncName() const { return bUseEnglishFuncName
; }
71 void SetFormulaSepArg(const ::rtl::OUString
& rSep
) { aFormulaSepArg
= rSep
; }
72 ::rtl::OUString
GetFormulaSepArg() const { return aFormulaSepArg
; }
74 void SetFormulaSepArrayRow(const ::rtl::OUString
& rSep
) { aFormulaSepArrayRow
= rSep
; }
75 ::rtl::OUString
GetFormulaSepArrayRow() const { return aFormulaSepArrayRow
; }
77 void SetFormulaSepArrayCol(const ::rtl::OUString
& rSep
) { aFormulaSepArrayCol
= rSep
; }
78 ::rtl::OUString
GetFormulaSepArrayCol() const { return aFormulaSepArrayCol
; }
80 void SetOOXMLRecalcOptions( ScRecalcOptions eOpt
) { meOOXMLRecalc
= eOpt
; }
81 ScRecalcOptions
GetOOXMLRecalcOptions() const { return meOOXMLRecalc
; }
83 void SetODFRecalcOptions( ScRecalcOptions eOpt
) { meODFRecalc
= eOpt
; }
84 ScRecalcOptions
GetODFRecalcOptions() const { return meODFRecalc
; }
86 void ResetFormulaSeparators();
88 static void GetDefaultFormulaSeparators(rtl::OUString
& rSepArg
, rtl::OUString
& rSepArrayCol
, rtl::OUString
& rSepArrayRow
);
90 static const LocaleDataWrapper
& GetLocaleDataWrapper();
92 ScFormulaOptions
& operator= ( const ScFormulaOptions
& rCpy
);
93 bool operator== ( const ScFormulaOptions
& rOpt
) const;
94 bool operator!= ( const ScFormulaOptions
& rOpt
) const;
97 //==================================================================
98 // item for the dialog / options page
99 //==================================================================
101 class SC_DLLPUBLIC ScTpFormulaItem
: public SfxPoolItem
105 ScTpFormulaItem( sal_uInt16 nWhich
,
106 const ScFormulaOptions
& rOpt
);
107 ScTpFormulaItem( const ScTpFormulaItem
& rItem
);
110 virtual String
GetValueText() const;
111 virtual int operator==( const SfxPoolItem
& ) const;
112 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
114 const ScFormulaOptions
& GetFormulaOptions() const { return theOptions
; }
117 ScFormulaOptions theOptions
;
120 //==================================================================
122 //==================================================================
124 class ScFormulaCfg
: public ScFormulaOptions
, public utl::ConfigItem
126 com::sun::star::uno::Sequence
<rtl::OUString
> GetPropertyNames();
130 void SetOptions( const ScFormulaOptions
& rNew
);
132 virtual void Commit();
133 virtual void Notify( const ::com::sun::star::uno::Sequence
< rtl::OUString
>& aPropertyNames
);
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */