Index: sc/source/filter/excel/excform.cxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/excel/excform.cxx,v
retrieving revision 1.38
diff -u -w -p -r1.38 excform.cxx
--- sc/source/filter/excel/excform.cxx	13 Jan 2006 16:56:42 -0000	1.38
+++ sc/source/filter/excel/excform.cxx	1 Aug 2006 03:32:03 -0000
@@ -890,7 +890,8 @@ ConvErr ExcelToSc::Convert( const ScToke
 
 
 // stream seeks to first byte after <nFormulaLen>
-ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, const FORMULA_TYPE eFT )
+ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen,
+							SCsTAB nTab, const FORMULA_TYPE eFT )
 {
     RootData&       rR = GetOldRoot();
 	BYTE			nOp, nLen;
@@ -1058,7 +1059,7 @@ ConvErr ExcelToSc::Convert( _ScRangeList
 
 				ExcRelToScRel( nUINT16, nByte, aSRD, bRangeName );
 
-				rRangeList.Append( aSRD );
+				rRangeList.Append( aSRD, nTab );
 				break;
 			case 0x45:
 			case 0x65:
@@ -1085,7 +1086,7 @@ ConvErr ExcelToSc::Convert( _ScRangeList
 				else if( IsComplRowRange( nRowFirst, nRowLast ) )
 					SetComplRow( aCRD );
 
-				rRangeList.Append( aCRD );
+				rRangeList.Append( aCRD, nTab );
 			}
 				break;
 			case 0x46:
@@ -1122,7 +1123,7 @@ ConvErr ExcelToSc::Convert( _ScRangeList
 
 				ExcRelToScRel( nUINT16, nByte, aSRD, bRNorSF );
 
-				rRangeList.Append( aSRD );
+				rRangeList.Append( aSRD, nTab );
 			}
 				break;
 			case 0x4D:
@@ -1148,7 +1149,7 @@ ConvErr ExcelToSc::Convert( _ScRangeList
 				else if( IsComplRowRange( nRowFirst, nRowLast ) )
 					SetComplRow( aCRD );
 
-				rRangeList.Append( aCRD );
+				rRangeList.Append( aCRD, nTab );
 			}
 				break;
             case 0x49:
@@ -1218,10 +1219,10 @@ ConvErr ExcelToSc::Convert( _ScRangeList
 						b3D = ( static_cast<SCTAB>(nTabLast) != aEingPos.Tab() );
 						aCRD.Ref2.SetFlag3D( b3D );
 						aCRD.Ref2.SetTabRel( FALSE );
-						rRangeList.Append( aCRD );
+						rRangeList.Append( aCRD, nTab );
 					}
 					else
-						rRangeList.Append( aSRD );
+						rRangeList.Append( aSRD, nTab );
 				}
 			}
 
@@ -1276,7 +1277,7 @@ ConvErr ExcelToSc::Convert( _ScRangeList
 					else if( IsComplRowRange( nRowFirst, nRowLast ) )
 						SetComplRow( aCRD );
 
-					rRangeList.Append( aCRD );
+					rRangeList.Append( aCRD, nTab );
 				}//ENDE in aktuellem Workbook
 			}
 				break;
Index: sc/source/filter/excel/excform8.cxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/excel/excform8.cxx,v
retrieving revision 1.38
diff -u -w -p -r1.38 excform8.cxx
--- sc/source/filter/excel/excform8.cxx	21 Oct 2005 11:55:53 -0000	1.38
+++ sc/source/filter/excel/excform8.cxx	1 Aug 2006 03:32:03 -0000
@@ -796,7 +796,8 @@ ConvErr ExcelToSc8::Convert( const ScTok
 
 
 // stream seeks to first byte after <nFormulaLen>
-ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen, const FORMULA_TYPE eFT )
+ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal_Size nFormulaLen,
+							  SCsTAB nTab, const FORMULA_TYPE eFT )
 {
 	BYTE					nOp, nLen;//, nByte;
 	BOOL					bError = FALSE;
@@ -927,7 +928,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeLis
 
 				ExcelToSc8::ExcRelToScRel( nRow, nCol, aSRD, bRangeName );
 
-				rRangeList.Append( aSRD );
+				rRangeList.Append( aSRD, nTab );
 			}
 				break;
 			case 0x45:
@@ -955,7 +956,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeLis
 				else if( IsComplRowRange( nRowFirst, nRowLast ) )
 					SetComplRow( aCRD );
 
-				rRangeList.Append( aCRD );
+				rRangeList.Append( aCRD, nTab );
 			}
 				break;
 			case 0x46:
@@ -999,7 +1000,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeLis
 
 				ExcelToSc8::ExcRelToScRel( nRow, nCol, aSRD, bRNorSF );
 
-				rRangeList.Append( aSRD );
+				rRangeList.Append( aSRD, nTab );
 			}
 				break;
 			case 0x4D:
@@ -1025,7 +1026,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeLis
 				else if( IsComplRowRange( nRowFirst, nRowLast ) )
 					SetComplRow( aCRD );
 
-				rRangeList.Append( aCRD );
+				rRangeList.Append( aCRD, nTab );
 			}
 				break;
 			case 0x4E:
@@ -1067,10 +1068,10 @@ ConvErr ExcelToSc8::Convert( _ScRangeLis
 						aCRD.Ref2.nCol = aSRD.nCol;
 						aCRD.Ref2.nRow = aSRD.nRow;
                         aCRD.Ref2.nTab = nLastScTab;
-						rRangeList.Append( aCRD );
+						rRangeList.Append( aCRD, nTab );
 					}
 					else
-						rRangeList.Append( aSRD );
+						rRangeList.Append( aSRD, nTab );
 				}
 			}
 				break;
@@ -1103,7 +1104,7 @@ ConvErr ExcelToSc8::Convert( _ScRangeLis
 					else if( IsComplRowRange( nRw1, nRw2 ) )
 						SetComplRow( aCRD );
 
-					rRangeList.Append( aCRD );
+					rRangeList.Append( aCRD, nTab );
 				}
 			}
 				break;
Index: sc/source/filter/excel/frmbase.cxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/excel/frmbase.cxx,v
retrieving revision 1.6
diff -u -w -p -r1.6 frmbase.cxx
--- sc/source/filter/excel/frmbase.cxx	8 Sep 2005 18:57:54 -0000	1.6
+++ sc/source/filter/excel/frmbase.cxx	1 Aug 2006 03:32:03 -0000
@@ -87,7 +87,7 @@ _ScRangeListTabs::~_ScRangeListTabs()
 }
 
 
-void _ScRangeListTabs::Append( SingleRefData a, const BOOL b )
+void _ScRangeListTabs::Append( SingleRefData a, SCsTAB nTab, const BOOL b )
 {
 	if( b )
 	{
@@ -107,19 +107,24 @@ void _ScRangeListTabs::Append( SingleRef
 
 	bHasRanges = TRUE;
 
-    if( a.nTab >= 0 )
+	if( nTab == SCTAB_MAX)
+		return;
+	if( nTab < 0)
+		nTab = a.nTab;
+
+    if( nTab >= 0 )
     {
-        _ScRangeList*   p = ppTabLists[ a.nTab ];
+        _ScRangeList*   p = ppTabLists[ nTab ];
 
         if( !p )
-            p = ppTabLists[ a.nTab ] = new _ScRangeList;
+            p = ppTabLists[ nTab ] = new _ScRangeList;
 
         p->Append( a );
     }
 }
 
 
-void _ScRangeListTabs::Append( ComplRefData a, const BOOL b )
+void _ScRangeListTabs::Append( ComplRefData a, SCsTAB nTab, const BOOL b )
 {
 	if( b )
 	{
@@ -167,12 +172,17 @@ void _ScRangeListTabs::Append( ComplRefD
 
 	bHasRanges = TRUE;
 
-    if( a.Ref1.nTab >= 0 )
+	if( nTab == SCTAB_MAX)
+		return;
+	if( nTab < -1)
+		nTab = a.Ref1.nTab;
+
+    if( nTab >= 0 )
     {
-        _ScRangeList*   p = ppTabLists[ a.Ref1.nTab ];
+        _ScRangeList*   p = ppTabLists[ nTab ];
 
         if( !p )
-            p = ppTabLists[ a.Ref1.nTab ] = new _ScRangeList;
+            p = ppTabLists[ nTab ] = new _ScRangeList;
 
         p->Append( a );
     }
Index: sc/source/filter/excel/xiname.cxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/excel/xiname.cxx,v
retrieving revision 1.5
diff -u -w -p -r1.5 xiname.cxx
--- sc/source/filter/excel/xiname.cxx	28 Sep 2005 11:49:21 -0000	1.5
+++ sc/source/filter/excel/xiname.cxx	1 Aug 2006 03:32:04 -0000
@@ -171,16 +171,18 @@ XclImpName::XclImpName( XclImpStream& rS
     }
     else if( bBuiltIn )
     {
+		SCsTAB const nLocalTab = (nExtSheet == EXC_NAME_GLOBAL) ? SCTAB_MAX : (nExtSheet - 1);
+
         // --- print ranges or title ranges ---
         rStrm.PushPosition();
         switch( mcBuiltIn )
         {
             case EXC_BUILTIN_PRINTAREA:
-                if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, FT_RangeName ) == ConvOK )
+                if( rFmlaConv.Convert( GetPrintAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
                     nNameType |= RT_PRINTAREA;
             break;
             case EXC_BUILTIN_PRINTTITLES:
-                if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, FT_RangeName ) == ConvOK )
+                if( rFmlaConv.Convert( GetTitleAreaBuffer(), rStrm, nFmlaSize, nLocalTab, FT_RangeName ) == ConvOK )
                     nNameType |= RT_COLHEADER | RT_ROWHEADER;
             break;
         }
Index: sc/source/filter/inc/excform.hxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/inc/excform.hxx,v
retrieving revision 1.15
diff -u -w -p -r1.15 excform.hxx
--- sc/source/filter/inc/excform.hxx	28 Sep 2005 11:56:09 -0000	1.15
+++ sc/source/filter/inc/excform.hxx	1 Aug 2006 03:32:06 -0000
@@ -72,9 +72,10 @@ protected:
 public:
                        ExcelToSc( const XclImpRoot& rRoot );
	virtual				~ExcelToSc();
+
     virtual ConvErr     Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
 
-    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
+    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
     virtual BOOL        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
 
 	void				GetDummy( const ScTokenArray*& );
@@ -124,7 +125,7 @@ public:
 
 	virtual ConvErr		Convert( const ScTokenArray*& rpTokArray, UINT32 nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
 
-    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, const FORMULA_TYPE eFT = FT_CellFormula );
+    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
 
 	static inline BOOL	IsComplRowRange( const UINT16 nRow1, const UINT16 nRow2 );
 
Index: sc/source/filter/inc/formel.hxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/inc/formel.hxx,v
retrieving revision 1.7
diff -u -w -p -r1.7 formel.hxx
--- sc/source/filter/inc/formel.hxx	8 Sep 2005 19:19:20 -0000	1.7
+++ sc/source/filter/inc/formel.hxx	1 Aug 2006 03:32:06 -0000
@@ -176,8 +176,8 @@ public:
 								_ScRangeListTabs( void );
 	virtual						~_ScRangeListTabs();
 
-	void						Append( SingleRefData aSRD, const BOOL bLimit = TRUE );
-	void						Append( ComplRefData aCRD, const BOOL bLimit = TRUE );
+	void						Append( SingleRefData aSRD, SCsTAB nTab, const BOOL bLimit = TRUE );
+	void						Append( ComplRefData aCRD, SCsTAB nTab, const BOOL bLimit = TRUE );
 
 	inline BOOL					HasRanges( void ) const;
 
@@ -240,7 +240,7 @@ public:
 
     virtual ConvErr     Convert( const ScTokenArray*& rpErg, XclImpStream& rStrm, sal_Size nFormulaLen,
 									const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
-    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen,
+    virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab,
 									const FORMULA_TYPE eFT = FT_CellFormula ) = 0;
 };
 
