sw/inc/viewopt.hxx | 9 +++++++++ sw/source/ui/index/cnttab.cxx | 16 +++++++++++++++- sw/source/uibase/config/viewopt.cxx | 4 ++++ 3 files changed, 28 insertions(+), 1 deletion(-)
New commits: commit 8bf614179f5664d7cdd49db41ef462073cc8608d Author: Andreas Heinisch <andreas.heini...@yahoo.de> AuthorDate: Thu Nov 9 16:00:10 2023 +0100 Commit: Andreas Heinisch <andreas.heini...@yahoo.de> CommitDate: Mon Nov 13 18:16:38 2023 +0100 tdf#135266 - Remember last used entry level depending on the index type Change-Id: I4fe9342c28fc9135b73286e67464b16a1d910a9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159217 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de> diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx index 3c847acfd6fe..72659849a627 100644 --- a/sw/inc/viewopt.hxx +++ b/sw/inc/viewopt.hxx @@ -274,6 +274,9 @@ class SW_DLLPUBLIC SwViewOption bool m_bShowPlaceHolderFields : 1; // Only used in printing! mutable bool m_bIdle; sal_Int32 m_nDefaultAnchor; // GetDefaultAnchorType() to convert int to RndStdIds + // tdf#135266 - tox dialog: remember last used entry level depending on the index type + sal_uInt8 m_nTocEntryLvl; + sal_uInt8 m_nIdxEntryLvl; // Scale sal_uInt16 m_nZoom; // In percent. @@ -845,6 +848,12 @@ public: RndStdIds GetDefaultAnchorType() const; + // tdf#135266 - tox dialog: remember last used entry level depending on the index type + sal_uInt8 GetTocEntryLvl() const { return m_nTocEntryLvl; } + void SetTocEntryLvl(sal_uInt8 n) { m_nTocEntryLvl = n; } + sal_uInt8 GetIdxEntryLvl() const { return m_nIdxEntryLvl; } + void SetIdxEntryLvl(sal_uInt8 n) { m_nIdxEntryLvl = n; } + // Useful for when getting the current view SwViewOption is not possible otherwise static const SwViewOption& GetCurrentViewOptions(); }; diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 829beb6e9499..a5d3bf92ddef 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -2065,6 +2065,17 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(weld::Container* pPage, weld::DialogControl SwTOXEntryTabPage::~SwTOXEntryTabPage() { m_xTokenWIN.reset(); + + // tdf#135266 - remember last used entry level depending on the index type + if (const auto aSelectedIndex = m_xLevelLB->get_selected_index(); aSelectedIndex != -1) + { + auto& rSh = static_cast<SwMultiTOXTabDialog*>(GetDialogController())->GetWrtShell(); + SwViewOption* pVOpt = const_cast<SwViewOption*>(rSh.GetViewOptions()); + if (m_aLastTOXType == TOX_INDEX) + pVOpt->SetIdxEntryLvl(aSelectedIndex); + else + pVOpt->SetTocEntryLvl(aSelectedIndex); + } } IMPL_LINK_NOARG(SwTOXEntryTabPage, ModifyClickHdl, weld::Toggleable&, void) @@ -2240,7 +2251,10 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) else m_xLevelFT->set_label(m_sLevelStr); - m_xLevelLB->select(bToxIsIndex ? 1 : 0); + // tdf#135266 - remember last used entry level depending on the index type + m_xLevelLB->select(bToxIsIndex ? pTOXDlg->GetWrtShell().GetViewOptions()->GetIdxEntryLvl() + : pTOXDlg->GetWrtShell().GetViewOptions()->GetTocEntryLvl()); + //show or hide controls ShowHideControls(aCurType.eType); diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 1e78b1fdac02..36fdf1fd4484 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -292,6 +292,10 @@ SwViewOption::SwViewOption() : m_nDefaultAnchor = 1; //FLY_TO_CHAR + // tdf#135266 - tox dialog: remember last used entry level depending on the index type + m_nTocEntryLvl = 0; + m_nIdxEntryLvl = 1; + #ifdef DBG_UTIL // correspond to the statements in ui/config/cfgvw.src m_bTest1 = m_bTest2 = m_bTest3 = m_bTest4 =