1 diff --git sc/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
2 index 99897a0..4dee615 100644
3 --- sc/source/ui/dbgui/pvlaydlg.cxx
4 +++ sc/source/ui/dbgui/pvlaydlg.cxx
5 @@ -107,7 +107,7 @@ PointerStyle lclGetPointerForField( ScDPFieldType eType )
6 //----------------------------------------------------------------------------
8 ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
9 - const ScDPObject& rDPObject )
10 + const ScDPObject& rDPObject, bool bNewOutput )
11 : ScAnyRefDlg ( pB, pCW, pParent, RID_SCDLG_PIVOT_LAYOUT ),
12 aFlLayout ( this, ScResId( FL_LAYOUT ) ),
13 aFtPage ( this, ScResId( FT_PAGE ) ),
14 @@ -167,7 +167,7 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
15 xDlgDPObject->FillOldParam( thePivotData, FALSE );
16 xDlgDPObject->FillLabelData( thePivotData );
23 @@ -202,7 +202,7 @@ ScDPFieldWindow& ScDPLayoutDlg::GetFieldWindow( ScDPFieldType eType )
27 -void __EXPORT ScDPLayoutDlg::Init()
28 +void __EXPORT ScDPLayoutDlg::Init(bool bNewOutput)
30 DBG_ASSERT( pViewData && pDoc,
31 "Ctor-Initialisierung fehlgeschlagen!" );
32 @@ -302,21 +302,33 @@ void __EXPORT ScDPLayoutDlg::Init()
39 + // Output to a new sheet by default for a brand-new output.
40 + aLbOutPos.SelectEntryPos(1);
41 + aEdOutPos.Disable();
42 + aRbOutPos.Disable();
46 + // Modifying an existing dp output.
48 - if ( thePivotData.nTab != MAXTAB+1 )
51 - ScAddress( thePivotData.nCol,
53 - thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() );
54 - aEdOutPos.SetText( aStr );
59 - aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 );
62 + if ( thePivotData.nTab != MAXTAB+1 )
65 + ScAddress( thePivotData.nCol,
67 + thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() );
68 + aEdOutPos.SetText( aStr );
73 + aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 );
78 aBtnIgnEmptyRows.Check( thePivotData.bIgnoreEmptyRows );
79 aBtnDetectCat .Check( thePivotData.bDetectCategories );
80 diff --git sc/source/ui/inc/pvlaydlg.hxx sc/source/ui/inc/pvlaydlg.hxx
81 index ceebdb7..a3e08cb 100644
82 --- sc/source/ui/inc/pvlaydlg.hxx
83 +++ sc/source/ui/inc/pvlaydlg.hxx
84 @@ -89,7 +89,8 @@ public:
88 - const ScDPObject& rDPObject );
89 + const ScDPObject& rDPObject,
91 virtual ~ScDPLayoutDlg();
93 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
94 @@ -190,7 +191,7 @@ private:
97 ScDPFieldWindow& GetFieldWindow ( ScDPFieldType eType );
99 + void Init (bool bNewOutput);
100 void InitWndSelect ( const ::std::vector<ScDPLabelDataRef>& rLabels );
101 void InitWnd ( PivotField* pArr, long nCount, ScDPFieldType eType );
103 diff --git sc/source/ui/view/tabvwshc.cxx sc/source/ui/view/tabvwshc.cxx
104 index aa38b7a..b20876f 100644
105 --- sc/source/ui/view/tabvwshc.cxx
106 +++ sc/source/ui/view/tabvwshc.cxx
107 @@ -255,8 +255,13 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
109 if( pDialogDPObject )
111 + // Check for an existing datapilot output.
112 + ScViewData* pViewData = GetViewData();
113 + ScDPObject* pObj = GetViewData()->GetDocument()->GetDPAtCursor(
114 + pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
116 GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() );
117 - pResult = new ScDPLayoutDlg( pB, pCW, pParent, *pDialogDPObject );
118 + pResult = new ScDPLayoutDlg( pB, pCW, pParent, *pDialogDPObject, pObj == NULL);