From bc4ed9e69c99ade94e2f156e1719e386b9765f32 Mon Sep 17 00:00:00 2001 From: Jim Raykowski Date: Wed, 2 Feb 2022 21:51:59 -0900 Subject: 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 --- sw/source/uibase/utlui/content.cxx | 60 +++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 34 deletions(-) (limited to 'sw/source/uibase/utlui') 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 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(a->rINetAttr.GetTextNode()), - a->rINetAttr.GetStart()); - SwPosition bSwPos(const_cast(b->rINetAttr.GetTextNode()), - b->rINetAttr.GetStart()); - return aSwPos < bSwPos;}); - - SwGetINetAttrs::size_type n = 0; - for (auto p : aStableSortINetAttrsArray) - { - auto pCnt = make_unique( - 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 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(a->rINetAttr.GetTextNode()), + a->rINetAttr.GetStart()); + SwPosition bSwPos(const_cast(b->rINetAttr.GetTextNode()), + b->rINetAttr.GetStart()); + return aSwPos < bSwPos;}); + + SwGetINetAttrs::size_type n = 0; + for (auto p : aStableSortINetAttrsArray) + { + auto pCnt = make_unique(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: { -- cgit