sw/inc/editsh.hxx                  |    2 +-
 sw/source/core/edit/editsh.cxx     |   14 +++++++++++++-
 sw/source/uibase/utlui/content.cxx |    2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 78b723c3a1fad1c095de1e5c746aef513556a53b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Wed Apr 13 18:15:11 2022 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Thu Apr 14 18:44:14 2022 +0200

    tdf#52113, tdf#148312 Don't include table of contents hyperlinks
    
    in the Navigator content tree Hyperlinks entries
    
    Change-Id: I8d4499ecd6d9f617192560b31d7f87f7f26269f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132988
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 95faaf6003cd..9439d8a777e0 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -826,7 +826,7 @@ public:
 
     bool InsertURL( const SwFormatINetFormat& rFormat, const OUString& rStr,
                     bool bKeepSelection = false );
-    void GetINetAttrs( SwGetINetAttrs& rArr );
+    void GetINetAttrs(SwGetINetAttrs& rArr , bool bIncludeInToxContent = true);
 
     OUString GetDropText( const sal_Int32 nChars ) const;
     void   ReplaceDropText( const OUString &rStr, SwPaM* pPaM = nullptr );
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index b1d265305321..a6a27bcc5b57 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -685,7 +685,7 @@ bool SwEditShell::InsertURL( const SwFormatINetFormat& 
rFormat, const OUString&
     return true;
 }
 
-void SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
+void SwEditShell::GetINetAttrs(SwGetINetAttrs& rArr, bool bIncludeInToxContent)
 {
     rArr.clear();
 
@@ -705,6 +705,18 @@ void SwEditShell::GetINetAttrs( SwGetINetAttrs& rArr )
                 && pFrame->MapModelToView(pTextNd, pFnd->GetStart())
                     != pFrame->MapModelToView(pTextNd, *pFnd->GetEnd()))
             {
+                // tdf#52113, tdf#148312 Don't include table of contents 
hyperlinks in the
+                // Navigator content tree Hyperlinks entries
+                if (!bIncludeInToxContent)
+                {
+                    if(const SwSectionNode* pSectNd = 
pTextNd->FindSectionNode())
+                    {
+                        SectionType eType = pSectNd->GetSection().GetType();
+                        if(SectionType::ToxContent == eType)
+                            continue;
+                    }
+                }
+
                 SwTextINetFormat& rAttr = *pFnd;
                 OUString sText( pTextNd->GetExpandText(GetLayout(),
                         rAttr.GetStart(), *rAttr.GetEnd() - rAttr.GetStart()) 
);
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 719b2016e1b7..c614ee4d7c7d 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -714,7 +714,7 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
         case ContentTypeId::URLFIELD:
         {
             SwGetINetAttrs aArr;
-            m_pWrtShell->GetINetAttrs(aArr);
+            m_pWrtShell->GetINetAttrs(aArr, false);
 
             if (m_bAlphabeticSort)
             {

Reply via email to