diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2013-04-15 22:41:17 +0200 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2013-04-15 22:41:17 +0200 |
commit | 0d3a130511fcd28d3d24d5b56275de73d8fbfc1a (patch) | |
tree | 354d201761571bf622b3650729dd0f3b7944cf84 /sc | |
parent | 935ccf0fb5b164dcf86b306b570a04530b962314 (diff) |
Revert "Calc Sort: Introducing new method AddKeyItem to avoid code duplication"
This reverts commit 42726853bb90eab11bf4fde8b0358ca3c3354529.
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...
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/sortkeydlg.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/dbgui/tpsort.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/inc/sortkeydlg.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/tpsort.hxx | 1 |
4 files changed, 17 insertions, 20 deletions
diff --git a/sc/source/ui/dbgui/sortkeydlg.cxx b/sc/source/ui/dbgui/sortkeydlg.cxx index 3e0907635de9..006dad53bbb1 100644 --- a/sc/source/ui/dbgui/sortkeydlg.cxx +++ b/sc/source/ui/dbgui/sortkeydlg.cxx @@ -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(); } diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index f153cf7b063b..6731e7195cb6 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -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 diff --git a/sc/source/ui/inc/sortkeydlg.hxx b/sc/source/ui/inc/sortkeydlg.hxx index 77186638d1a6..060e8ad24c47 100644 --- a/sc/source/ui/inc/sortkeydlg.hxx +++ b/sc/source/ui/inc/sortkeydlg.hxx @@ -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 diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx index e4d82c626143..8ce4a4278a89 100644 --- a/sc/source/ui/inc/tpsort.hxx +++ b/sc/source/ui/inc/tpsort.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 * ); |