officecfg/registry/schema/org/openoffice/Office/Writer.xcs |    7 ++++
 sw/source/uibase/inc/navicfg.hxx                           |    4 ++
 sw/source/uibase/utlui/content.cxx                         |    5 +++
 sw/source/uibase/utlui/navicfg.cxx                         |   19 ++++++++++---
 4 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 17a4f4d5e4d49189b43e748271d2d4fa330eef9b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Wed Dec 15 20:49:13 2021 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Sat Dec 18 04:44:44 2021 +0100

    tdf#131063 Add Navigate on select expert option
    
    Enhancement option to scroll the selected entry in Writer Navigator
    into the document view.
    
    Change-Id: I5c19a2e6a3a204a28723c3e1dfb15167dcb77c74
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126906
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 94dac6b7af67..1fe57e99cd72 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -5407,6 +5407,13 @@
         </info>
         <value>true</value>
       </prop>
+      <prop oor:name="NavigateOnSelect" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Specifies if navigate on entry select is active.</desc>
+          <label>Navigate on entry select on/off</label>
+        </info>
+        <value>false</value>
+      </prop>
     </group>
     <group oor:name="Envelope">
       <info>
diff --git a/sw/source/uibase/inc/navicfg.hxx b/sw/source/uibase/inc/navicfg.hxx
index 782bdfaf27b3..e36d45e10302 100644
--- a/sw/source/uibase/inc/navicfg.hxx
+++ b/sw/source/uibase/inc/navicfg.hxx
@@ -47,6 +47,7 @@ class SwNavigationConfig final : public utl::ConfigItem
     bool           m_bIsDrawingObjectTracking;
     bool           m_bIsFieldTracking;
     bool           m_bIsFootnoteTracking;
+    bool           m_bIsNavigateOnSelect;
 
     static css::uno::Sequence<OUString> GetPropertyNames();
 
@@ -56,6 +57,7 @@ public:
     SwNavigationConfig();
     virtual ~SwNavigationConfig() override;
 
+    void Load();
     virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames 
) override;
 
     ContentTypeId GetRootType()const {return m_nRootType;}
@@ -237,6 +239,8 @@ public:
                             m_bIsFootnoteTracking = bSet;
                         }
                     }
+
+    bool    IsNavigateOnSelect() const {return m_bIsNavigateOnSelect;}
 };
 
 #endif
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 2022dd00b792..e29ec40cab33 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4851,6 +4851,11 @@ void SwContentTree::ShowActualView()
 
 IMPL_LINK_NOARG(SwContentTree, SelectHdl, weld::TreeView&, void)
 {
+    if (m_pConfig->IsNavigateOnSelect())
+    {
+        ContentDoubleClickHdl(*m_xTreeView);
+        grab_focus();
+    }
     Select();
 }
 
diff --git a/sw/source/uibase/utlui/navicfg.cxx 
b/sw/source/uibase/utlui/navicfg.cxx
index d941f5fe3e4d..f06478cf9bbd 100644
--- a/sw/source/uibase/utlui/navicfg.cxx
+++ b/sw/source/uibase/utlui/navicfg.cxx
@@ -51,7 +51,8 @@ Sequence<OUString> SwNavigationConfig::GetPropertyNames()
         OUString("CommentTracking"),
         OUString("DrawingObjectTracking"),
         OUString("FieldTracking"),
-        OUString("FootnoteTracking")};
+        OUString("FootnoteTracking"),
+        OUString("NavigateOnSelect")};
 }
 
 SwNavigationConfig::SwNavigationConfig() :
@@ -76,7 +77,14 @@ SwNavigationConfig::SwNavigationConfig() :
     m_bIsCommentTracking(true),
     m_bIsDrawingObjectTracking(true),
     m_bIsFieldTracking(true),
-    m_bIsFootnoteTracking(true)
+    m_bIsFootnoteTracking(true),
+    m_bIsNavigateOnSelect(false)
+{
+    Load();
+    EnableNotification(GetPropertyNames());
+}
+
+void SwNavigationConfig::Load()
 {
     Sequence<OUString> aNames = GetPropertyNames();
     Sequence<Any> aValues = GetProperties(aNames);
@@ -134,6 +142,7 @@ SwNavigationConfig::SwNavigationConfig() :
                 case 18: m_bIsDrawingObjectTracking = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
                 case 19: m_bIsFieldTracking = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
                 case 20: m_bIsFootnoteTracking = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
+                case 21: m_bIsNavigateOnSelect = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
             }
         }
     }
@@ -174,11 +183,15 @@ void SwNavigationConfig::ImplCommit()
             case 18: pValues[nProp] <<= m_bIsDrawingObjectTracking; break;
             case 19: pValues[nProp] <<= m_bIsFieldTracking; break;
             case 20: pValues[nProp] <<= m_bIsFootnoteTracking; break;
+            case 21: pValues[nProp] <<= m_bIsNavigateOnSelect; break;
         }
     }
     PutProperties(aNames, aValues);
 }
 
-void SwNavigationConfig::Notify( const css::uno::Sequence< OUString >& ) {}
+void SwNavigationConfig::Notify( const css::uno::Sequence< OUString >& )
+{
+    Load();
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to