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