diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-02-19 13:43:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-02-19 16:34:37 +0100 |
commit | 1995ef43b640469ab592a3c65766dfa4de07051f (patch) | |
tree | 375af16f9a679c4a8828b37fd53e20049c582041 | |
parent | 58fa1889eeaa1d8e4abdf49a18660721309362ce (diff) |
ResortChildren doesn't honor sortmode
unlike GetInsertionPoint
Change-Id: I46bf5f5f395829c96dc715761bfbe10e7ab2c940
Reviewed-on: https://gerrit.libreoffice.org/68018
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/treelist/treelist.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx index d62db0dccb49..797c8405ebb5 100644 --- a/vcl/source/treelist/treelist.cxx +++ b/vcl/source/treelist/treelist.cxx @@ -1421,7 +1421,15 @@ public: bool operator() (std::unique_ptr<SvTreeListEntry> const& rpLeft, std::unique_ptr<SvTreeListEntry> const& rpRight) const { - return mrList.Compare(rpLeft.get(), rpRight.get()) < 0; + int nCompare = mrList.Compare(rpLeft.get(), rpRight.get()); + if (nCompare != 0 && mrList.GetSortMode() == SortDescending) + { + if( nCompare < 0 ) + nCompare = 1; + else + nCompare = -1; + } + return nCompare < 0; } }; @@ -1496,7 +1504,7 @@ void SvTreeList::GetInsertionPos( SvTreeListEntry const * pEntry, SvTreeListEntr k = (i+j)/2; const SvTreeListEntry* pTempEntry = rChildList[k].get(); nCompare = Compare( pEntry, pTempEntry ); - if( eSortMode == SortDescending && nCompare != 0 ) + if (nCompare != 0 && eSortMode == SortDescending) { if( nCompare < 0 ) nCompare = 1; |