summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-10 14:08:59 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-10 15:32:07 +0100
commitf68f25b6c9851e30a93ee0f0da1f0c59121e0f3b (patch)
treed6f3e42dc120ad03852fea194db093346590d73a
parente67fa2e3130495ace53412cc167b49670e3d8351 (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
-rw-r--r--sw/inc/authfld.hxx3
-rw-r--r--sw/source/core/fields/authfld.cxx11
2 files changed, 11 insertions, 3 deletions
diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 6ea5612f3164..7b7bdd8518be 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -29,6 +29,8 @@
#include <memory>
#include <vector>
+class SwTOXInternational;
+
class SwAuthEntry final : public salhelper::SimpleReferenceObject
{
friend class SwAuthorityFieldType;
@@ -98,6 +100,7 @@ public:
sal_uInt16 AppendField(const SwAuthEntry& rInsert);
sal_uInt16 GetSequencePos(const SwAuthEntry* pAuthEntry, SwRootFrame const* pLayout);
+ std::unique_ptr<SwTOXInternational> CreateTOXInternational() const;
bool IsSequence() const {return m_bIsSequence;}
void SetSequence(bool bSet)
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)
{