1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*38d50f7bSAndrew Rist * distributed with this work for additional information
6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at
10*38d50f7bSAndrew Rist *
11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist *
13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the
17*38d50f7bSAndrew Rist * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist * under the License.
19*38d50f7bSAndrew Rist *
20*38d50f7bSAndrew Rist *************************************************************/
21*38d50f7bSAndrew Rist
22*38d50f7bSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef SC_DOCOPTIO_HXX
25cdf0e10cSrcweir #define SC_DOCOPTIO_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <unotools/configitem.hxx>
28cdf0e10cSrcweir #include <svl/poolitem.hxx>
29cdf0e10cSrcweir #include <svl/itemprop.hxx>
30cdf0e10cSrcweir #include "scdllapi.h"
31cdf0e10cSrcweir #include "optutil.hxx"
32cdf0e10cSrcweir
33cdf0e10cSrcweir class SC_DLLPUBLIC ScDocOptions
34cdf0e10cSrcweir {
35cdf0e10cSrcweir double fIterEps; // Epsilon-Wert dazu
36cdf0e10cSrcweir sal_uInt16 nIterCount; // Anzahl
37cdf0e10cSrcweir sal_uInt16 nPrecStandardFormat; // precision for standard format
38cdf0e10cSrcweir sal_uInt16 nDay; // Nulldatum:
39cdf0e10cSrcweir sal_uInt16 nMonth;
40cdf0e10cSrcweir sal_uInt16 nYear;
41cdf0e10cSrcweir sal_uInt16 nYear2000; // bis zu welcher zweistelligen Jahreszahl 20xx angenommen wird
42cdf0e10cSrcweir sal_uInt16 nTabDistance; // Abstand Standardtabulatoren
43cdf0e10cSrcweir sal_Bool bIsIgnoreCase; // Gross-/Kleinschr. bei Vergleichen
44cdf0e10cSrcweir sal_Bool bIsIter; // Iteration bei cirk. Ref
45cdf0e10cSrcweir sal_Bool bCalcAsShown; // berechnen wie angezeigt (Precision)
46cdf0e10cSrcweir sal_Bool bMatchWholeCell; // Suchkriterien muessen ganze Zelle matchen
47cdf0e10cSrcweir sal_Bool bDoAutoSpell; // Auto-Spelling
48cdf0e10cSrcweir sal_Bool bLookUpColRowNames; // Spalten-/Zeilenbeschriftungen automagisch suchen
49cdf0e10cSrcweir sal_Bool bFormulaRegexEnabled; // regular expressions in formulas enabled
50cdf0e10cSrcweir
51cdf0e10cSrcweir public:
52cdf0e10cSrcweir ScDocOptions();
53cdf0e10cSrcweir ScDocOptions( const ScDocOptions& rCpy );
54cdf0e10cSrcweir ~ScDocOptions();
55cdf0e10cSrcweir
IsLookUpColRowNames() const56cdf0e10cSrcweir sal_Bool IsLookUpColRowNames() const { return bLookUpColRowNames; }
SetLookUpColRowNames(sal_Bool bVal)57cdf0e10cSrcweir void SetLookUpColRowNames( sal_Bool bVal ) { bLookUpColRowNames = bVal; }
IsAutoSpell() const58cdf0e10cSrcweir sal_Bool IsAutoSpell() const { return bDoAutoSpell; }
SetAutoSpell(sal_Bool bVal)59cdf0e10cSrcweir void SetAutoSpell( sal_Bool bVal ) { bDoAutoSpell = bVal; }
IsMatchWholeCell() const60cdf0e10cSrcweir sal_Bool IsMatchWholeCell() const { return bMatchWholeCell; }
SetMatchWholeCell(sal_Bool bVal)61cdf0e10cSrcweir void SetMatchWholeCell( sal_Bool bVal ){ bMatchWholeCell = bVal; }
IsIgnoreCase() const62cdf0e10cSrcweir sal_Bool IsIgnoreCase() const { return bIsIgnoreCase; }
SetIgnoreCase(sal_Bool bVal)63cdf0e10cSrcweir void SetIgnoreCase( sal_Bool bVal ) { bIsIgnoreCase = bVal; }
IsIter() const64cdf0e10cSrcweir sal_Bool IsIter() const { return bIsIter; }
SetIter(sal_Bool bVal)65cdf0e10cSrcweir void SetIter( sal_Bool bVal ) { bIsIter = bVal; }
GetIterCount() const66cdf0e10cSrcweir sal_uInt16 GetIterCount() const { return nIterCount; }
SetIterCount(sal_uInt16 nCount)67cdf0e10cSrcweir void SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; }
GetIterEps() const68cdf0e10cSrcweir double GetIterEps() const { return fIterEps; }
SetIterEps(double fEps)69cdf0e10cSrcweir void SetIterEps( double fEps ) { fIterEps = fEps; }
70cdf0e10cSrcweir
GetDate(sal_uInt16 & rD,sal_uInt16 & rM,sal_uInt16 & rY) const71cdf0e10cSrcweir void GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_uInt16& rY ) const
72cdf0e10cSrcweir { rD = nDay; rM = nMonth; rY = nYear;}
SetDate(sal_uInt16 nD,sal_uInt16 nM,sal_uInt16 nY)73cdf0e10cSrcweir void SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_uInt16 nY)
74cdf0e10cSrcweir { nDay = nD; nMonth = nM; nYear = nY; }
GetTabDistance() const75cdf0e10cSrcweir sal_uInt16 GetTabDistance() const { return nTabDistance;}
SetTabDistance(sal_uInt16 nTabDist)76cdf0e10cSrcweir void SetTabDistance( sal_uInt16 nTabDist ) {nTabDistance = nTabDist;}
77cdf0e10cSrcweir
78cdf0e10cSrcweir void ResetDocOptions();
79cdf0e10cSrcweir inline void CopyTo(ScDocOptions& rOpt);
80cdf0e10cSrcweir
81cdf0e10cSrcweir inline const ScDocOptions& operator=( const ScDocOptions& rOpt );
82cdf0e10cSrcweir inline int operator==( const ScDocOptions& rOpt ) const;
83cdf0e10cSrcweir inline int operator!=( const ScDocOptions& rOpt ) const;
84cdf0e10cSrcweir
GetStdPrecision() const85cdf0e10cSrcweir sal_uInt16 GetStdPrecision() const { return nPrecStandardFormat; }
SetStdPrecision(sal_uInt16 n)86cdf0e10cSrcweir void SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; }
87cdf0e10cSrcweir
IsCalcAsShown() const88cdf0e10cSrcweir sal_Bool IsCalcAsShown() const { return bCalcAsShown; }
SetCalcAsShown(sal_Bool bVal)89cdf0e10cSrcweir void SetCalcAsShown( sal_Bool bVal ) { bCalcAsShown = bVal; }
90cdf0e10cSrcweir
SetYear2000(sal_uInt16 nVal)91cdf0e10cSrcweir void SetYear2000( sal_uInt16 nVal ) { nYear2000 = nVal; }
GetYear2000() const92cdf0e10cSrcweir sal_uInt16 GetYear2000() const { return nYear2000; }
93cdf0e10cSrcweir
SetFormulaRegexEnabled(sal_Bool bVal)94cdf0e10cSrcweir void SetFormulaRegexEnabled( sal_Bool bVal ) { bFormulaRegexEnabled = bVal; }
IsFormulaRegexEnabled() const95cdf0e10cSrcweir sal_Bool IsFormulaRegexEnabled() const { return bFormulaRegexEnabled; }
96cdf0e10cSrcweir };
97cdf0e10cSrcweir
98cdf0e10cSrcweir
CopyTo(ScDocOptions & rOpt)99cdf0e10cSrcweir inline void ScDocOptions::CopyTo(ScDocOptions& rOpt)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir rOpt.bIsIgnoreCase = bIsIgnoreCase;
102cdf0e10cSrcweir rOpt.bIsIter = bIsIter;
103cdf0e10cSrcweir rOpt.nIterCount = nIterCount;
104cdf0e10cSrcweir rOpt.fIterEps = fIterEps;
105cdf0e10cSrcweir rOpt.nPrecStandardFormat = nPrecStandardFormat;
106cdf0e10cSrcweir rOpt.nDay = nDay;
107cdf0e10cSrcweir rOpt.nMonth = nMonth;
108cdf0e10cSrcweir rOpt.nYear2000 = nYear2000;
109cdf0e10cSrcweir rOpt.nYear = nYear;
110cdf0e10cSrcweir rOpt.nTabDistance = nTabDistance;
111cdf0e10cSrcweir rOpt.bCalcAsShown = bCalcAsShown;
112cdf0e10cSrcweir rOpt.bMatchWholeCell = bMatchWholeCell;
113cdf0e10cSrcweir rOpt.bDoAutoSpell = bDoAutoSpell;
114cdf0e10cSrcweir rOpt.bLookUpColRowNames = bLookUpColRowNames;
115cdf0e10cSrcweir rOpt.bFormulaRegexEnabled = bFormulaRegexEnabled;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
operator =(const ScDocOptions & rCpy)118cdf0e10cSrcweir inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy )
119cdf0e10cSrcweir {
120cdf0e10cSrcweir bIsIgnoreCase = rCpy.bIsIgnoreCase;
121cdf0e10cSrcweir bIsIter = rCpy.bIsIter;
122cdf0e10cSrcweir nIterCount = rCpy.nIterCount;
123cdf0e10cSrcweir fIterEps = rCpy.fIterEps;
124cdf0e10cSrcweir nPrecStandardFormat = rCpy.nPrecStandardFormat;
125cdf0e10cSrcweir nDay = rCpy.nDay;
126cdf0e10cSrcweir nMonth = rCpy.nMonth;
127cdf0e10cSrcweir nYear = rCpy.nYear;
128cdf0e10cSrcweir nYear2000 = rCpy.nYear2000;
129cdf0e10cSrcweir nTabDistance = rCpy.nTabDistance;
130cdf0e10cSrcweir bCalcAsShown = rCpy.bCalcAsShown;
131cdf0e10cSrcweir bMatchWholeCell = rCpy.bMatchWholeCell;
132cdf0e10cSrcweir bDoAutoSpell = rCpy.bDoAutoSpell;
133cdf0e10cSrcweir bLookUpColRowNames = rCpy.bLookUpColRowNames;
134cdf0e10cSrcweir bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled;
135cdf0e10cSrcweir
136cdf0e10cSrcweir return *this;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir
operator ==(const ScDocOptions & rOpt) const139cdf0e10cSrcweir inline int ScDocOptions::operator==( const ScDocOptions& rOpt ) const
140cdf0e10cSrcweir {
141cdf0e10cSrcweir return (
142cdf0e10cSrcweir rOpt.bIsIgnoreCase == bIsIgnoreCase
143cdf0e10cSrcweir && rOpt.bIsIter == bIsIter
144cdf0e10cSrcweir && rOpt.nIterCount == nIterCount
145cdf0e10cSrcweir && rOpt.fIterEps == fIterEps
146cdf0e10cSrcweir && rOpt.nPrecStandardFormat == nPrecStandardFormat
147cdf0e10cSrcweir && rOpt.nDay == nDay
148cdf0e10cSrcweir && rOpt.nMonth == nMonth
149cdf0e10cSrcweir && rOpt.nYear == nYear
150cdf0e10cSrcweir && rOpt.nYear2000 == nYear2000
151cdf0e10cSrcweir && rOpt.nTabDistance == nTabDistance
152cdf0e10cSrcweir && rOpt.bCalcAsShown == bCalcAsShown
153cdf0e10cSrcweir && rOpt.bMatchWholeCell == bMatchWholeCell
154cdf0e10cSrcweir && rOpt.bDoAutoSpell == bDoAutoSpell
155cdf0e10cSrcweir && rOpt.bLookUpColRowNames == bLookUpColRowNames
156cdf0e10cSrcweir && rOpt.bFormulaRegexEnabled == bFormulaRegexEnabled
157cdf0e10cSrcweir );
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
operator !=(const ScDocOptions & rOpt) const160cdf0e10cSrcweir inline int ScDocOptions::operator!=( const ScDocOptions& rOpt ) const
161cdf0e10cSrcweir {
162cdf0e10cSrcweir return !(operator==(rOpt));
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
165cdf0e10cSrcweir //==================================================================
166cdf0e10cSrcweir // Item fuer Einstellungsdialog - Berechnen
167cdf0e10cSrcweir //==================================================================
168cdf0e10cSrcweir
169cdf0e10cSrcweir class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem
170cdf0e10cSrcweir {
171cdf0e10cSrcweir public:
172cdf0e10cSrcweir TYPEINFO();
173cdf0e10cSrcweir //UNUSED2008-05 ScTpCalcItem( sal_uInt16 nWhich );
174cdf0e10cSrcweir ScTpCalcItem( sal_uInt16 nWhich,
175cdf0e10cSrcweir const ScDocOptions& rOpt );
176cdf0e10cSrcweir ScTpCalcItem( const ScTpCalcItem& rItem );
177cdf0e10cSrcweir ~ScTpCalcItem();
178cdf0e10cSrcweir
179cdf0e10cSrcweir virtual String GetValueText() const;
180cdf0e10cSrcweir virtual int operator==( const SfxPoolItem& ) const;
181cdf0e10cSrcweir virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
182cdf0e10cSrcweir
GetDocOptions() const183cdf0e10cSrcweir const ScDocOptions& GetDocOptions() const { return theOptions; }
184cdf0e10cSrcweir
185cdf0e10cSrcweir private:
186cdf0e10cSrcweir ScDocOptions theOptions;
187cdf0e10cSrcweir };
188cdf0e10cSrcweir
189cdf0e10cSrcweir //==================================================================
190cdf0e10cSrcweir // Config Item containing document options
191cdf0e10cSrcweir //==================================================================
192cdf0e10cSrcweir
193cdf0e10cSrcweir class ScDocCfg : public ScDocOptions
194cdf0e10cSrcweir {
195cdf0e10cSrcweir ScLinkConfigItem aCalcItem;
196cdf0e10cSrcweir ScLinkConfigItem aLayoutItem;
197cdf0e10cSrcweir
198cdf0e10cSrcweir DECL_LINK( CalcCommitHdl, void* );
199cdf0e10cSrcweir DECL_LINK( LayoutCommitHdl, void* );
200cdf0e10cSrcweir
201cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames();
202cdf0e10cSrcweir com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames();
203cdf0e10cSrcweir
204cdf0e10cSrcweir public:
205cdf0e10cSrcweir ScDocCfg();
206cdf0e10cSrcweir
207cdf0e10cSrcweir void SetOptions( const ScDocOptions& rNew );
208cdf0e10cSrcweir };
209cdf0e10cSrcweir
210cdf0e10cSrcweir
211cdf0e10cSrcweir #endif
212cdf0e10cSrcweir
213