officecfg/registry/schema/org/openoffice/Office/Writer.xcs |   37 +++++++++++++
 sw/source/uibase/inc/conttree.hxx                          |    6 +-
 sw/source/uibase/inc/navicfg.hxx                           |   30 ++++++++++
 sw/source/uibase/utlui/content.cxx                         |   22 +++++++
 sw/source/uibase/utlui/navicfg.cxx                         |   16 ++++-
 sw/source/uibase/utlui/navipi.cxx                          |    3 +
 6 files changed, 110 insertions(+), 4 deletions(-)

New commits:
commit 24d3e8d219ce73a2e93f207b65050078535da57e
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Wed Sep 29 23:41:57 2021 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Tue Oct 5 00:32:18 2021 +0200

    Related: tdf#144817 tdf#144335 Persist SwNavigator tracking settings
    
    Add persistence to Writer Navigator Outline, Table, and Section
    tracking settings.
    
    Change-Id: If2d406d0540083d982c2e7ffb78b1a6e156817c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122874
    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 fde9c9457dc7..2782b6650cfe 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -5698,6 +5698,43 @@
         </info>
         <value>0</value>
       </prop>
+      <prop oor:name="OutlineTracking" oor:type="xs:int" oor:nillable="false">
+        <info>
+          <desc>Specifies outline tracking mode.</desc>
+        </info>
+        <constraints>
+          <enumeration oor:value="1">
+            <info>
+              <desc>Default</desc>
+            </info>
+          </enumeration>
+          <enumeration oor:value="2">
+            <info>
+              <desc>Focus</desc>
+            </info>
+          </enumeration>
+          <enumeration oor:value="3">
+            <info>
+              <desc>Off</desc>
+            </info>
+          </enumeration>
+        </constraints>
+        <value>1</value>
+      </prop>
+      <prop oor:name="TableTracking" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Specifies if Table tracking is active.</desc>
+          <label>Table tracking on/off</label>
+        </info>
+        <value>true</value>
+      </prop>
+      <prop oor:name="SectionTracking" oor:type="xs:boolean" 
oor:nillable="false">
+        <info>
+          <desc>Specifies if Section tracking is active.</desc>
+          <label>Section tracking on/off</label>
+        </info>
+        <value>true</value>
+      </prop>
     </group>
     <group oor:name="Envelope">
       <info>
diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index 2e321c9c23ba..ce295c13a09a 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -111,7 +111,7 @@ class SwContentTree final : public SfxListener
     ContentTypeId       m_nLastSelType;
     sal_uInt8           m_nOutlineLevel;
 
-    sal_uInt32          m_nOutlineTracking = 1;
+    sal_uInt8           m_nOutlineTracking = 1; // 1 default, 2 focus, 3 off
     bool m_bTableTracking = true;
     bool m_bSectionTracking = true;
 
@@ -215,6 +215,10 @@ public:
     sal_uInt8       GetOutlineLevel()const {return m_nOutlineLevel;}
     void            SetOutlineLevel(sal_uInt8 nSet);
 
+    void            SetOutlineTracking(sal_uInt8 nSet);
+    void            SetTableTracking(bool bSet);
+    void            SetSectionTracking(bool bSet);
+
     /** Execute commands of the Navigator */
     void            ExecCommand(std::string_view rCmd, bool bModifier);
 
diff --git a/sw/source/uibase/inc/navicfg.hxx b/sw/source/uibase/inc/navicfg.hxx
index 07c167de804b..78d9fad0b5ff 100644
--- a/sw/source/uibase/inc/navicfg.hxx
+++ b/sw/source/uibase/inc/navicfg.hxx
@@ -33,6 +33,9 @@ class SwNavigationConfig final : public utl::ConfigItem
     sal_Int32      m_nActiveBlock;   //ActiveBlock//Expand/CollapsState
     bool           m_bIsSmall;       //ShowListBox
     bool           m_bIsGlobalActive; //GlobalDocMode// global view for 
GlobalDoc valid?
+    sal_Int32      m_nOutlineTracking;
+    bool           m_bIsTableTracking;
+    bool           m_bIsSectionTracking;
 
     static css::uno::Sequence<OUString> GetPropertyNames();
 
@@ -97,6 +100,33 @@ public:
                             m_bIsGlobalActive = bSet;
                         }
                     }
+
+    sal_Int32   GetOutlineTracking()const {return m_nOutlineTracking;}
+    void        SetOutlineTracking(sal_Int32 nSet){
+                        if(m_nOutlineTracking != nSet)
+                        {
+                            SetModified();
+                            m_nOutlineTracking = nSet;
+                        }
+                    }
+
+    bool    IsTableTracking() const {return m_bIsTableTracking;}
+    void    SetTableTracking(bool bSet){
+                        if(m_bIsTableTracking != bSet)
+                        {
+                            SetModified();
+                            m_bIsTableTracking = bSet;
+                        }
+                    }
+
+    bool    IsSectionTracking() const {return m_bIsSectionTracking;}
+    void    SetSectionTracking(bool bSet){
+                        if(m_bIsSectionTracking != bSet)
+                        {
+                            SetModified();
+                            m_bIsSectionTracking = bSet;
+                        }
+                    }
 };
 
 #endif
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index da92775a4ba0..e26179b42348 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4174,11 +4174,13 @@ void SwContentTree::ExecuteContextMenuAction(const 
OString& rSelectedPopupEntry)
     if (rSelectedPopupEntry == "tabletracking")
     {
         m_bTableTracking = !m_bTableTracking;
+        SetTableTracking(m_bTableTracking);
         return;
     }
     if (rSelectedPopupEntry == "sectiontracking")
     {
         m_bSectionTracking = !m_bSectionTracking;
+        SetSectionTracking(m_bSectionTracking);
         return;
     }
 
@@ -4239,7 +4241,7 @@ void SwContentTree::ExecuteContextMenuAction(const 
OString& rSelectedPopupEntry)
         case 13:
             nSelectedPopupEntry -= 10;
             if(m_nOutlineTracking != nSelectedPopupEntry)
-                m_nOutlineTracking = nSelectedPopupEntry;
+                
SetOutlineTracking(static_cast<sal_uInt8>(nSelectedPopupEntry));
         break;
         //Outlinelevel
         case 101:
@@ -4438,6 +4440,24 @@ void SwContentTree::SetOutlineLevel(sal_uInt8 nSet)
     Display(State::ACTIVE == m_eState);
 }
 
+void SwContentTree::SetOutlineTracking(sal_uInt8 nSet)
+{
+    m_nOutlineTracking = nSet;
+    m_pConfig->SetOutlineTracking(m_nOutlineTracking);
+}
+
+void SwContentTree::SetTableTracking(bool bSet)
+{
+    m_bTableTracking = bSet;
+    m_pConfig->SetTableTracking(m_bTableTracking);
+}
+
+void SwContentTree::SetSectionTracking(bool bSet)
+{
+    m_bSectionTracking = bSet;
+    m_pConfig->SetSectionTracking(m_bSectionTracking);
+}
+
 // Mode Change: Show dropped Doc
 void SwContentTree::ShowHiddenShell()
 {
diff --git a/sw/source/uibase/utlui/navicfg.cxx 
b/sw/source/uibase/utlui/navicfg.cxx
index 386c3451bf3e..7d72438fd937 100644
--- a/sw/source/uibase/utlui/navicfg.cxx
+++ b/sw/source/uibase/utlui/navicfg.cxx
@@ -37,7 +37,10 @@ Sequence<OUString> SwNavigationConfig::GetPropertyNames()
         OUString("InsertMode"),
         OUString("ActiveBlock"),
         OUString("ShowListBox"),
-        OUString("GlobalDocMode")};
+        OUString("GlobalDocMode"),
+        OUString("OutlineTracking"),
+        OUString("TableTracking"),
+        OUString("SectionTracking")};
 }
 
 SwNavigationConfig::SwNavigationConfig() :
@@ -48,7 +51,10 @@ SwNavigationConfig::SwNavigationConfig() :
     m_nRegionMode(RegionMode::NONE),
     m_nActiveBlock(0),
     m_bIsSmall(false),
-    m_bIsGlobalActive(true)
+    m_bIsGlobalActive(true),
+    m_nOutlineTracking(1),
+    m_bIsTableTracking(true),
+    m_bIsSectionTracking(true)
 {
     Sequence<OUString> aNames = GetPropertyNames();
     Sequence<Any> aValues = GetProperties(aNames);
@@ -92,6 +98,9 @@ SwNavigationConfig::SwNavigationConfig() :
                 case 4: pValues[nProp] >>= m_nActiveBlock;    break;
                 case 5: m_bIsSmall        = 
*o3tl::doAccess<bool>(pValues[nProp]);  break;
                 case 6: m_bIsGlobalActive = 
*o3tl::doAccess<bool>(pValues[nProp]);  break;
+                case 7: pValues[nProp] >>= m_nOutlineTracking; break;
+                case 8: m_bIsTableTracking = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
+                case 9: m_bIsSectionTracking = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
             }
         }
     }
@@ -118,6 +127,9 @@ void SwNavigationConfig::ImplCommit()
             case 4: pValues[nProp] <<= m_nActiveBlock;    break;
             case 5: pValues[nProp] <<= m_bIsSmall; break;
             case 6: pValues[nProp] <<= m_bIsGlobalActive; break;
+            case 7: pValues[nProp] <<= m_nOutlineTracking; break;
+            case 8: pValues[nProp] <<= m_bIsTableTracking; break;
+            case 9: pValues[nProp] <<= m_bIsSectionTracking; break;
         }
     }
     PutProperties(aNames, aValues);
diff --git a/sw/source/uibase/utlui/navipi.cxx 
b/sw/source/uibase/utlui/navipi.cxx
index 7510e7bb65d8..8b68ca4d4980 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -569,6 +569,9 @@ SwNavigationPI::SwNavigationPI(weld::Widget* pParent,
 
     bool bFloatingNavigator = ParentIsFloatingWindow(m_xNavigatorDlg);
 
+    
m_xContentTree->SetOutlineTracking(static_cast<sal_uInt8>(m_pConfig->GetOutlineTracking()));
+    m_xContentTree->SetTableTracking(m_pConfig->IsTableTracking());
+    m_xContentTree->SetSectionTracking(m_pConfig->IsSectionTracking());
     m_xContentTree->set_selection_mode(SelectionMode::Single);
     m_xContentTree->ShowTree();
     m_xContent6ToolBox->set_item_active("listbox", true);

Reply via email to