[Libreoffice-commits] core.git: sc/source
Albert Thuswaldner
albert.thuswaldner at gmail.com
Mon May 6 02:42:16 PDT 2013
sc/source/ui/dbgui/tpsort.cxx | 40 ++++++++++++++++++++++++----------------
sc/source/ui/inc/tpsort.hxx | 1 +
2 files changed, 25 insertions(+), 16 deletions(-)
New commits:
commit b9cd66b970a2b76d6f07ead71b9df7a9232ff5af
Author: Albert Thuswaldner <albert.thuswaldner at gmail.com>
Date: Sat May 4 01:39:24 2013 +0200
fdo#51828 - UI: Sort: can use more than 3 criteria once only - additional fix
Change-Id: I569766945d96eae74479e310d674c9420e9a2b4b
Reviewed-on: https://gerrit.libreoffice.org/3772
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index 6731e71..fd62073 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -184,7 +184,6 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
{
maSortKeyItems[i].m_pLbSort->SelectEntryPos( GetFieldSelPos(
aSortData.maKeyState[i].nField ) );
-
(aSortData.maKeyState[i].bAscending)
? maSortKeyItems[i].m_pBtnUp->Check()
: maSortKeyItems[i].m_pBtnDown->Check();
@@ -234,6 +233,10 @@ void ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
pDlg->SetByRows ( bSortByRows );
pDlg->SetHeaders( bHasHeader );
}
+
+ // Make sure that there is always a last undefined sort key
+ if ( maSortKeyItems[nSortKeyCount - 1].m_pLbSort->GetSelectEntryPos() > 0 )
+ SetLastSortKey( nSortKeyCount );
}
// -----------------------------------------------------------------------
@@ -443,6 +446,25 @@ sal_uInt16 ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
return nFieldPos;
}
+void ScTabPageSortFields::SetLastSortKey( sal_uInt16 nItem )
+{
+ // Extend local SortParam copy
+ const ScSortKeyState atempKeyState = { false, 0, true };
+ aSortData.maKeyState.push_back( atempKeyState );
+
+ // Add Sort Key Item
+ ++nSortKeyCount;
+ maSortKeyCtrl.AddSortKey( nSortKeyCount );
+ maSortKeyItems[nItem].m_pLbSort->SetSelectHdl(
+ LINK( this, ScTabPageSortFields, SelectHdl ) );
+
+ FillFieldLists( nItem );
+
+ // Set Status
+ maSortKeyItems[nItem].m_pBtnUp->Check();
+ maSortKeyItems[nItem].m_pLbSort->SelectEntryPos( 0 );
+}
+
// -----------------------------------------------------------------------
// Handler:
//---------
@@ -451,26 +473,12 @@ IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
{
OUString aSelEntry = pLb->GetSelectEntry();
ScSortKeyItems::iterator pIter;
- sal_uInt16 nSortKeyIndex = nSortKeyCount;
// If last listbox is enabled add one item
if ( maSortKeyItems.back().m_pLbSort == pLb )
if ( aSelEntry != aStrUndefined )
{
- // Extend local SortParam copy
- const ScSortKeyState atempKeyState = { false, 0, true };
- aSortData.maKeyState.push_back( atempKeyState );
-
- // Add Sort Key Item
- ++nSortKeyCount;
- maSortKeyCtrl.AddSortKey( nSortKeyCount );
- maSortKeyItems[nSortKeyIndex].m_pLbSort->SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
-
- FillFieldLists( nSortKeyIndex );
-
- // Set Status
- maSortKeyItems[nSortKeyIndex].m_pBtnUp->Check();
- maSortKeyItems[nSortKeyIndex].m_pLbSort->SelectEntryPos( 0 );
+ SetLastSortKey( nSortKeyCount );
return 0;
}
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 8ce4a42..b230581 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -95,6 +95,7 @@ private:
void Init ();
void FillFieldLists ( sal_uInt16 nStartField );
sal_uInt16 GetFieldSelPos ( SCCOLROW nField );
+ void SetLastSortKey( sal_uInt16 nItem );
// Handler ------------------------
DECL_LINK( SelectHdl, ListBox * );
More information about the Libreoffice-commits
mailing list