sw/source/uibase/utlui/content.cxx |   60 ++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 34 deletions(-)

New commits:
commit bc4ed9e69c99ade94e2f156e1719e386b9765f32
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Wed Feb 2 21:51:59 2022 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Thu Feb 10 08:04:55 2022 +0100

    SwNavigator: absorb lcl_InsertURLFieldContent function
    
    lcl_InsertURLFieldContent was done in commit
    6fcb52aa3d8b8f3686ba1dfae03f9d3cc281b5d3 to group common code. Since
    commit 3771a81060f9e1f60ada37c3b7fa0a51b3042952 it is now only used in
    one place.
    
    Change-Id: I0cba0765e011f1bb5183209d2530b96711f4d95a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129394
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 47daebc48613..67c5bfd4e24c 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -178,39 +178,6 @@ namespace
     {
         return IDocumentMarkAccess::GetType(*pMark) == 
IDocumentMarkAccess::MarkType::BOOKMARK;
     }
-
-    size_t lcl_InsertURLFieldContent(
-        SwContentArr *pMember,
-        SwWrtShell* pWrtShell,
-        const SwContentType *pCntType)
-    {
-        SwGetINetAttrs aArr;
-        pWrtShell->GetINetAttrs( aArr );
-
-        // use stable sort array to list hyperlinks in document order
-        std::vector<SwGetINetAttr*> aStableSortINetAttrsArray;
-        for (SwGetINetAttr& r : aArr)
-            aStableSortINetAttrsArray.emplace_back(&r);
-        std::stable_sort(aStableSortINetAttrsArray.begin(), 
aStableSortINetAttrsArray.end(),
-                         [](const SwGetINetAttr* a, const SwGetINetAttr* b){
-            SwPosition 
aSwPos(const_cast<SwTextNode&>(a->rINetAttr.GetTextNode()),
-                              a->rINetAttr.GetStart());
-            SwPosition 
bSwPos(const_cast<SwTextNode&>(b->rINetAttr.GetTextNode()),
-                              b->rINetAttr.GetStart());
-            return aSwPos < bSwPos;});
-
-        SwGetINetAttrs::size_type n = 0;
-        for (auto p : aStableSortINetAttrsArray)
-        {
-            auto pCnt = make_unique<SwURLFieldContent>(
-                        pCntType, p->sText,
-                        
INetURLObject::decode(p->rINetAttr.GetINetFormat().GetValue(),
-                                              
INetURLObject::DecodeMechanism::Unambiguous),
-                        &p->rINetAttr, ++n);
-            pMember->insert(std::move(pCnt));
-        }
-        return pMember->size();
-    }
 }
 
 // Content, contains names and reference at the content type.
@@ -775,7 +742,32 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
         }
         break;
         case ContentTypeId::URLFIELD:
-            lcl_InsertURLFieldContent(m_pMember.get(), m_pWrtShell, this);
+        {
+            SwGetINetAttrs aArr;
+            m_pWrtShell->GetINetAttrs(aArr);
+
+            // use stable sort array to list hyperlinks in document order
+            std::vector<SwGetINetAttr*> aStableSortINetAttrsArray;
+            for (SwGetINetAttr& r : aArr)
+                aStableSortINetAttrsArray.emplace_back(&r);
+            std::stable_sort(aStableSortINetAttrsArray.begin(), 
aStableSortINetAttrsArray.end(),
+                             [](const SwGetINetAttr* a, const SwGetINetAttr* 
b){
+                SwPosition 
aSwPos(const_cast<SwTextNode&>(a->rINetAttr.GetTextNode()),
+                                  a->rINetAttr.GetStart());
+                SwPosition 
bSwPos(const_cast<SwTextNode&>(b->rINetAttr.GetTextNode()),
+                                  b->rINetAttr.GetStart());
+                return aSwPos < bSwPos;});
+
+            SwGetINetAttrs::size_type n = 0;
+            for (auto p : aStableSortINetAttrsArray)
+            {
+                auto pCnt = make_unique<SwURLFieldContent>(this, p->sText,
+                            
INetURLObject::decode(p->rINetAttr.GetINetFormat().GetValue(),
+                                                  
INetURLObject::DecodeMechanism::Unambiguous),
+                            &p->rINetAttr, ++n);
+                m_pMember->insert(std::move(pCnt));
+            }
+        }
         break;
         case ContentTypeId::INDEX:
         {

Reply via email to