update dev300-m57
[ooovba.git] / applied_patches / 0126-sc-xls-builtin-name-scope.diff
blobadf22a9dbc46807a1427aa12c4fadcdb765c0fea
1 diff --git sc/source/filter/excel/excform.cxx sc/source/filter/excel/excform.cxx
2 index b1e05d0..f30eb80 100644
3 --- sc/source/filter/excel/excform.cxx
4 +++ sc/source/filter/excel/excform.cxx
5 @@ -904,7 +904,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
8 // stream seeks to first byte after <nFormulaLen>
9 -ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, const FORMULA_TYPE eFT )
10 +ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen,
11 + SCsTAB nTab, const FORMULA_TYPE eFT )
13 RootData& rR = GetOldRoot();
14 BYTE nOp, nLen;
15 @@ -1072,7 +1073,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
17 ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName );
19 - rRangeList.Append( aSRD );
20 + rRangeList.Append( aSRD, nTab );
21 break;
22 case 0x45:
23 case 0x65:
24 @@ -1099,7 +1100,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
25 else if( IsComplRowRange( nRowFirst, nRowLast ) )
26 SetComplRow( aCRD );
28 - rRangeList.Append( aCRD );
29 + rRangeList.Append( aCRD, nTab );
31 break;
32 case 0x46:
33 @@ -1136,7 +1137,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
35 ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF );
37 - rRangeList.Append( aSRD );
38 + rRangeList.Append( aSRD, nTab );
40 break;
41 case 0x4D:
42 @@ -1162,7 +1163,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
43 else if( IsComplRowRange( nRowFirst, nRowLast ) )
44 SetComplRow( aCRD );
46 - rRangeList.Append( aCRD );
47 + rRangeList.Append( aCRD, nTab );
49 break;
50 case 0x49:
51 @@ -1232,10 +1233,10 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
52 b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() );
53 aCRD.Ref2.SetFlag3D( b3D );
54 aCRD.Ref2.SetTabRel( FALSE );
55 - rRangeList.Append( aCRD );
56 + rRangeList.Append( aCRD, nTab );
58 else
59 - rRangeList.Append( aSRD );
60 + rRangeList.Append( aSRD, nTab );
64 @@ -1290,7 +1291,7 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
65 else if( IsComplRowRange( nRowFirst, nRowLast ) )
66 SetComplRow( aCRD );
68 - rRangeList.Append( aCRD );
69 + rRangeList.Append( aCRD, nTab );
70 }//ENDE in aktuellem Workbook
72 break;
73 diff --git sc/source/filter/excel/excform8.cxx sc/source/filter/excel/excform8.cxx
74 index 1bf13ef..22da392 100644
75 --- sc/source/filter/excel/excform8.cxx
76 +++ sc/source/filter/excel/excform8.cxx
77 @@ -877,7 +877,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
80 // stream seeks to first byte after <nFormulaLen>
81 -ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, const FORMULA_TYPE eFT )
82 +ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen,
83 + SCsTAB nTab, const FORMULA_TYPE eFT )
85 BYTE nOp, nLen;//, nByte;
86 BOOL bError = FALSE;
87 @@ -1008,7 +1009,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
89 ExcRelToScRel8( nRow, nCol, aSRD, bRangeName );
91 - rRangeList.Append( aSRD );
92 + rRangeList.Append( aSRD, nTab );
94 break;
95 case 0x45:
96 @@ -1036,7 +1037,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
97 else if( IsComplRowRange( nRowFirst, nRowLast ) )
98 SetComplRow( aCRD );
100 - rRangeList.Append( aCRD );
101 + rRangeList.Append( aCRD, nTab );
103 break;
104 case 0x46:
105 @@ -1080,7 +1081,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
107 ExcRelToScRel8( nRow, nCol, aSRD, bRNorSF );
109 - rRangeList.Append( aSRD );
110 + rRangeList.Append( aSRD, nTab );
112 break;
113 case 0x4D:
114 @@ -1106,7 +1107,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
115 else if( IsComplRowRange( nRowFirst, nRowLast ) )
116 SetComplRow( aCRD );
118 - rRangeList.Append( aCRD );
119 + rRangeList.Append( aCRD, nTab );
121 break;
122 case 0x4E:
123 @@ -1148,10 +1149,10 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
124 aCRD.Ref2.nCol = aSRD.nCol;
125 aCRD.Ref2.nRow = aSRD.nRow;
126 aCRD.Ref2.nTab = nLastScTab;
127 - rRangeList.Append( aCRD );
128 + rRangeList.Append( aCRD, nTab );
130 else
131 - rRangeList.Append( aSRD );
132 + rRangeList.Append( aSRD, nTab );
135 break;
136 @@ -1184,7 +1185,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
137 else if( IsComplRowRange( nRw1, nRw2 ) )
138 SetComplRow( aCRD );
140 - rRangeList.Append( aCRD );
141 + rRangeList.Append( aCRD, nTab );
144 break;
145 diff --git sc/source/filter/excel/frmbase.cxx sc/source/filter/excel/frmbase.cxx
146 index ad4bf6b..aef072f 100644
147 --- sc/source/filter/excel/frmbase.cxx
148 +++ sc/source/filter/excel/frmbase.cxx
149 @@ -81,7 +81,7 @@ _ScRangeListTabs::~_ScRangeListTabs()
153 -void _ScRangeListTabs::Append( ScSingleRefData a, const BOOL b )
154 +void _ScRangeListTabs::Append( ScSingleRefData a, SCsTAB nTab, const BOOL b )
156 if( b )
158 @@ -101,19 +101,24 @@ void _ScRangeListTabs::Append( ScSingleRefData a, const BOOL b )
160 bHasRanges = TRUE;
162 - if( a.nTab >= 0 )
163 + if( nTab == SCTAB_MAX)
164 + return;
165 + if( nTab < 0)
166 + nTab = a.nTab;
168 + if( nTab >= 0 )
170 - _ScRangeList* p = ppTabLists[ a.nTab ];
171 + _ScRangeList* p = ppTabLists[ nTab ];
173 if( !p )
174 - p = ppTabLists[ a.nTab ] = new _ScRangeList;
176 + p = ppTabLists[ nTab ] = new _ScRangeList;
178 p->Append( a );
183 -void _ScRangeListTabs::Append( ScComplexRefData a, const BOOL b )
184 +void _ScRangeListTabs::Append( ScComplexRefData a, SCsTAB nTab, const BOOL b )
186 if( b )
188 @@ -161,12 +166,17 @@ void _ScRangeListTabs::Append( ScComplexRefData a, const BOOL b )
190 bHasRanges = TRUE;
192 - if( a.Ref1.nTab >= 0 )
193 + if( nTab == SCTAB_MAX)
194 + return;
195 + if( nTab < -1)
196 + nTab = a.Ref1.nTab;
198 + if( nTab >= 0 )
200 - _ScRangeList* p = ppTabLists[ a.Ref1.nTab ];
201 + _ScRangeList* p = ppTabLists[ nTab ];
203 if( !p )
204 - p = ppTabLists[ a.Ref1.nTab ] = new _ScRangeList;
205 + p = ppTabLists[ nTab ] = new _ScRangeList;
207 p->Append( a );
209 diff --git sc/source/filter/excel/xiname.cxx sc/source/filter/excel/xiname.cxx
210 index 3647a51..72f4701 100644
211 --- sc/source/filter/excel/xiname.cxx
212 +++ sc/source/filter/excel/xiname.cxx
213 @@ -160,16 +160,18 @@ XclImpName::XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx ) :
215 else if( bBuiltIn )
217 + SCsTAB const nLocalTab = (nXclTab == EXC_NAME_GLOBAL) ? SCTAB_MAX : (nXclTab - 1);
219 // --- print ranges or title ranges ---
220 rStrm.PushPosition();
221 switch( mcBuiltIn )
223 case EXC_BUILTIN_PRINTAREA:
224 - if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, FT_RangeName ) == ConvOK )
225 + if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
226 nNameType |= RT_PRINTAREA;
227 break;
228 case EXC_BUILTIN_PRINTTITLES:
229 - if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, FT_RangeName ) == ConvOK )
230 + if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
231 nNameType |= RT_COLHEADER | RT_ROWHEADER;
232 break;
234 diff --git sc/source/filter/inc/excform.hxx sc/source/filter/inc/excform.hxx
235 index c587569..a067f9d 100644
236 --- sc/source/filter/inc/excform.hxx
237 +++ sc/source/filter/inc/excform.hxx
238 @@ -64,7 +64,7 @@ public:
239 virtual ConvErr Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
240 bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
242 - virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
243 + virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
245 virtual ConvErr ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
246 const String& rUrl, const ::std::vector<String>& rTabNames );
247 @@ -140,7 +140,7 @@ public:
249 virtual ConvErr Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
251 - virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
252 + virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
254 virtual ConvErr ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
255 const String& rUrl, const ::std::vector<String>& rTabNames );
256 diff --git sc/source/filter/inc/formel.hxx sc/source/filter/inc/formel.hxx
257 index 9b5d524..c025393 100644
258 --- sc/source/filter/inc/formel.hxx
259 +++ sc/source/filter/inc/formel.hxx
260 @@ -154,8 +154,8 @@ public:
261 _ScRangeListTabs( void );
262 virtual ~_ScRangeListTabs();
264 - void Append( ScSingleRefData aSRD, const BOOL bLimit = TRUE );
265 - void Append( ScComplexRefData aCRD, const BOOL bLimit = TRUE );
266 + void Append( ScSingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE );
267 + void Append( ScComplexRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE );
269 inline BOOL HasRanges( void ) const;
271 @@ -216,7 +216,7 @@ public:
273 virtual ConvErr Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen,
274 bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
275 - virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen,
276 + virtual ConvErr Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab,
277 const FORMULA_TYPE eFT = FT_CellFormula ) = 0;