diff -u -r ../../../sc.bak/source/ui/dbgui/pivot.hrc sc/source/ui/dbgui/pivot.hrc
--- ../../../sc.bak/source/ui/dbgui/pivot.hrc	2004-12-22 14:05:08.000000000 +0530
+++ sc/source/ui/dbgui/pivot.hrc	2005-01-17 11:28:44.000000000 +0530
@@ -108,4 +108,6 @@
 #define PIVOTSTR_DEV2			9
 #define PIVOTSTR_VAR			10
 #define PIVOTSTR_VAR2			11
-
+#define FT_INAREA			40
+#define RB_INAREA			41
+#define ED_INAREA			42
diff -u -r ../../../sc.bak/source/ui/dbgui/pivot.src sc/source/ui/dbgui/pivot.src
--- ../../../sc.bak/source/ui/dbgui/pivot.src	2004-12-22 14:05:08.000000000 +0530
+++ sc/source/ui/dbgui/pivot.src	2005-01-19 10:35:11.000000000 +0530
@@ -65,7 +65,7 @@
 {
 	OutputSize = TRUE ;
 	HelpId = SID_OPENDLG_PIVOTTABLE ;
-    Size = MAP_APPFONT ( 336 , 190 ) ;
+    Size = MAP_APPFONT ( 336 , 200 ) ;
 	Hide = TRUE ;
 	SVLook = TRUE ;
 	Moveable = TRUE ;
@@ -161,6 +161,47 @@
 		Text [ de ] = "Layout" ;
 		Text [ en-US ] = "Layout";
 	};
+
+	FixedText FT_INAREA
+        {
+        Pos = MAP_APPFONT ( 6 , 180 ) ;
+        Size = MAP_APPFONT ( 59 , 8 ) ;
+                Hide = FALSE ;
+	Text [ en-US ] = "Selection from" ;
+		Text[ de ] = "Auswahl aus";
+		Text[ es ] = "Selección de";
+		Text[ fr ] = "Sélection à partir de";
+		Text[ it ] = "Seleziona da";
+		Text[ ja ] = "選択元";
+		Text[ pt-BR ] = "Seleção de ";
+		Text[ zh-CN ] = "选择范围";
+		Text[ zh-TW ] = "選項來源";
+	};
+
+        Edit ED_INAREA
+        {
+                Border = TRUE ;
+        Pos = MAP_APPFONT ( 65 , 180 ) ;
+        Size = MAP_APPFONT ( 100 , 12 ) ;
+                TabStop = TRUE ;
+                Hide = FALSE ;
+        };
+        ImageButton RB_INAREA
+        {
+        Pos = MAP_APPFONT ( 172 , 180 ) ;
+                Size = MAP_APPFONT ( 12 , 12 ) ;
+        TabStop = TRUE ;
+        Hide = FALSE ;
+                QuickHelpText [ de ] = "Verkleinern" ;
+                QuickHelpText [ en-US ] = "Shrink" ;
+		QuickHelpText[ es ] = "Reducir";
+		QuickHelpText[ fr ] = "Comprimer";
+		QuickHelpText[ it ] = "Comprimi";
+		QuickHelpText[ ja ] = "縮小";
+		QuickHelpText[ pt-BR ] = "Diminuir";
+		QuickHelpText[ zh-CN ] = "收缩";
+		QuickHelpText[ zh-TW ] = "縮小";
+	};
 	OKButton BTN_OK
 	{
         Pos = MAP_APPFONT ( 280 , 6 ) ;
diff -u -r ../../../sc.bak/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
--- ../../../sc.bak/source/ui/dbgui/pvlaydlg.cxx	2004-12-22 14:05:08.000000000 +0530
+++ sc/source/ui/dbgui/pvlaydlg.cxx	2005-01-19 11:24:34.943234360 +0530
@@ -68,6 +68,7 @@
 //----------------------------------------------------------------------------
 
 #include "pvlaydlg.hxx"
+#include "dbdocfun.hxx"
 
 #include <sfx2/dispatch.hxx>
 #include <vcl/msgbox.hxx>
@@ -87,6 +88,7 @@
 #include "pivot.hrc"
 #include "dpobject.hxx"
 #include "dpsave.hxx"
+#include "dpshttab.hxx"
 #include "scmod.hxx"
 
 #include "sc.hrc" //CHINA001
@@ -139,6 +141,9 @@
 		aFtOutArea		( this, ScResId( FT_OUTAREA ) ),
 		aEdOutPos		( this, ScResId( ED_OUTAREA ) ),
 		aRbOutPos		( this, ScResId( RB_OUTAREA ), &aEdOutPos ),
+		aFtInArea			( this, ScResId( FT_INAREA) ),
+		aEdInPos			( this, ScResId( ED_INAREA) ),
+		aRbInPos			( this, ScResId( RB_INAREA ), &aEdInPos ),
         aFlAreas        ( this, ScResId( FL_OUTPUT ) ),
 
         aFtPage         ( this, ScResId( FT_PAGE ) ),
@@ -166,7 +171,7 @@
 								GetViewData() ),
 		pDoc			( ((ScTabViewShell*)SfxViewShell::Current())->
 								GetViewData()->GetDocument() ),
-		bRefInputMode	( FALSE )
+		bRefInputMode	( TRUE )
 {
     xDlgDPObject->SetAlive( TRUE );     // needed to get structure information
     xDlgDPObject->FillOldParam( thePivotData, FALSE );
@@ -249,6 +254,12 @@
 	InitWnd( thePivotData.aRowArr,  static_cast<long>(thePivotData.nRowCount),  TYPE_ROW );
 	InitWnd( thePivotData.aDataArr, static_cast<long>(thePivotData.nDataCount), TYPE_DATA );
 
+	ScRange inRange;
+	String inString;
+	inRange = xDlgDPObject->GetSheetDesc()->aSourceRange;
+	inRange.Format( inString, STD_FORMAT, pDoc);
+	aEdInPos.SetText(inString);
+	
     aSlider.SetPageSize( PAGE_SIZE );
     aSlider.SetVisibleSize( PAGE_SIZE );
     aSlider.SetLineSize( LINE_SIZE );
@@ -266,6 +277,7 @@
 
     aLbOutPos .SetSelectHdl( LINK( this, ScDPLayoutDlg, SelAreaHdl ) );
     aEdOutPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdModifyHdl ) );
+    aEdInPos .SetModifyHdl( LINK( this, ScDPLayoutDlg, EdInModifyHdl ) );	
     aBtnOk    .SetClickHdl ( LINK( this, ScDPLayoutDlg, OkHdl ) );
     aBtnCancel.SetClickHdl ( LINK( this, ScDPLayoutDlg, CancelHdl ) );
 
@@ -1270,17 +1282,34 @@
 
 void ScDPLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDoc )
 {
+	ScRefEdit *tmpREd;
+	ScRefButton *tmpRBtn;
+	
 	if ( bRefInputMode )
 	{
+		tmpRBtn = GetRefButton();
+		tmpREd = tmpRBtn->GetReferencesEdit();
 		if ( rRef.aStart != rRef.aEnd )
-			RefInputStart( &aEdOutPos );
+			RefInputStart( tmpREd, tmpRBtn);
+
 /*
 		ScAddress	aAdr( nStartCol, nStartRow, nStartTab );
 		aAdr.PutInOrder( ScAddress( nEndCol, nEndRow, nEndTab ) );
 */
+
 		String aRefStr;
-		rRef.aStart.Format( aRefStr, STD_FORMAT, pDoc );
-		aEdOutPos.SetRefString( aRefStr );
+
+		if ( tmpREd== &aEdInPos)
+		{
+			USHORT	 	nFmt = SCR_ABS_3D;		 //!!! nCurTab fehlt noch		
+			if ( rRef.aStart.Tab() != rRef.aEnd.Tab() )
+				nFmt |= SCA_TAB2_3D;		
+			rRef.Format( aRefStr, nFmt, pDoc );
+		}
+		else			
+			rRef.aStart.Format( aRefStr, STD_FORMAT, pDoc );
+		
+		tmpREd->SetRefString( aRefStr );
 	}
 }
 
@@ -1432,6 +1461,7 @@
 				).Execute();
 		aEdOutPos.GrabFocus();
 	}
+
 	return 0;
 }
 
@@ -1461,7 +1491,7 @@
 	}
 	else
 	{
-		bRefInputMode = FALSE;
+
 		//@BugID 54702 Enablen/Disablen nur noch in Basisklasse
 		//SFX_APPWINDOW->Disable(FALSE);		//! allgemeine Methode im ScAnyRefDlg
 	}
@@ -1498,6 +1528,95 @@
 }
 
 
+IMPL_LINK( ScDPLayoutDlg, EdInModifyHdl, Edit *, EMPTYARG )
+{
+
+	String	theCurPosStr = aEdInPos.GetText();
+	ScSheetSourceDesc inSheet = *(xDlgDPObject->GetSheetDesc());
+        ScRange aR = xDlgDPObject->GetSheetDesc()->aSourceRange;        
+	ScRefAddress start, end;
+	ConvertDoubleRef (pDoc, theCurPosStr, 1,  start, end );
+	inSheet.aSourceRange = ScRange(start.GetAddress(), end.GetAddress());
+	xDlgDPObject->SetSheetDesc( inSheet);
+	xDlgDPObject->InvalidateSource();
+	xDlgDPObject->Output();
+	xDlgDPObject->SetAlive( TRUE );		// needed to get structure information
+	xDlgDPObject->FillOldParam( thePivotData, FALSE );
+	xDlgDPObject->FillLabelData( thePivotData );
+
+	ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
+	pTabViewShell->SetDialogDPObject(&ScDPObject(*xDlgDPObject));
+			
+	aR = xDlgDPObject->GetSheetDesc()->aSourceRange;
+	
+	USHORT i;
+ 	for ( i=0; i<MAX_LABELS; i++ )
+		aSelectArr[i].reset();
+
+	for ( i=0; i<MAX_FIELDS; i++ )
+	{
+		RemoveField (TYPE_COL, i);
+		RemoveField (TYPE_ROW, i);
+		RemoveField (TYPE_DATA, i);
+		RemoveField (TYPE_PAGE, i);
+	}
+
+	aLabelDataArr.clear();
+	
+	aWndSelect.ClearFields();
+	
+	InitWndSelect( thePivotData.ppLabelArr, thePivotData.nLabels );
+	InitWnd( thePivotData.aColArr,  thePivotData.nColCount,  TYPE_COL );
+	InitWnd( thePivotData.aRowArr,  thePivotData.nRowCount,  TYPE_ROW );
+	InitWnd( thePivotData.aDataArr, thePivotData.nDataCount, TYPE_DATA );
+	aSlider.SetPageSize( PAGE_SIZE );
+	aSlider.SetVisibleSize( PAGE_SIZE );
+	aSlider.SetLineSize( LINE_SIZE );
+	aSlider.SetRange( Range( 0, ((thePivotData.nLabels+LINE_SIZE-1)/LINE_SIZE)*LINE_SIZE ) );
+
+	if ( thePivotData.nLabels > PAGE_SIZE )
+	{
+        aSlider.SetEndScrollHdl( LINK( this, ScDPLayoutDlg, ScrollHdl ) );
+		aSlider.Show();
+	}
+	else
+		aSlider.Hide();
+
+	if ( pViewData && pDoc )
+	{
+		/*
+		 * Aus den RangeNames des Dokumentes werden nun die
+		 * in einem Zeiger-Array gemerkt, bei denen es sich
+		 * um sinnvolle Bereiche handelt
+		 */
+
+		aLbOutPos.Clear();
+		aLbOutPos.InsertEntry( aStrUndefined, 0 );
+		aLbOutPos.InsertEntry( aStrNewTable,  1 );
+
+		ScAreaNameIterator aIter( pDoc );
+		String aName;
+		ScRange aRange;
+		String aRefStr;
+		while ( aIter.Next( aName, aRange ) )
+		{
+			if ( !aIter.WasDBName() )		// hier keine DB-Bereiche !
+			{
+				USHORT nInsert = aLbOutPos.InsertEntry( aName );
+
+				aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc );
+				aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) );
+			}
+		}
+	}
+
+
+	
+	//Init();
+	return 0;
+}
+
+
 //----------------------------------------------------------------------------
 
 IMPL_LINK( ScDPLayoutDlg, SelAreaHdl, ListBox *, EMPTYARG )
diff -u -r ../../../sc.bak/source/ui/inc/anyrefdg.hxx sc/source/ui/inc/anyrefdg.hxx
--- ../../../sc.bak/source/ui/inc/anyrefdg.hxx	2004-12-22 14:05:07.000000000 +0530
+++ sc/source/ui/inc/anyrefdg.hxx	2005-01-17 11:28:43.000000000 +0530
@@ -140,7 +140,7 @@
                         ScRefButton( Window* pParent, const ResId& rResId );
 
     void                SetReferences( ScAnyRefDlg* pDlg, ScRefEdit* pEdit );
-
+    ScRefEdit* 	   GetReferencesEdit ();
     void                SetStartImage();
     void                SetEndImage();
     inline void         DoRef() { Click(); }
@@ -194,6 +194,7 @@
                         ScAnyRefDlg( SfxBindings* pB, SfxChildWindow* pCW,
                                      Window* pParent, USHORT nResId);
     virtual             ~ScAnyRefDlg();
+    ScRefButton* GetRefButton()	{ return pRefBtn; }
 
     virtual void        SetReference( const ScRange& rRef, ScDocument* pDoc ) = 0;
     virtual void        AddRefEntry();
diff -u -r ../../../sc.bak/source/ui/inc/pvlaydlg.hxx sc/source/ui/inc/pvlaydlg.hxx
--- ../../../sc.bak/source/ui/inc/pvlaydlg.hxx	2004-12-22 14:05:07.000000000 +0530
+++ sc/source/ui/inc/pvlaydlg.hxx	2005-01-17 11:28:43.000000000 +0530
@@ -170,8 +170,11 @@
     FixedLine               aFlAreas;
     ListBox                 aLbOutPos;
     FixedText               aFtOutArea;
+    FixedText			aFtInArea;
     ScRefEdit               aEdOutPos;
     ScRefButton             aRbOutPos;
+    ScRefEdit               aEdInPos;
+    ScRefButton             aRbInPos;
     CheckBox                aBtnIgnEmptyRows;
     CheckBox                aBtnDetectCat;
     CheckBox                aBtnTotalCol;
@@ -252,6 +255,7 @@
 	DECL_LINK( SelAreaHdl, ListBox * );
 	DECL_LINK( MoreClickHdl, MoreButton * );
 	DECL_LINK( EdModifyHdl, Edit * );
+	DECL_LINK( EdInModifyHdl, Edit * );
 	DECL_LINK( OkHdl, OKButton * );
 	DECL_LINK( CancelHdl, CancelButton * );
 };
diff -u -r ../../../sc.bak/source/ui/miscdlgs/anyrefdg.cxx sc/source/ui/miscdlgs/anyrefdg.cxx
--- ../../../sc.bak/source/ui/miscdlgs/anyrefdg.cxx	2004-12-22 14:05:08.000000000 +0530
+++ sc/source/ui/miscdlgs/anyrefdg.cxx	2005-01-17 11:28:44.000000000 +0530
@@ -317,6 +317,11 @@
     pRefEdit = pEdit;
 }
 
+ScRefEdit* ScRefButton::GetReferencesEdit ()
+{
+    return pRefEdit;
+}
+
 //----------------------------------------------------------------------------
 
 void ScRefButton::Click()
diff -u -r ../../../sc.bak/source/ui/view/cellsh2.cxx sc/source/ui/view/cellsh2.cxx
--- ../../../sc.bak/source/ui/view/cellsh2.cxx	2004-12-22 14:05:08.000000000 +0530
+++ sc/source/ui/view/cellsh2.cxx	2005-01-19 11:10:27.356087192 +0530
@@ -598,6 +598,8 @@
 					}
 
 					const ScDPObject* pDPObject = pTabViewShell->GetDialogDPObject();
+					ScRange aR = pDPObject->GetSheetDesc()->aSourceRange;
+
 					if ( pDPObject )
 					{
 						const ScPivotItem* pPItem = (const ScPivotItem*)pItem;
