summaryrefslogtreecommitdiff
path: root/sw/source/uibase/utlui
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2022-02-02 21:51:59 -0900
committerJim Raykowski <raykowj@gmail.com>2022-02-10 08:04:55 +0100
commitbc4ed9e69c99ade94e2f156e1719e386b9765f32 (patch)
treeccf8c918bc2aff378a52ad071364ae982c81f895 /sw/source/uibase/utlui
parent5dfe561cffe6e2a41a76ee78244b16bdb80b0892 (diff)
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 <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r--sw/source/uibase/utlui/content.cxx60
1 files changed, 26 insertions, 34 deletions
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:
{