Update ooo320-m1
[ooovba.git] / sc / source / filter / excel / frmbase.cxx
bloba808a962466233803df52d25ebcfc2385d553355
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frmbase.cxx,v $
10 * $Revision: 1.10.32.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
37 #include "formel.hxx"
42 _ScRangeList::~_ScRangeList()
44 ScRange* p = ( ScRange* ) First();
46 while( p )
48 delete p;
49 p = ( ScRange* ) Next();
56 _ScRangeListTabs::_ScRangeListTabs( void )
58 ppTabLists = new _ScRangeList*[ MAXTAB + 1 ];
60 for( UINT16 n = 0 ; n <= MAXTAB ; n++ )
61 ppTabLists[ n ] = NULL;
63 bHasRanges = FALSE;
64 pAct = NULL;
65 nAct = 0;
69 _ScRangeListTabs::~_ScRangeListTabs()
71 if( bHasRanges )
73 for( UINT16 n = 0 ; n <= MAXTAB ; n++ )
75 if( ppTabLists[ n ] )
76 delete ppTabLists[ n ];
80 delete[] ppTabLists;
84 void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b )
86 if( b )
88 if( a.nTab > MAXTAB )
89 a.nTab = MAXTAB;
91 if( a.nCol > MAXCOL )
92 a.nCol = MAXCOL;
94 if( a.nRow > MAXROW )
95 a.nRow = MAXROW;
97 else
99 DBG_ASSERT( ValidTab(a.nTab), "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" );
102 bHasRanges = TRUE;
104 if( nTab == SCTAB_MAX)
105 return;
106 if( nTab < 0)
107 nTab = a.nTab;
109 if( nTab >= 0 )
111 _ScRangeList* p = ppTabLists[ nTab ];
113 if( !p )
114 p = ppTabLists[ nTab ] = new _ScRangeList;
116 p->Append( a );
121 void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b )
123 if( b )
125 // #96263# ignore 3D ranges
126 if( a.Ref1.nTab != a.Ref2.nTab )
127 return;
129 SCsTAB& rTab = a.Ref1.nTab;
130 if( rTab > MAXTAB )
131 rTab = MAXTAB;
132 else if( rTab < 0 )
133 rTab = 0;
135 SCsCOL& rCol1 = a.Ref1.nCol;
136 if( rCol1 > MAXCOL )
137 rCol1 = MAXCOL;
138 else if( rCol1 < 0 )
139 rCol1 = 0;
141 SCsROW& rRow1 = a.Ref1.nRow;
142 if( rRow1 > MAXROW )
143 rRow1 = MAXROW;
144 else if( rRow1 < 0 )
145 rRow1 = 0;
147 SCsCOL& rCol2 = a.Ref2.nCol;
148 if( rCol2 > MAXCOL )
149 rCol2 = MAXCOL;
150 else if( rCol2 < 0 )
151 rCol2 = 0;
153 SCsROW& rRow2 = a.Ref2.nRow;
154 if( rRow2 > MAXROW )
155 rRow2 = MAXROW;
156 else if( rRow2 < 0 )
157 rRow2 = 0;
159 else
161 DBG_ASSERT( ValidTab(a.Ref1.nTab),
162 "-_ScRangeListTabs::Append(): Luegen haben kurze Abstuerze!" );
163 DBG_ASSERT( a.Ref1.nTab == a.Ref2.nTab,
164 "+_ScRangeListTabs::Append(): 3D-Ranges werden in SC nicht unterstuetzt!" );
167 bHasRanges = TRUE;
169 if( nTab == SCTAB_MAX)
170 return;
171 if( nTab < -1)
172 nTab = a.Ref1.nTab;
174 if( nTab >= 0 )
176 _ScRangeList* p = ppTabLists[ nTab ];
178 if( !p )
179 p = ppTabLists[ nTab ] = new _ScRangeList;
181 p->Append( a );
186 const ScRange* _ScRangeListTabs::First( const UINT16 n )
188 DBG_ASSERT( ValidTab(n), "-_ScRangeListTabs::First(): Und tschuessssssss!" );
190 if( ppTabLists[ n ] )
192 pAct = ppTabLists[ n ];
193 nAct = n;
194 return pAct->First();
196 else
198 pAct = NULL;
199 nAct = 0;
200 return NULL;
205 const ScRange* _ScRangeListTabs::Next( void )
207 if( pAct )
208 return pAct->Next();
209 else
210 return NULL;
216 ConverterBase::ConverterBase( UINT16 nNewBuffer ) :
217 aEingPos( 0, 0, 0 ),
218 eStatus( ConvOK ),
219 nBufferSize( nNewBuffer )
221 DBG_ASSERT( nNewBuffer > 0, "ConverterBase::ConverterBase - nNewBuffer == 0!" );
222 pBuffer = new sal_Char[ nNewBuffer ];
225 ConverterBase::~ConverterBase()
227 delete[] pBuffer;
230 void ConverterBase::Reset()
232 eStatus = ConvOK;
233 aPool.Reset();
234 aStack.Reset();
240 ExcelConverterBase::ExcelConverterBase( UINT16 nNewBuffer ) :
241 ConverterBase( nNewBuffer )
245 ExcelConverterBase::~ExcelConverterBase()
249 void ExcelConverterBase::Reset( const ScAddress& rEingPos )
251 ConverterBase::Reset();
252 aEingPos = rEingPos;
255 void ExcelConverterBase::Reset()
257 ConverterBase::Reset();
258 aEingPos.Set( 0, 0, 0 );
261 ExcelConverterBase::ConvertParam::ConvertParam() :
262 mbAllowArrays(true),
263 mnArrayColSize(0),
264 mnArrayRowSize(0)
270 LotusConverterBase::LotusConverterBase( SvStream &rStr, UINT16 nNewBuffer ) :
271 ConverterBase( nNewBuffer ),
272 aIn( rStr ),
273 nBytesLeft( 0 )
277 LotusConverterBase::~LotusConverterBase()
281 //UNUSED2008-05 void LotusConverterBase::Reset( INT32 nLen, const ScAddress& rEingPos )
282 //UNUSED2008-05 {
283 //UNUSED2008-05 ConverterBase::Reset();
284 //UNUSED2008-05 nBytesLeft = nLen;
285 //UNUSED2008-05 aEingPos = rEingPos;
286 //UNUSED2008-05 }
287 //UNUSED2008-05
288 //UNUSED2008-05 void LotusConverterBase::Reset( INT32 nLen )
289 //UNUSED2008-05 {
290 //UNUSED2008-05 ConverterBase::Reset();
291 //UNUSED2008-05 nBytesLeft = nLen;
292 //UNUSED2008-05 aEingPos.Set( 0, 0, 0 );
293 //UNUSED2008-05 }
295 void LotusConverterBase::Reset( const ScAddress& rEingPos )
297 ConverterBase::Reset();
298 nBytesLeft = 0;
299 aEingPos = rEingPos;