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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sc.hxx" 30 31 32 33 34 #include "formel.hxx" 35 36 37 38 39 _ScRangeList::~_ScRangeList() 40 { 41 ScRange* p = ( ScRange* ) First(); 42 43 while( p ) 44 { 45 delete p; 46 p = ( ScRange* ) Next(); 47 } 48 } 49 50 51 52 53 _ScRangeListTabs::_ScRangeListTabs( void ) 54 { 55 ppTabLists = new _ScRangeList*[ MAXTAB + 1 ]; 56 57 for( sal_uInt16 n = 0 ; n <= MAXTAB ; n++ ) 58 ppTabLists[ n ] = NULL; 59 60 bHasRanges = sal_False; 61 pAct = NULL; 62 nAct = 0; 63 } 64 65 66 _ScRangeListTabs::~_ScRangeListTabs() 67 { 68 if( bHasRanges ) 69 { 70 for( sal_uInt16 n = 0 ; n <= MAXTAB ; n++ ) 71 { 72 if( ppTabLists[ n ] ) 73 delete ppTabLists[ n ]; 74 } 75 } 76 77 delete[] ppTabLists; 78 } 79 80 81 void _ScRangeListTabs::Append( ScSingleRefData a, const sal_Bool b ) 82 { 83 if( b ) 84 { 85 if( a.nTab > MAXTAB ) 86 a.nTab = MAXTAB; 87 88 if( a.nCol > MAXCOL ) 89 a.nCol = MAXCOL; 90 91 if( a.nRow > MAXROW ) 92 a.nRow = MAXROW; 93 } 94 else 95 { 96 DBG_ASSERT( ValidTab(a.nTab), "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" ); 97 } 98 99 bHasRanges = sal_True; 100 101 if( a.nTab >= 0 ) 102 { 103 _ScRangeList* p = ppTabLists[ a.nTab ]; 104 105 if( !p ) 106 p = ppTabLists[ a.nTab ] = new _ScRangeList; 107 108 p->Append( a ); 109 } 110 } 111 112 113 void _ScRangeListTabs::Append( ScComplexRefData a, const sal_Bool b ) 114 { 115 if( b ) 116 { 117 // #96263# ignore 3D ranges 118 if( a.Ref1.nTab != a.Ref2.nTab ) 119 return; 120 121 SCsTAB& rTab = a.Ref1.nTab; 122 if( rTab > MAXTAB ) 123 rTab = MAXTAB; 124 else if( rTab < 0 ) 125 rTab = 0; 126 127 SCsCOL& rCol1 = a.Ref1.nCol; 128 if( rCol1 > MAXCOL ) 129 rCol1 = MAXCOL; 130 else if( rCol1 < 0 ) 131 rCol1 = 0; 132 133 SCsROW& rRow1 = a.Ref1.nRow; 134 if( rRow1 > MAXROW ) 135 rRow1 = MAXROW; 136 else if( rRow1 < 0 ) 137 rRow1 = 0; 138 139 SCsCOL& rCol2 = a.Ref2.nCol; 140 if( rCol2 > MAXCOL ) 141 rCol2 = MAXCOL; 142 else if( rCol2 < 0 ) 143 rCol2 = 0; 144 145 SCsROW& rRow2 = a.Ref2.nRow; 146 if( rRow2 > MAXROW ) 147 rRow2 = MAXROW; 148 else if( rRow2 < 0 ) 149 rRow2 = 0; 150 } 151 else 152 { 153 DBG_ASSERT( ValidTab(a.Ref1.nTab), 154 "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" ); 155 DBG_ASSERT( a.Ref1.nTab == a.Ref2.nTab, 156 "+_ScRangeListTabs::Append(): 3D-Ranges werden in SC nicht unterstuetzt!" ); 157 } 158 159 bHasRanges = sal_True; 160 161 if( a.Ref1.nTab >= 0 ) 162 { 163 _ScRangeList* p = ppTabLists[ a.Ref1.nTab ]; 164 165 if( !p ) 166 p = ppTabLists[ a.Ref1.nTab ] = new _ScRangeList; 167 168 p->Append( a ); 169 } 170 } 171 172 173 const ScRange* _ScRangeListTabs::First( const sal_uInt16 n ) 174 { 175 DBG_ASSERT( ValidTab(n), "-_ScRangeListTabs::First(): Und tschuessssssss!" ); 176 177 if( ppTabLists[ n ] ) 178 { 179 pAct = ppTabLists[ n ]; 180 nAct = n; 181 return pAct->First(); 182 } 183 else 184 { 185 pAct = NULL; 186 nAct = 0; 187 return NULL; 188 } 189 } 190 191 192 const ScRange* _ScRangeListTabs::Next( void ) 193 { 194 if( pAct ) 195 return pAct->Next(); 196 else 197 return NULL; 198 } 199 200 201 202 203 ConverterBase::ConverterBase( sal_uInt16 nNewBuffer ) : 204 aEingPos( 0, 0, 0 ), 205 eStatus( ConvOK ), 206 nBufferSize( nNewBuffer ) 207 { 208 DBG_ASSERT( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" ); 209 pBuffer = new sal_Char[ nNewBuffer ]; 210 } 211 212 ConverterBase::~ConverterBase() 213 { 214 delete[] pBuffer; 215 } 216 217 void ConverterBase::Reset() 218 { 219 eStatus = ConvOK; 220 aPool.Reset(); 221 aStack.Reset(); 222 } 223 224 225 226 227 ExcelConverterBase::ExcelConverterBase( sal_uInt16 nNewBuffer ) : 228 ConverterBase( nNewBuffer ) 229 { 230 } 231 232 ExcelConverterBase::~ExcelConverterBase() 233 { 234 } 235 236 void ExcelConverterBase::Reset( const ScAddress& rEingPos ) 237 { 238 ConverterBase::Reset(); 239 aEingPos = rEingPos; 240 } 241 242 void ExcelConverterBase::Reset() 243 { 244 ConverterBase::Reset(); 245 aEingPos.Set( 0, 0, 0 ); 246 } 247 248 249 250 251 LotusConverterBase::LotusConverterBase( SvStream &rStr, sal_uInt16 nNewBuffer ) : 252 ConverterBase( nNewBuffer ), 253 aIn( rStr ), 254 nBytesLeft( 0 ) 255 { 256 } 257 258 LotusConverterBase::~LotusConverterBase() 259 { 260 } 261 262 //UNUSED2008-05 void LotusConverterBase::Reset( sal_Int32 nLen, const ScAddress& rEingPos ) 263 //UNUSED2008-05 { 264 //UNUSED2008-05 ConverterBase::Reset(); 265 //UNUSED2008-05 nBytesLeft = nLen; 266 //UNUSED2008-05 aEingPos = rEingPos; 267 //UNUSED2008-05 } 268 //UNUSED2008-05 269 //UNUSED2008-05 void LotusConverterBase::Reset( sal_Int32 nLen ) 270 //UNUSED2008-05 { 271 //UNUSED2008-05 ConverterBase::Reset(); 272 //UNUSED2008-05 nBytesLeft = nLen; 273 //UNUSED2008-05 aEingPos.Set( 0, 0, 0 ); 274 //UNUSED2008-05 } 275 276 void LotusConverterBase::Reset( const ScAddress& rEingPos ) 277 { 278 ConverterBase::Reset(); 279 nBytesLeft = 0; 280 aEingPos = rEingPos; 281 } 282 283