Kaydet (Commit) 42726853 authored tarafından Albert Thuswaldner's avatar Albert Thuswaldner Kaydeden (comit) Caolán McNamara

Calc Sort: Introducing new method AddKeyItem to avoid code duplication

Change-Id: Ic34b5958472a7d2c19ff686914309b6699e237c4
Reviewed-on: https://gerrit.libreoffice.org/3370Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 4f4ab917
...@@ -156,11 +156,12 @@ IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar ) ...@@ -156,11 +156,12 @@ IMPL_LINK( ScSortKeyCtrl, ScrollHdl, ScrollBar*, pScrollBar )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItem ) void ScSortKeyCtrl::AddSortKey( sal_uInt16 nItemIndex )
{ {
m_rVertScroll.SetRangeMax( nItem ); ++nItemIndex;
m_rVertScroll.DoScroll( nItem ); m_rVertScroll.SetRangeMax( nItemIndex );
m_aSortWin.AddSortKey( nItem ); m_rVertScroll.DoScroll( nItemIndex );
m_aSortWin.AddSortKey( nItemIndex );
checkAutoVScroll(); checkAutoVScroll();
} }
......
...@@ -141,10 +141,7 @@ void ScTabPageSortFields::Init() ...@@ -141,10 +141,7 @@ void ScTabPageSortFields::Init()
// Create three sort key dialogs by default // Create three sort key dialogs by default
for ( sal_uInt16 i=0; i<nSortKeyCount; i++ ) for ( sal_uInt16 i=0; i<nSortKeyCount; i++ )
{ AddSortKeyItem(i);
maSortKeyCtrl.AddSortKey(i+1);
maSortKeyItems[i].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -170,11 +167,8 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ ) ...@@ -170,11 +167,8 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
{ {
// Make sure that the all sort keys are reset // Make sure that the all sort keys are reset
for ( sal_uInt16 i=nSortKeyCount; i<aSortData.maKeyState.size(); i++ ) 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(); nSortKeyCount = aSortData.maKeyState.size();
FillFieldLists(0); FillFieldLists(0);
...@@ -443,6 +437,15 @@ sal_uInt16 ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField ) ...@@ -443,6 +437,15 @@ sal_uInt16 ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
return nFieldPos; return nFieldPos;
} }
//------------------------------------------------------------------------
void ScTabPageSortFields::AddSortKeyItem( sal_uInt16 nItemIndex )
{
maSortKeyCtrl.AddSortKey( nItemIndex );
maSortKeyItems[nItemIndex].m_pLbSort->SetSelectHdl(
LINK( this, ScTabPageSortFields, SelectHdl ) );
}
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// Handler: // Handler:
//--------- //---------
...@@ -463,9 +466,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb ) ...@@ -463,9 +466,7 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
// Add Sort Key Item // Add Sort Key Item
++nSortKeyCount; ++nSortKeyCount;
maSortKeyCtrl.AddSortKey( nSortKeyCount ); AddSortKeyItem( nSortKeyIndex );
maSortKeyItems[nSortKeyIndex].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
FillFieldLists( nSortKeyIndex ); FillFieldLists( nSortKeyIndex );
// Set Status // Set Status
......
...@@ -99,7 +99,7 @@ private: ...@@ -99,7 +99,7 @@ private:
public: public:
ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems); ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
void setScrollRange(); void setScrollRange();
void AddSortKey( sal_uInt16 nItem ); void AddSortKey( sal_uInt16 nItemIndex );
}; };
#endif // SC_SORTKEYDLG_HXX #endif // SC_SORTKEYDLG_HXX
......
...@@ -95,6 +95,7 @@ private: ...@@ -95,6 +95,7 @@ private:
void Init (); void Init ();
void FillFieldLists ( sal_uInt16 nStartField ); void FillFieldLists ( sal_uInt16 nStartField );
sal_uInt16 GetFieldSelPos ( SCCOLROW nField ); sal_uInt16 GetFieldSelPos ( SCCOLROW nField );
void AddSortKeyItem( sal_uInt16 nItemIndex );
// Handler ------------------------ // Handler ------------------------
DECL_LINK( SelectHdl, ListBox * ); DECL_LINK( SelectHdl, ListBox * );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment