1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_DOCOPTIO_HXX 29 #define SC_DOCOPTIO_HXX 30 31 #include <unotools/configitem.hxx> 32 #include <svl/poolitem.hxx> 33 #include <svl/itemprop.hxx> 34 #include "scdllapi.h" 35 #include "optutil.hxx" 36 37 class SC_DLLPUBLIC ScDocOptions 38 { 39 double fIterEps; // Epsilon-Wert dazu 40 sal_uInt16 nIterCount; // Anzahl 41 sal_uInt16 nPrecStandardFormat; // precision for standard format 42 sal_uInt16 nDay; // Nulldatum: 43 sal_uInt16 nMonth; 44 sal_uInt16 nYear; 45 sal_uInt16 nYear2000; // bis zu welcher zweistelligen Jahreszahl 20xx angenommen wird 46 sal_uInt16 nTabDistance; // Abstand Standardtabulatoren 47 sal_Bool bIsIgnoreCase; // Gross-/Kleinschr. bei Vergleichen 48 sal_Bool bIsIter; // Iteration bei cirk. Ref 49 sal_Bool bCalcAsShown; // berechnen wie angezeigt (Precision) 50 sal_Bool bMatchWholeCell; // Suchkriterien muessen ganze Zelle matchen 51 sal_Bool bDoAutoSpell; // Auto-Spelling 52 sal_Bool bLookUpColRowNames; // Spalten-/Zeilenbeschriftungen automagisch suchen 53 sal_Bool bFormulaRegexEnabled; // regular expressions in formulas enabled 54 55 public: 56 ScDocOptions(); 57 ScDocOptions( const ScDocOptions& rCpy ); 58 ~ScDocOptions(); 59 60 sal_Bool IsLookUpColRowNames() const { return bLookUpColRowNames; } 61 void SetLookUpColRowNames( sal_Bool bVal ) { bLookUpColRowNames = bVal; } 62 sal_Bool IsAutoSpell() const { return bDoAutoSpell; } 63 void SetAutoSpell( sal_Bool bVal ) { bDoAutoSpell = bVal; } 64 sal_Bool IsMatchWholeCell() const { return bMatchWholeCell; } 65 void SetMatchWholeCell( sal_Bool bVal ){ bMatchWholeCell = bVal; } 66 sal_Bool IsIgnoreCase() const { return bIsIgnoreCase; } 67 void SetIgnoreCase( sal_Bool bVal ) { bIsIgnoreCase = bVal; } 68 sal_Bool IsIter() const { return bIsIter; } 69 void SetIter( sal_Bool bVal ) { bIsIter = bVal; } 70 sal_uInt16 GetIterCount() const { return nIterCount; } 71 void SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; } 72 double GetIterEps() const { return fIterEps; } 73 void SetIterEps( double fEps ) { fIterEps = fEps; } 74 75 void GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_uInt16& rY ) const 76 { rD = nDay; rM = nMonth; rY = nYear;} 77 void SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_uInt16 nY) 78 { nDay = nD; nMonth = nM; nYear = nY; } 79 sal_uInt16 GetTabDistance() const { return nTabDistance;} 80 void SetTabDistance( sal_uInt16 nTabDist ) {nTabDistance = nTabDist;} 81 82 void ResetDocOptions(); 83 inline void CopyTo(ScDocOptions& rOpt); 84 85 inline const ScDocOptions& operator=( const ScDocOptions& rOpt ); 86 inline int operator==( const ScDocOptions& rOpt ) const; 87 inline int operator!=( const ScDocOptions& rOpt ) const; 88 89 sal_uInt16 GetStdPrecision() const { return nPrecStandardFormat; } 90 void SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; } 91 92 sal_Bool IsCalcAsShown() const { return bCalcAsShown; } 93 void SetCalcAsShown( sal_Bool bVal ) { bCalcAsShown = bVal; } 94 95 void SetYear2000( sal_uInt16 nVal ) { nYear2000 = nVal; } 96 sal_uInt16 GetYear2000() const { return nYear2000; } 97 98 void SetFormulaRegexEnabled( sal_Bool bVal ) { bFormulaRegexEnabled = bVal; } 99 sal_Bool IsFormulaRegexEnabled() const { return bFormulaRegexEnabled; } 100 }; 101 102 103 inline void ScDocOptions::CopyTo(ScDocOptions& rOpt) 104 { 105 rOpt.bIsIgnoreCase = bIsIgnoreCase; 106 rOpt.bIsIter = bIsIter; 107 rOpt.nIterCount = nIterCount; 108 rOpt.fIterEps = fIterEps; 109 rOpt.nPrecStandardFormat = nPrecStandardFormat; 110 rOpt.nDay = nDay; 111 rOpt.nMonth = nMonth; 112 rOpt.nYear2000 = nYear2000; 113 rOpt.nYear = nYear; 114 rOpt.nTabDistance = nTabDistance; 115 rOpt.bCalcAsShown = bCalcAsShown; 116 rOpt.bMatchWholeCell = bMatchWholeCell; 117 rOpt.bDoAutoSpell = bDoAutoSpell; 118 rOpt.bLookUpColRowNames = bLookUpColRowNames; 119 rOpt.bFormulaRegexEnabled = bFormulaRegexEnabled; 120 } 121 122 inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy ) 123 { 124 bIsIgnoreCase = rCpy.bIsIgnoreCase; 125 bIsIter = rCpy.bIsIter; 126 nIterCount = rCpy.nIterCount; 127 fIterEps = rCpy.fIterEps; 128 nPrecStandardFormat = rCpy.nPrecStandardFormat; 129 nDay = rCpy.nDay; 130 nMonth = rCpy.nMonth; 131 nYear = rCpy.nYear; 132 nYear2000 = rCpy.nYear2000; 133 nTabDistance = rCpy.nTabDistance; 134 bCalcAsShown = rCpy.bCalcAsShown; 135 bMatchWholeCell = rCpy.bMatchWholeCell; 136 bDoAutoSpell = rCpy.bDoAutoSpell; 137 bLookUpColRowNames = rCpy.bLookUpColRowNames; 138 bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled; 139 140 return *this; 141 } 142 143 inline int ScDocOptions::operator==( const ScDocOptions& rOpt ) const 144 { 145 return ( 146 rOpt.bIsIgnoreCase == bIsIgnoreCase 147 && rOpt.bIsIter == bIsIter 148 && rOpt.nIterCount == nIterCount 149 && rOpt.fIterEps == fIterEps 150 && rOpt.nPrecStandardFormat == nPrecStandardFormat 151 && rOpt.nDay == nDay 152 && rOpt.nMonth == nMonth 153 && rOpt.nYear == nYear 154 && rOpt.nYear2000 == nYear2000 155 && rOpt.nTabDistance == nTabDistance 156 && rOpt.bCalcAsShown == bCalcAsShown 157 && rOpt.bMatchWholeCell == bMatchWholeCell 158 && rOpt.bDoAutoSpell == bDoAutoSpell 159 && rOpt.bLookUpColRowNames == bLookUpColRowNames 160 && rOpt.bFormulaRegexEnabled == bFormulaRegexEnabled 161 ); 162 } 163 164 inline int ScDocOptions::operator!=( const ScDocOptions& rOpt ) const 165 { 166 return !(operator==(rOpt)); 167 } 168 169 //================================================================== 170 // Item fuer Einstellungsdialog - Berechnen 171 //================================================================== 172 173 class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem 174 { 175 public: 176 TYPEINFO(); 177 //UNUSED2008-05 ScTpCalcItem( sal_uInt16 nWhich ); 178 ScTpCalcItem( sal_uInt16 nWhich, 179 const ScDocOptions& rOpt ); 180 ScTpCalcItem( const ScTpCalcItem& rItem ); 181 ~ScTpCalcItem(); 182 183 virtual String GetValueText() const; 184 virtual int operator==( const SfxPoolItem& ) const; 185 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 186 187 const ScDocOptions& GetDocOptions() const { return theOptions; } 188 189 private: 190 ScDocOptions theOptions; 191 }; 192 193 //================================================================== 194 // Config Item containing document options 195 //================================================================== 196 197 class ScDocCfg : public ScDocOptions 198 { 199 ScLinkConfigItem aCalcItem; 200 ScLinkConfigItem aLayoutItem; 201 202 DECL_LINK( CalcCommitHdl, void* ); 203 DECL_LINK( LayoutCommitHdl, void* ); 204 205 com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames(); 206 com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames(); 207 208 public: 209 ScDocCfg(); 210 211 void SetOptions( const ScDocOptions& rNew ); 212 }; 213 214 215 #endif 216 217