diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-02-10 14:08:59 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-02-10 15:32:07 +0100 |
commit | f68f25b6c9851e30a93ee0f0da1f0c59121e0f3b (patch) | |
tree | d6f3e42dc120ad03852fea194db093346590d73a /sw/source | |
parent | e67fa2e3130495ace53412cc167b49670e3d8351 (diff) |
sw tooltip on bibliography fields: add an SwTOXInternational factory
This is normally created in SwAuthorityFieldType::GetSequencePos(), but
this way the logic can be reused when creating an SwTOXAuthority outside
SwTOXBaseSection::Update().
Towards providing a tooltip on mouseover for bibliography reference
fields.
Change-Id: Ide15d0e30223ca40514439c3f3c506651228c69b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110705
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/fields/authfld.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index e00c727962cc..53867c809673 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -177,6 +177,11 @@ sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) return m_DataArr.size()-1; } +std::unique_ptr<SwTOXInternational> SwAuthorityFieldType::CreateTOXInternational() const +{ + return std::make_unique<SwTOXInternational>(m_eLanguage, SwTOIOptions::NONE, m_sSortAlgorithm); +} + sal_uInt16 SwAuthorityFieldType::GetSequencePos(const SwAuthEntry* pAuthEntry, SwRootFrame const*const pLayout) { @@ -186,7 +191,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(const SwAuthEntry* pAuthEntry, if(m_SequArr.empty()) { IDocumentRedlineAccess const& rIDRA(m_pDoc->getIDocumentRedlineAccess()); - SwTOXInternational aIntl(m_eLanguage, SwTOIOptions::NONE, m_sSortAlgorithm); + std::unique_ptr<SwTOXInternational> pIntl = CreateTOXInternational(); // sw_redlinehide: need 2 arrays because the sorting may be different, // if multiple fields refer to the same entry and first one is deleted std::vector<std::unique_ptr<SwTOXSortTabBase>> aSortArr; @@ -217,11 +222,11 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(const SwAuthEntry* pAuthEntry, { continue; } - auto const InsertImpl = [&aIntl, pTextNode, pFormatField] + auto const InsertImpl = [&pIntl, pTextNode, pFormatField] (std::vector<std::unique_ptr<SwTOXSortTabBase>> & rSortArr) { std::unique_ptr<SwTOXAuthority> pNew( - new SwTOXAuthority(*pTextNode, *pFormatField, aIntl)); + new SwTOXAuthority(*pTextNode, *pFormatField, *pIntl)); for (size_t i = 0; i < rSortArr.size(); ++i) { |