merge the formfield patch from ooo-build
[ooovba.git] / sc / inc / docoptio.hxx
blob81b80b94efcec61514f1df51edf0573233e8fb49
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docoptio.hxx,v $
10 * $Revision: 1.7.32.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_DOCOPTIO_HXX
32 #define SC_DOCOPTIO_HXX
34 #include <unotools/configitem.hxx>
35 #include <svtools/poolitem.hxx>
36 #include <svtools/itemprop.hxx>
37 #include "scdllapi.h"
38 #include "optutil.hxx"
40 #include "formula/grammar.hxx"
42 class SC_DLLPUBLIC ScDocOptions
44 double fIterEps; // Epsilon-Wert dazu
45 USHORT nIterCount; // Anzahl
46 USHORT nPrecStandardFormat; // Nachkommastellen Standard
47 USHORT nDay; // Nulldatum:
48 USHORT nMonth;
49 USHORT nYear;
50 USHORT nYear2000; // bis zu welcher zweistelligen Jahreszahl 20xx angenommen wird
51 USHORT nTabDistance; // Abstand Standardtabulatoren
52 BOOL bIsIgnoreCase; // Gross-/Kleinschr. bei Vergleichen
53 BOOL bIsIter; // Iteration bei cirk. Ref
54 BOOL bCalcAsShown; // berechnen wie angezeigt (Precision)
55 BOOL bMatchWholeCell; // Suchkriterien muessen ganze Zelle matchen
56 BOOL bDoAutoSpell; // Auto-Spelling
57 BOOL bLookUpColRowNames; // Spalten-/Zeilenbeschriftungen automagisch suchen
58 BOOL bFormulaRegexEnabled; // regular expressions in formulas enabled
59 ::formula::FormulaGrammar::Grammar eFormulaGrammar; // formula grammar used to switch different formula syntax
61 ::rtl::OUString aFormulaSepArg;
62 ::rtl::OUString aFormulaSepArrayRow;
63 ::rtl::OUString aFormulaSepArrayCol;
65 public:
66 ScDocOptions();
67 ScDocOptions( const ScDocOptions& rCpy );
68 ~ScDocOptions();
70 BOOL IsLookUpColRowNames() const { return bLookUpColRowNames; }
71 void SetLookUpColRowNames( BOOL bVal ) { bLookUpColRowNames = bVal; }
72 BOOL IsAutoSpell() const { return bDoAutoSpell; }
73 void SetAutoSpell( BOOL bVal ) { bDoAutoSpell = bVal; }
74 BOOL IsMatchWholeCell() const { return bMatchWholeCell; }
75 void SetMatchWholeCell( BOOL bVal ){ bMatchWholeCell = bVal; }
76 BOOL IsIgnoreCase() const { return bIsIgnoreCase; }
77 void SetIgnoreCase( BOOL bVal ) { bIsIgnoreCase = bVal; }
78 BOOL IsIter() const { return bIsIter; }
79 void SetIter( BOOL bVal ) { bIsIter = bVal; }
80 USHORT GetIterCount() const { return nIterCount; }
81 void SetIterCount( USHORT nCount) { nIterCount = nCount; }
82 double GetIterEps() const { return fIterEps; }
83 void SetIterEps( double fEps ) { fIterEps = fEps; }
85 void GetDate( USHORT& rD, USHORT& rM, USHORT& rY ) const
86 { rD = nDay; rM = nMonth; rY = nYear;}
87 void SetDate (USHORT nD, USHORT nM, USHORT nY)
88 { nDay = nD; nMonth = nM; nYear = nY; }
89 USHORT GetTabDistance() const { return nTabDistance;}
90 void SetTabDistance( USHORT nTabDist ) {nTabDistance = nTabDist;}
92 void ResetDocOptions();
93 inline void CopyTo(ScDocOptions& rOpt);
95 inline const ScDocOptions& operator=( const ScDocOptions& rOpt );
96 inline int operator==( const ScDocOptions& rOpt ) const;
97 inline int operator!=( const ScDocOptions& rOpt ) const;
99 USHORT GetStdPrecision() const { return nPrecStandardFormat; }
100 void SetStdPrecision( USHORT n ) { nPrecStandardFormat = n; }
102 BOOL IsCalcAsShown() const { return bCalcAsShown; }
103 void SetCalcAsShown( BOOL bVal ) { bCalcAsShown = bVal; }
105 void SetYear2000( USHORT nVal ) { nYear2000 = nVal; }
106 USHORT GetYear2000() const { return nYear2000; }
108 void SetFormulaRegexEnabled( BOOL bVal ) { bFormulaRegexEnabled = bVal; }
109 BOOL IsFormulaRegexEnabled() const { return bFormulaRegexEnabled; }
111 void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; }
112 ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; }
114 void SetFormulaSepArg(const ::rtl::OUString& rSep) { aFormulaSepArg = rSep; }
115 ::rtl::OUString GetFormulaSepArg() const { return aFormulaSepArg; }
117 void SetFormulaSepArrayRow(const ::rtl::OUString& rSep) { aFormulaSepArrayRow = rSep; }
118 ::rtl::OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; }
120 void SetFormulaSepArrayCol(const ::rtl::OUString& rSep) { aFormulaSepArrayCol = rSep; }
121 ::rtl::OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; }
123 const LocaleDataWrapper& GetLocaleDataWrapper() const;
127 inline void ScDocOptions::CopyTo(ScDocOptions& rOpt)
129 rOpt.bIsIgnoreCase = bIsIgnoreCase;
130 rOpt.bIsIter = bIsIter;
131 rOpt.nIterCount = nIterCount;
132 rOpt.fIterEps = fIterEps;
133 rOpt.nPrecStandardFormat = nPrecStandardFormat;
134 rOpt.nDay = nDay;
135 rOpt.nMonth = nMonth;
136 rOpt.nYear2000 = nYear2000;
137 rOpt.nYear = nYear;
138 rOpt.nTabDistance = nTabDistance;
139 rOpt.bCalcAsShown = bCalcAsShown;
140 rOpt.bMatchWholeCell = bMatchWholeCell;
141 rOpt.bDoAutoSpell = bDoAutoSpell;
142 rOpt.bLookUpColRowNames = bLookUpColRowNames;
143 rOpt.bFormulaRegexEnabled = bFormulaRegexEnabled;
144 rOpt.eFormulaGrammar = eFormulaGrammar;
145 rOpt.aFormulaSepArg = aFormulaSepArg;
146 rOpt.aFormulaSepArrayRow = aFormulaSepArrayRow;
147 rOpt.aFormulaSepArrayCol = aFormulaSepArrayCol;
150 inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
152 bIsIgnoreCase = rCpy.bIsIgnoreCase;
153 bIsIter = rCpy.bIsIter;
154 nIterCount = rCpy.nIterCount;
155 fIterEps = rCpy.fIterEps;
156 nPrecStandardFormat = rCpy.nPrecStandardFormat;
157 nDay = rCpy.nDay;
158 nMonth = rCpy.nMonth;
159 nYear = rCpy.nYear;
160 nYear2000 = rCpy.nYear2000;
161 nTabDistance = rCpy.nTabDistance;
162 bCalcAsShown = rCpy.bCalcAsShown;
163 bMatchWholeCell = rCpy.bMatchWholeCell;
164 bDoAutoSpell = rCpy.bDoAutoSpell;
165 bLookUpColRowNames = rCpy.bLookUpColRowNames;
166 bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled;
167 eFormulaGrammar = rCpy.eFormulaGrammar;
168 aFormulaSepArg = rCpy.aFormulaSepArg;
169 aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow;
170 aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol;
172 return *this;
175 inline int ScDocOptions::operator==( const ScDocOptions& rOpt ) const
177 return (
178 rOpt.bIsIgnoreCase == bIsIgnoreCase
179 && rOpt.bIsIter == bIsIter
180 && rOpt.nIterCount == nIterCount
181 && rOpt.fIterEps == fIterEps
182 && rOpt.nPrecStandardFormat == nPrecStandardFormat
183 && rOpt.nDay == nDay
184 && rOpt.nMonth == nMonth
185 && rOpt.nYear == nYear
186 && rOpt.nYear2000 == nYear2000
187 && rOpt.nTabDistance == nTabDistance
188 && rOpt.bCalcAsShown == bCalcAsShown
189 && rOpt.bMatchWholeCell == bMatchWholeCell
190 && rOpt.bDoAutoSpell == bDoAutoSpell
191 && rOpt.bLookUpColRowNames == bLookUpColRowNames
192 && rOpt.bFormulaRegexEnabled == bFormulaRegexEnabled
193 && rOpt.eFormulaGrammar == eFormulaGrammar
194 && rOpt.aFormulaSepArg == aFormulaSepArg
195 && rOpt.aFormulaSepArrayRow == aFormulaSepArrayRow
196 && rOpt.aFormulaSepArrayCol == aFormulaSepArrayCol
200 inline int ScDocOptions::operator!=( const ScDocOptions& rOpt ) const
202 return !(operator==(rOpt));
205 //==================================================================
206 // Item fuer Einstellungsdialog - Berechnen
207 //==================================================================
209 class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem
211 public:
212 TYPEINFO();
213 //UNUSED2008-05 ScTpCalcItem( USHORT nWhich );
214 ScTpCalcItem( USHORT nWhich,
215 const ScDocOptions& rOpt );
216 ScTpCalcItem( const ScTpCalcItem& rItem );
217 ~ScTpCalcItem();
219 virtual String GetValueText() const;
220 virtual int operator==( const SfxPoolItem& ) const;
221 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
223 const ScDocOptions& GetDocOptions() const { return theOptions; }
225 private:
226 ScDocOptions theOptions;
229 //==================================================================
230 // Config Item containing document options
231 //==================================================================
233 class ScDocCfg : public ScDocOptions
235 ScLinkConfigItem aCalcItem;
236 ScLinkConfigItem aFormulaItem;
237 ScLinkConfigItem aLayoutItem;
239 DECL_LINK( CalcCommitHdl, void* );
240 DECL_LINK( FormulaCommitHdl, void* );
241 DECL_LINK( LayoutCommitHdl, void* );
243 com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames();
244 com::sun::star::uno::Sequence<rtl::OUString> GetFormulaPropertyNames();
245 com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
247 public:
248 ScDocCfg();
250 void SetOptions( const ScDocOptions& rNew );
254 #endif