1 diff --git sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
2 index e412270..e71c60e 100644
3 --- sc/source/filter/excel/excform.cxx
4 +++ sc/source/filter/excel/excform.cxx
5 @@ -136,7 +136,7 @@ void ImportExcel::Formula( const XclAddress& rXclPos,
9 - eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
10 + eErr = pFormConv->Convert( pErgebnis, maStrm, nFormLen, ExcelToSc::ConvertParam(), FT_CellFormula);
12 ScFormulaCell* pZelle = NULL;
14 @@ -201,7 +201,8 @@ void ExcelToSc::GetDummy( const ScTokenArray*& pErgebnis )
15 // if bAllowArrays is false stream seeks to first byte after <nFormulaLen>
16 // otherwise it will seek to the first byte after the additional content (eg
17 // inline arrays) following <nFormulaLen>
18 -ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT )
19 +ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, sal_Size nFormulaLen,
20 + const ConvertParam& rParam, const FORMULA_TYPE eFT )
22 RootData& rR = GetOldRoot();
23 BYTE nOp, nLen, nByte;
24 @@ -472,7 +473,7 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
25 case 0x20: // Array Constant [317 268]
26 aIn >> nByte >> nUINT16;
27 aIn.Ignore( (meBiff == EXC_BIFF2) ? 3 : 4 );
29 + if( rParam.mbAllowArrays )
31 SCSIZE nC = nByte ? nByte : 256;
33 diff --git sc/source/filter/excel/excform8.cxx sc/source/filter/excel/excform8.cxx
34 index 4edef1a..63fe148 100644
35 --- sc/source/filter/excel/excform8.cxx
36 +++ sc/source/filter/excel/excform8.cxx
37 @@ -97,7 +97,8 @@ bool ExcelToSc8::Read3DTabReference( UINT16 nIxti, SCTAB& rFirstTab, SCTAB& rLas
39 // if bAllowArrays is false stream seeks to first byte after <nFormulaLen>
40 // otherwise it will seek to the first byte past additional content after <nFormulaLen>
41 -ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT )
42 +ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, sal_Size nFormulaLen,
43 + const ConvertParam& rParam, const FORMULA_TYPE eFT )
45 BYTE nOp, nLen, nByte;
47 @@ -393,12 +394,17 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
48 case 0x20: // Array Constant [317 268]
49 aIn >> nByte >> nUINT16;
52 + if (rParam.mbAllowArrays)
54 - SCSIZE nC = nByte + 1;
55 - SCSIZE nR = nUINT16 + 1;
57 - aStack << aPool.StoreMatrix( nC, nR );
58 + SCSIZE nC = rParam.mnArrayColSize;
59 + SCSIZE nR = rParam.mnArrayRowSize;
62 + // Stored array size is invalid. Get that from the formula.
66 + aStack << aPool.StoreMatrix(nC, nR);
67 aExtensions.push_back( EXTENSION_ARRAY );
70 diff --git sc/source/filter/excel/frmbase.cxx sc/source/filter/excel/frmbase.cxx
71 index 42f9037..a808a96 100644
72 --- sc/source/filter/excel/frmbase.cxx
73 +++ sc/source/filter/excel/frmbase.cxx
74 @@ -258,6 +258,12 @@ void ExcelConverterBase::Reset()
75 aEingPos.Set( 0, 0, 0 );
78 +ExcelConverterBase::ConvertParam::ConvertParam() :
79 + mbAllowArrays(true),
87 diff --git sc/source/filter/excel/impop.cxx sc/source/filter/excel/impop.cxx
88 index b936e00..c8f397a 100644
89 --- sc/source/filter/excel/impop.cxx
90 +++ sc/source/filter/excel/impop.cxx
91 @@ -498,7 +498,9 @@ void ImportExcel::Array25( void )
93 pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
94 static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
95 - pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
96 + ExcelConverterBase::ConvertParam aParam;
97 + aParam.mbAllowArrays = true;
98 + pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula);
100 DBG_ASSERT( pErgebnis, "*ImportExcel::Array25(): ScTokenArray ist NULL!" );
102 @@ -797,7 +799,9 @@ void ImportExcel::Shrfmla( void )
103 const ScTokenArray* pErgebnis;
106 - pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula );
107 + ExcelConverterBase::ConvertParam aParam;
108 + aParam.mbAllowArrays = true;
109 + pFormConv->Convert( pErgebnis, maStrm, nLenExpr, aParam, FT_SharedFormula );
112 DBG_ASSERT( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray ist NULL!" );
113 @@ -969,10 +973,14 @@ void ImportExcel::Array34( void )
115 // jetzt steht Lesemarke auf Formel, Laenge in nFormLen
116 const ScTokenArray* pErgebnis;
117 + ExcelConverterBase::ConvertParam aParam;
118 + aParam.mbAllowArrays = true;
119 + aParam.mnArrayColSize = nLastCol - nFirstCol + 1;
120 + aParam.mnArrayRowSize = nLastRow - nFirstRow + 1;
122 pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
123 static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
124 - pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
125 + pFormConv->Convert( pErgebnis, maStrm, nFormLen, aParam, FT_CellFormula);
127 DBG_ASSERT( pErgebnis, "+ImportExcel::Array34(): ScTokenArray ist NULL!" );
129 diff --git sc/source/filter/excel/xicontent.cxx sc/source/filter/excel/xicontent.cxx
130 index 24c1999..0ae264d 100644
131 --- sc/source/filter/excel/xicontent.cxx
132 +++ sc/source/filter/excel/xicontent.cxx
133 @@ -597,12 +597,15 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
134 const ScAddress& rPos = maRanges.GetObject( 0 )->aStart; // assured above that maRanges is not empty
135 ExcelToSc& rFmlaConv = GetOldFmlaConverter();
137 + ExcelConverterBase::ConvertParam aParam;
138 + aParam.mbAllowArrays = false;
140 ::std::auto_ptr< ScTokenArray > xTokArr1;
143 const ScTokenArray* pTokArr = 0;
144 rFmlaConv.Reset( rPos );
145 - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, false, FT_RangeName );
146 + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize1, aParam, FT_RangeName );
147 // formula converter owns pTokArr -> create a copy of the token array
149 xTokArr1.reset( pTokArr->Clone() );
150 @@ -613,7 +616,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
152 const ScTokenArray* pTokArr = 0;
153 rFmlaConv.Reset( rPos );
154 - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, false, FT_RangeName );
155 + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize2, aParam, FT_RangeName );
156 // formula converter owns pTokArr -> create a copy of the token array
158 pTokArr2.reset( pTokArr->Clone() );
159 @@ -721,6 +724,9 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm )
160 String aErrorMessage( rStrm.ReadUniString() );
161 rStrm.SetNulSubstChar(); // back to default
163 + ExcelConverterBase::ConvertParam aParam;
164 + aParam.mbAllowArrays = false;
167 if( rStrm.GetRecLeft() > 8 )
169 @@ -736,7 +742,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm )
171 const ScTokenArray* pTokArr = 0;
173 - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName );
174 + rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName );
175 // formula converter owns pTokArr -> create a copy of the token array
177 xTokArr1.reset( pTokArr->Clone() );
178 @@ -751,7 +757,7 @@ void XclImpValidation::ReadDV( XclImpStream& rStrm )
180 const ScTokenArray* pTokArr = 0;
182 - rFmlaConv.Convert( pTokArr, rStrm, nLen, false, FT_RangeName );
183 + rFmlaConv.Convert( pTokArr, rStrm, nLen, aParam, FT_RangeName );
184 // formula converter owns pTokArr -> create a copy of the token array
186 xTokArr2.reset( pTokArr->Clone() );
187 diff --git sc/source/filter/excel/xiformula.cxx sc/source/filter/excel/xiformula.cxx
188 index 240358e..41ace53 100644
189 --- sc/source/filter/excel/xiformula.cxx
190 +++ sc/source/filter/excel/xiformula.cxx
191 @@ -97,7 +97,9 @@ const ScTokenArray* XclImpFmlaCompImpl::CreateFormula(
192 aFmlaStrm.StartNextRecord();
193 const ScTokenArray* pArray = NULL;
194 GetOldFmlaConverter().Reset();
195 - GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), true);
196 + ExcelToSc::ConvertParam aParam;
197 + aParam.mbAllowArrays = true;
198 + GetOldFmlaConverter().Convert(pArray, aFmlaStrm, aFmlaStrm.GetRecSize(), aParam);
202 diff --git sc/source/filter/excel/xiname.cxx sc/source/filter/excel/xiname.cxx
203 index 72f4701..0ad70d5 100644
204 --- sc/source/filter/excel/xiname.cxx
205 +++ sc/source/filter/excel/xiname.cxx
206 @@ -180,7 +180,9 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
207 // --- name formula ---
208 // JEG : double check this. It is clearly false for normal names
209 // but some of the builtins (sheettitle?) might be able to handle arrays
210 - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, false, FT_RangeName );
211 + ExcelConverterBase::ConvertParam aParam;
212 + aParam.mbAllowArrays = false;
213 + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName );
215 // --- auto or advanced filter ---
216 if( (GetBiff() == EXC_BIFF8) && pTokArr && bBuiltIn )
217 @@ -208,7 +210,9 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
218 else if( nFmlaSize > 0 )
220 // regular defined name
221 - rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, true, FT_RangeName );
222 + ExcelConverterBase::ConvertParam aParam;
223 + aParam.mbAllowArrays = true;
224 + rFmlaConv.Convert( pTokArr, rStrm, nFmlaSize, aParam, FT_RangeName );
227 // 4) *** create a defined name in the Calc document *** ------------------
228 diff --git sc/source/filter/inc/excform.hxx sc/source/filter/inc/excform.hxx
229 index e80d67c..790174b 100644
230 --- sc/source/filter/inc/excform.hxx
231 +++ sc/source/filter/inc/excform.hxx
232 @@ -62,7 +62,8 @@ public:
233 ExcelToSc( const XclImpRoot& rRoot );
234 virtual ~ExcelToSc();
235 virtual ConvErr Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
236 - bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
237 + const ConvertParam& rParam,
238 + const FORMULA_TYPE eFT = FT_CellFormula );
240 virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
242 @@ -138,7 +139,8 @@ public:
243 ExcelToSc8( const XclImpRoot& rRoot );
244 virtual ~ExcelToSc8();
246 - virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
247 + virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen,
248 + const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula );
250 virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
252 diff --git sc/source/filter/inc/formel.hxx sc/source/filter/inc/formel.hxx
253 index 5d3f196..58aa2f4 100644
254 --- sc/source/filter/inc/formel.hxx
255 +++ sc/source/filter/inc/formel.hxx
256 @@ -214,8 +214,17 @@ public:
258 void Reset( const ScAddress& rEingPos );
260 + struct ConvertParam
262 + bool mbAllowArrays;
263 + SCSIZE mnArrayColSize;
264 + SCSIZE mnArrayRowSize;
269 virtual ConvErr Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen,
270 - bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
271 + const ConvertParam& rParam, const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
272 virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab,
273 const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
275 diff --git sc/source/filter/xcl97/XclImpChangeTrack.cxx sc/source/filter/xcl97/XclImpChangeTrack.cxx
276 index 0b6b3e3..c20c8ac 100644
277 --- sc/source/filter/xcl97/XclImpChangeTrack.cxx
278 +++ sc/source/filter/xcl97/XclImpChangeTrack.cxx
279 @@ -210,7 +210,9 @@ void XclImpChangeTrack::ReadFormula( ScTokenArray*& rpTokenArray, const ScAddres
280 // read the formula, 3D tab refs from extended data
281 const ScTokenArray* pArray = NULL;
282 aFmlConv.Reset( rPosition );
283 - BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, false, FT_CellFormula) == ConvOK); // JEG : Check This
284 + ExcelConverterBase::ConvertParam aParam;
285 + aParam.mbAllowArrays = false;
286 + BOOL bOK = (aFmlConv.Convert( pArray, aFmlaStrm, nFmlSize, aParam, FT_CellFormula) == ConvOK); // JEG : Check This
287 rpTokenArray = (bOK && pArray) ? new ScTokenArray( *pArray ) : NULL;