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 <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2021-09-29 23:41:57 -08:00
parent 2f54c40fc2
commit 24d3e8d219
6 changed files with 110 additions and 4 deletions

View File

@@ -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>

View File

@@ -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);

View File

@@ -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

View File

@@ -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()
{

View File

@@ -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);

View File

@@ -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);