[Libreoffice-commits] core.git: sw/inc sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 14:33:01 UTC 2021


 sw/inc/authfld.hxx                |    3 +++
 sw/source/core/fields/authfld.cxx |   11 ++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit f68f25b6c9851e30a93ee0f0da1f0c59121e0f3b
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Feb 10 14:08:59 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Feb 10 15:32:07 2021 +0100

    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 at collabora.com>
    Tested-by: Jenkins

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)
                 {


More information about the Libreoffice-commits mailing list