sw/source/core/txtnode/ndhints.cxx |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

New commits:
commit 3783bf8d135bbd247d412d3ca01ac8b43753c0dd
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jun 14 10:07:30 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jun 14 16:06:00 2024 +0200

    reduce code duplication in SwpHints
    
    Change-Id: Id62389b1a11cd0ec2d04923d037ddcf3ab6b71f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168856
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/txtnode/ndhints.cxx 
b/sw/source/core/txtnode/ndhints.cxx
index a9b9d4b6c51c..f5f234d45e80 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -405,24 +405,9 @@ bool SwpHints::Check(bool bPortionsMerged) const
 
 void SwpHints::Resort() const
 {
-    if (m_bStartMapNeedsSorting)
-    {
-        auto & rStartMap = const_cast<SwpHints*>(this)->m_HintsByStart;
-        std::sort(rStartMap.begin(), rStartMap.end(), CompareSwpHtStart);
-        m_bStartMapNeedsSorting = false;
-    }
-    if (m_bEndMapNeedsSorting)
-    {
-        auto & rEndMap = const_cast<SwpHints*>(this)->m_HintsByEnd;
-        std::sort(rEndMap.begin(), rEndMap.end(), CompareSwpHtEnd());
-        m_bEndMapNeedsSorting = false;
-    }
-    if (m_bWhichMapNeedsSorting)
-    {
-        auto & rWhichStartMap = 
const_cast<SwpHints*>(this)->m_HintsByWhichAndStart;
-        std::sort(rWhichStartMap.begin(), rWhichStartMap.end(), 
CompareSwpHtWhichStart());
-        m_bWhichMapNeedsSorting = false;
-    }
+    ResortStartMap();
+    ResortEndMap();
+    ResortWhichMap();
 }
 
 void SwpHints::ResortStartMap() const

Reply via email to