update dev300-m58
[ooovba.git] / applied_patches / 0149-calc-dp-default-new-sheet.diff
blob2054325229b0ec03297665ef58ae0cc6cee19df7
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 );
18 - Init();
19 + Init(bNewOutput);
20 FreeResource();
23 @@ -202,7 +202,7 @@ ScDPFieldWindow& ScDPLayoutDlg::GetFieldWindow( ScDPFieldType eType )
24 return aWndSelect;
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()
37 + if (bNewOutput)
38 + {
39 + // Output to a new sheet by default for a brand-new output.
40 + aLbOutPos.SelectEntryPos(1);
41 + aEdOutPos.Disable();
42 + aRbOutPos.Disable();
43 + }
44 + else
45 + {
46 + // Modifying an existing dp output.
48 - if ( thePivotData.nTab != MAXTAB+1 )
49 - {
50 - String aStr;
51 - ScAddress( thePivotData.nCol,
52 - thePivotData.nRow,
53 - thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() );
54 - aEdOutPos.SetText( aStr );
55 - EdModifyHdl(0);
56 - }
57 - else
58 - {
59 - aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 );
60 - SelAreaHdl(NULL);
61 - }
62 + if ( thePivotData.nTab != MAXTAB+1 )
63 + {
64 + String aStr;
65 + ScAddress( thePivotData.nCol,
66 + thePivotData.nRow,
67 + thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() );
68 + aEdOutPos.SetText( aStr );
69 + EdModifyHdl(0);
70 + }
71 + else
72 + {
73 + aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 );
74 + SelAreaHdl(NULL);
75 + }
76 + }
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:
85 SfxBindings* pB,
86 SfxChildWindow* pCW,
87 Window* pParent,
88 - const ScDPObject& rDPObject );
89 + const ScDPObject& rDPObject,
90 + bool bNewOutput );
91 virtual ~ScDPLayoutDlg();
93 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc );
94 @@ -190,7 +191,7 @@ private:
96 private:
97 ScDPFieldWindow& GetFieldWindow ( ScDPFieldType eType );
98 - void Init ();
99 + void Init (bool bNewOutput);
100 void InitWndSelect ( const ::std::vector<ScDPLabelDataRef>& rLabels );
101 void InitWnd ( PivotField* pArr, long nCount, ScDPFieldType eType );
102 void InitFocus ();
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);
121 break;