Revert "Calc Sort: Introducing new method AddKeyItem to avoid code duplication"
This reverts commit 42726853bb
.
In tpsort.cxx this is used in another way than the other two cases:
++nSortKeyCount;
maSortKeyCtrl.AddSortKey( nSortKeyCount );
maSortKeyItems[nSortKeyIndex].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
So both are using the same index. In contrast the other two cases use (i+1)
and (i). So this can't be handled with one method or needs some more work...
This commit is contained in:
@@ -156,12 +156,11 @@ IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar )
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItemIndex )
|
||||
void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItem )
|
||||
{
|
||||
++nItemIndex;
|
||||
m_rVertScroll.SetRangeMax( nItemIndex );
|
||||
m_rVertScroll.DoScroll( nItemIndex );
|
||||
m_aSortWin.AddSortKey( nItemIndex );
|
||||
m_rVertScroll.SetRangeMax( nItem );
|
||||
m_rVertScroll.DoScroll( nItem );
|
||||
m_aSortWin.AddSortKey( nItem );
|
||||
checkAutoVScroll();
|
||||
}
|
||||
|
||||
|
@@ -141,7 +141,10 @@ void ScTabPageSortFields::Init()
|
||||
|
||||
// Create three sort key dialogs by default
|
||||
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
|
||||
AddSortKeyItem(i);
|
||||
{
|
||||
maSortKeyCtrl.AddSortKey(i+1);
|
||||
maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -167,8 +170,11 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
|
||||
{
|
||||
// Make sure that the all sort keys are reset
|
||||
for ( sal_uInt16 i=nSortKeyCount; i<aSortData.maKeyState.size(); i++ )
|
||||
AddSortKeyItem(i);
|
||||
|
||||
{
|
||||
maSortKeyCtrl.AddSortKey(i+1);
|
||||
maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this,
|
||||
ScTabPageSortFields, SelectHdl ) );
|
||||
}
|
||||
nSortKeyCount = aSortData.maKeyState.size();
|
||||
FillFieldLists(0);
|
||||
|
||||
@@ -437,15 +443,6 @@ sal_uInt16 ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
|
||||
return nFieldPos;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void ScTabPageSortFields::AddSortKeyItem( sal_uInt16 nItemIndex )
|
||||
{
|
||||
maSortKeyCtrl.AddSortKey( nItemIndex );
|
||||
maSortKeyItems[nItemIndex].m_pLbSort->SetSelectHdl(
|
||||
LINK( this, ScTabPageSortFields, SelectHdl ) );
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Handler:
|
||||
//---------
|
||||
@@ -466,7 +463,9 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
|
||||
|
||||
// Add Sort Key Item
|
||||
++nSortKeyCount;
|
||||
AddSortKeyItem( nSortKeyIndex );
|
||||
maSortKeyCtrl.AddSortKey( nSortKeyCount );
|
||||
maSortKeyItems[nSortKeyIndex].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
|
||||
|
||||
FillFieldLists( nSortKeyIndex );
|
||||
|
||||
// Set Status
|
||||
|
@@ -99,7 +99,7 @@ private:
|
||||
public:
|
||||
ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
|
||||
void setScrollRange();
|
||||
void AddSortKey( sal_uInt16 nItemIndex );
|
||||
void AddSortKey( sal_uInt16 nItem );
|
||||
};
|
||||
|
||||
#endif // SC_SORTKEYDLG_HXX
|
||||
|
@@ -95,7 +95,6 @@ private:
|
||||
void Init ();
|
||||
void FillFieldLists ( sal_uInt16 nStartField );
|
||||
sal_uInt16 GetFieldSelPos ( SCCOLROW nField );
|
||||
void AddSortKeyItem( sal_uInt16 nItemIndex );
|
||||
|
||||
// Handler ------------------------
|
||||
DECL_LINK( SelectHdl, ListBox * );
|
||||
|
Reference in New Issue
Block a user