1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sc.hxx" 26 27 28 29 30 #include "formel.hxx" 31 32 33 34 35 _ScRangeList::~_ScRangeList() 36 { 37 ScRange* p = ( ScRange* ) First(); 38 39 while( p ) 40 { 41 delete p; 42 p = ( ScRange* ) Next(); 43 } 44 } 45 46 47 48 49 _ScRangeListTabs::_ScRangeListTabs( void ) 50 { 51 ppTabLists = new _ScRangeList*[ MAXTAB + 1 ]; 52 53 for( sal_uInt16 n = 0 ; n <= MAXTAB ; n++ ) 54 ppTabLists[ n ] = NULL; 55 56 bHasRanges = sal_False; 57 pAct = NULL; 58 nAct = 0; 59 } 60 61 62 _ScRangeListTabs::~_ScRangeListTabs() 63 { 64 if( bHasRanges ) 65 { 66 for( sal_uInt16 n = 0 ; n <= MAXTAB ; n++ ) 67 { 68 if( ppTabLists[ n ] ) 69 delete ppTabLists[ n ]; 70 } 71 } 72 73 delete[] ppTabLists; 74 } 75 76 77 void _ScRangeListTabs::Append( ScSingleRefData a, const sal_Bool b ) 78 { 79 if( b ) 80 { 81 if( a.nTab > MAXTAB ) 82 a.nTab = MAXTAB; 83 84 if( a.nCol > MAXCOL ) 85 a.nCol = MAXCOL; 86 87 if( a.nRow > MAXROW ) 88 a.nRow = MAXROW; 89 } 90 else 91 { 92 DBG_ASSERT( ValidTab(a.nTab), "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" ); 93 } 94 95 bHasRanges = sal_True; 96 97 if( a.nTab >= 0 ) 98 { 99 _ScRangeList* p = ppTabLists[ a.nTab ]; 100 101 if( !p ) 102 p = ppTabLists[ a.nTab ] = new _ScRangeList; 103 104 p->Append( a ); 105 } 106 } 107 108 109 void _ScRangeListTabs::Append( ScComplexRefData a, const sal_Bool b ) 110 { 111 if( b ) 112 { 113 // #96263# ignore 3D ranges 114 if( a.Ref1.nTab != a.Ref2.nTab ) 115 return; 116 117 SCsTAB& rTab = a.Ref1.nTab; 118 if( rTab > MAXTAB ) 119 rTab = MAXTAB; 120 else if( rTab < 0 ) 121 rTab = 0; 122 123 SCsCOL& rCol1 = a.Ref1.nCol; 124 if( rCol1 > MAXCOL ) 125 rCol1 = MAXCOL; 126 else if( rCol1 < 0 ) 127 rCol1 = 0; 128 129 SCsROW& rRow1 = a.Ref1.nRow; 130 if( rRow1 > MAXROW ) 131 rRow1 = MAXROW; 132 else if( rRow1 < 0 ) 133 rRow1 = 0; 134 135 SCsCOL& rCol2 = a.Ref2.nCol; 136 if( rCol2 > MAXCOL ) 137 rCol2 = MAXCOL; 138 else if( rCol2 < 0 ) 139 rCol2 = 0; 140 141 SCsROW& rRow2 = a.Ref2.nRow; 142 if( rRow2 > MAXROW ) 143 rRow2 = MAXROW; 144 else if( rRow2 < 0 ) 145 rRow2 = 0; 146 } 147 else 148 { 149 DBG_ASSERT( ValidTab(a.Ref1.nTab), 150 "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" ); 151 DBG_ASSERT( a.Ref1.nTab == a.Ref2.nTab, 152 "+_ScRangeListTabs::Append(): 3D-Ranges werden in SC nicht unterstuetzt!" ); 153 } 154 155 bHasRanges = sal_True; 156 157 if( a.Ref1.nTab >= 0 ) 158 { 159 _ScRangeList* p = ppTabLists[ a.Ref1.nTab ]; 160 161 if( !p ) 162 p = ppTabLists[ a.Ref1.nTab ] = new _ScRangeList; 163 164 p->Append( a ); 165 } 166 } 167 168 169 const ScRange* _ScRangeListTabs::First( const sal_uInt16 n ) 170 { 171 DBG_ASSERT( ValidTab(n), "-_ScRangeListTabs::First(): Und tschuessssssss!" ); 172 173 if( ppTabLists[ n ] ) 174 { 175 pAct = ppTabLists[ n ]; 176 nAct = n; 177 return pAct->First(); 178 } 179 else 180 { 181 pAct = NULL; 182 nAct = 0; 183 return NULL; 184 } 185 } 186 187 188 const ScRange* _ScRangeListTabs::Next( void ) 189 { 190 if( pAct ) 191 return pAct->Next(); 192 else 193 return NULL; 194 } 195 196 197 198 199 ConverterBase::ConverterBase( sal_uInt16 nNewBuffer ) : 200 aEingPos( 0, 0, 0 ), 201 eStatus( ConvOK ), 202 nBufferSize( nNewBuffer ) 203 { 204 DBG_ASSERT( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" ); 205 pBuffer = new sal_Char[ nNewBuffer ]; 206 } 207 208 ConverterBase::~ConverterBase() 209 { 210 delete[] pBuffer; 211 } 212 213 void ConverterBase::Reset() 214 { 215 eStatus = ConvOK; 216 aPool.Reset(); 217 aStack.Reset(); 218 } 219 220 221 222 223 ExcelConverterBase::ExcelConverterBase( sal_uInt16 nNewBuffer ) : 224 ConverterBase( nNewBuffer ) 225 { 226 } 227 228 ExcelConverterBase::~ExcelConverterBase() 229 { 230 } 231 232 void ExcelConverterBase::Reset( const ScAddress& rEingPos ) 233 { 234 ConverterBase::Reset(); 235 aEingPos = rEingPos; 236 } 237 238 void ExcelConverterBase::Reset() 239 { 240 ConverterBase::Reset(); 241 aEingPos.Set( 0, 0, 0 ); 242 } 243 244 245 246 247 LotusConverterBase::LotusConverterBase( SvStream &rStr, sal_uInt16 nNewBuffer ) : 248 ConverterBase( nNewBuffer ), 249 aIn( rStr ), 250 nBytesLeft( 0 ) 251 { 252 } 253 254 LotusConverterBase::~LotusConverterBase() 255 { 256 } 257 258 //UNUSED2008-05 void LotusConverterBase::Reset( sal_Int32 nLen, const ScAddress& rEingPos ) 259 //UNUSED2008-05 { 260 //UNUSED2008-05 ConverterBase::Reset(); 261 //UNUSED2008-05 nBytesLeft = nLen; 262 //UNUSED2008-05 aEingPos = rEingPos; 263 //UNUSED2008-05 } 264 //UNUSED2008-05 265 //UNUSED2008-05 void LotusConverterBase::Reset( sal_Int32 nLen ) 266 //UNUSED2008-05 { 267 //UNUSED2008-05 ConverterBase::Reset(); 268 //UNUSED2008-05 nBytesLeft = nLen; 269 //UNUSED2008-05 aEingPos.Set( 0, 0, 0 ); 270 //UNUSED2008-05 } 271 272 void LotusConverterBase::Reset( const ScAddress& rEingPos ) 273 { 274 ConverterBase::Reset(); 275 nBytesLeft = 0; 276 aEingPos = rEingPos; 277 } 278 279