[Libreoffice-commits] core.git: include/vcl vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 2 10:38:21 UTC 2021


 include/vcl/toolkit/treelist.hxx    |    2 +-
 vcl/source/app/salvtables.cxx       |    4 ++--
 vcl/source/treelist/treelist.cxx    |    8 ++++----
 vcl/source/treelist/treelistbox.cxx |    4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 169b8d7e0eb0c4674ba59769a8ef54604f653680
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jul 2 11:36:18 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 2 12:37:42 2021 +0200

    convert SvSortMode to scoped enum
    
    Change-Id: Ic137e1918f8fa33fbfe6a622be20aa4001172e2e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118280
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/toolkit/treelist.hxx b/include/vcl/toolkit/treelist.hxx
index e45d0d933c01..d4c6da101e6d 100644
--- a/include/vcl/toolkit/treelist.hxx
+++ b/include/vcl/toolkit/treelist.hxx
@@ -50,7 +50,7 @@ class SvTreeListEntry;
 class SvListView;
 class SvViewDataEntry;
 
-enum SvSortMode { SortAscending, SortDescending, SortNone };
+enum class SvSortMode { Ascending, Descending, None };
 
 // For the return values of Sortlink:
 // See International::Compare( pLeft, pRight )
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2b1908f55834..608baded3b4f 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4777,13 +4777,13 @@ void SalInstanceTreeView::make_unsorted()
 void SalInstanceTreeView::set_sort_order(bool bAscending)
 {
     SvTreeList* pListModel = m_xTreeView->GetModel();
-    pListModel->SetSortMode(bAscending ? SortAscending : SortDescending);
+    pListModel->SetSortMode(bAscending ? SvSortMode::Ascending : SvSortMode::Descending);
     pListModel->Resort();
 }
 
 bool SalInstanceTreeView::get_sort_order() const
 {
-    return m_xTreeView->GetModel()->GetSortMode() == SortAscending;
+    return m_xTreeView->GetModel()->GetSortMode() == SvSortMode::Ascending;
 }
 
 void SalInstanceTreeView::set_sort_indicator(TriState eState, int col)
diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index 6809eddb6a84..9c111bf99893 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -65,7 +65,7 @@ SvTreeList::SvTreeList(SvListView& listView) :
     nEntryCount = 0;
     bAbsPositionsValid = false;
     pRootItem.reset(new SvTreeListEntry);
-    eSortMode = SortNone;
+    eSortMode = SvSortMode::None;
 }
 
 SvTreeList::~SvTreeList()
@@ -1391,7 +1391,7 @@ public:
                      std::unique_ptr<SvTreeListEntry> const& rpRight) const
     {
         int nCompare = mrList.Compare(rpLeft.get(), rpRight.get());
-        if (nCompare != 0 && mrList.GetSortMode() == SortDescending)
+        if (nCompare != 0 && mrList.GetSortMode() == SvSortMode::Descending)
         {
             if( nCompare < 0 )
                 nCompare = 1;
@@ -1429,7 +1429,7 @@ void SvTreeList::GetInsertionPos( SvTreeListEntry const * pEntry, SvTreeListEntr
 {
     DBG_ASSERT(pEntry,"No Entry");
 
-    if( eSortMode == SortNone )
+    if( eSortMode == SvSortMode::None )
         return;
 
     rPos = TREELIST_ENTRY_NOTFOUND;
@@ -1448,7 +1448,7 @@ void SvTreeList::GetInsertionPos( SvTreeListEntry const * pEntry, SvTreeListEntr
         k = (i+j)/2;
         const SvTreeListEntry* pTempEntry = rChildList[k].get();
         nCompare = Compare( pEntry, pTempEntry );
-        if (nCompare != 0 && eSortMode == SortDescending)
+        if (nCompare != 0 && eSortMode == SvSortMode::Descending)
         {
             if( nCompare < 0 )
                 nCompare = 1;
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index f2357b890fe2..278f42dde1c2 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -2544,12 +2544,12 @@ void SvTreeListBox::ImplInitStyle()
     nTreeFlags |= SvTreeFlags::RECALCTABS;
     if (nWindowStyle & WB_SORT)
     {
-        GetModel()->SetSortMode(SortAscending);
+        GetModel()->SetSortMode(SvSortMode::Ascending);
         GetModel()->SetCompareHdl(LINK(this, SvTreeListBox, DefaultCompare));
     }
     else
     {
-        GetModel()->SetSortMode(SortNone);
+        GetModel()->SetSortMode(SvSortMode::None);
         GetModel()->SetCompareHdl(Link<const SvSortData&,sal_Int32>());
     }
     pImpl->SetStyle(nWindowStyle);


More information about the Libreoffice-commits mailing list