sw/source/uibase/utlui/content.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 442be5242e2f541b8ad847cd629e715f3fd84205
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Thu Oct 21 01:44:39 2021 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Oct 23 09:22:42 2021 +0200

    SwNavigator: Make tracked drawing object scroll into content tree view
    
    Change-Id: I948c8b38f0df86f30f9c5af56aea5103c82c661c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123966
    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 56ce7d9b5e87..c56a7fca4d83 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3512,7 +3512,11 @@ static void lcl_SelectDrawObjectByName(weld::TreeView& 
rContentTree, std::u16str
         {
             if (rName == rContentTree.get_text(*xIter))
             {
-                rContentTree.select(*xIter);
+                if (!rContentTree.is_selected(*xIter))
+                {
+                    rContentTree.select(*xIter);
+                    rContentTree.scroll_to_row(*xIter);
+                }
                 break;
             }
         }
@@ -3673,7 +3677,12 @@ void SwContentTree::UpdateTracking()
                                                SelectionType::DbForm)) &&
             !(m_bIsRoot && m_nRootType != ContentTypeId::DRAWOBJECT))
     {
-        m_xTreeView->unselect_all();
+        // Multiple selection is possible when in root content navigation view 
so unselect all
+        // selected entries before reselecting. This causes a bit of an 
annoyance when the treeview
+        // scroll bar is used and focus is in the document by causing the last 
selected entry to
+        // scroll back into view.
+        if (m_bIsRoot)
+            m_xTreeView->unselect_all();
         SdrView* pSdrView = m_pActiveShell->GetDrawView();
         if (pSdrView)
         {

Reply via email to