[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Feb 19 15:35:00 UTC 2019
vcl/source/treelist/treelist.cxx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
New commits:
commit 1995ef43b640469ab592a3c65766dfa4de07051f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Feb 19 13:43:23 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Feb 19 16:34:37 2019 +0100
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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;
More information about the Libreoffice-commits
mailing list