sw/source/uibase/utlui/content.cxx |   36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

New commits:
commit 7826ed1b4a4f1424f7425037da4ecec86ab24d46
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Mon Nov 1 17:40:02 2021 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Nov 2 17:15:20 2021 +0100

    SwNavigator: Track frame content before other content
    
    Do this to prevent other trackable content from being track when a
    frame is selected. e.g. a hyperlink is at the start of frame content
    and the frame is selected. Without this patch the hyperlink is
    highlighted in the Navigator content tree instead of the frame.
    
    Change-Id: I0adac6659de6a5698b50a887052cc6aaffee578d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124577
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index e813826fb154..5f323790e107 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3677,6 +3677,25 @@ void SwContentTree::UpdateTracking()
 
     if (bTrack)
     {
+        {
+        // graphic, frame, and ole
+        OUString aContentTypeName;
+        if (m_bImageTracking && m_pActiveShell->GetSelectionType() == 
SelectionType::Graphic &&
+                !(m_bIsRoot && m_nRootType != ContentTypeId::GRAPHIC))
+            aContentTypeName = SwResId(STR_CONTENT_TYPE_GRAPHIC);
+        else if (m_bFrameTracking && m_pActiveShell->GetSelectionType() == 
SelectionType::Frame &&
+                 !(m_bIsRoot && m_nRootType != ContentTypeId::FRAME))
+            aContentTypeName = SwResId(STR_CONTENT_TYPE_FRAME);
+        else if (m_bOLEobjectTracking && m_pActiveShell->GetSelectionType() == 
SelectionType::Ole &&
+                 !(m_bIsRoot && m_nRootType != ContentTypeId::OLE))
+            aContentTypeName = SwResId(STR_CONTENT_TYPE_OLE);
+        if (!aContentTypeName.isEmpty())
+        {
+            OUString aName(m_pActiveShell->GetFlyName());
+            lcl_SelectByContentTypeAndName(this, *m_xTreeView, 
aContentTypeName, aName);
+            return;
+        }
+        }
         // footnotes and endnotes
         if (SwContentAtPos aContentAtPos(IsAttrAtPos::Ftn); 
m_bFootnoteTracking &&
                 
m_pActiveShell->GetContentAtPos(m_pActiveShell->GetCursorDocPos(), 
aContentAtPos) &&
@@ -3792,23 +3811,6 @@ void SwContentTree::UpdateTracking()
             Select();
             return;
         }
-        // graphic, frame, and ole
-        OUString aContentTypeName;
-        if (m_bImageTracking && m_pActiveShell->GetSelectionType() == 
SelectionType::Graphic &&
-                !(m_bIsRoot && m_nRootType != ContentTypeId::GRAPHIC))
-            aContentTypeName = SwResId(STR_CONTENT_TYPE_GRAPHIC);
-        else if (m_bFrameTracking && m_pActiveShell->GetSelectionType() == 
SelectionType::Frame &&
-                 !(m_bIsRoot && m_nRootType != ContentTypeId::FRAME))
-            aContentTypeName = SwResId(STR_CONTENT_TYPE_FRAME);
-        else if (m_bOLEobjectTracking && m_pActiveShell->GetSelectionType() == 
SelectionType::Ole &&
-                 !(m_bIsRoot && m_nRootType != ContentTypeId::OLE))
-            aContentTypeName = SwResId(STR_CONTENT_TYPE_OLE);
-        if (!aContentTypeName.isEmpty())
-        {
-            OUString aName(m_pActiveShell->GetFlyName());
-            lcl_SelectByContentTypeAndName(this, *m_xTreeView, 
aContentTypeName, aName);
-            return;
-        }
         // table
         if (m_bTableTracking && m_pActiveShell->IsCursorInTable() &&
                 !(m_bIsRoot && m_nRootType != ContentTypeId::TABLE))

Reply via email to