From ea0f4d74143a8109c7c118eb4e5b4bfa611b6a21 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Thu, 7 Dec 2023 08:31:29 +0100 Subject: tdf#158465 - UI: Part 48 - Unify lockdown behavior of Options dialog for Calc - Defaults Page. Change-Id: I813469c6e56f0bd148afb17644853116e4ae0398 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160419 Tested-by: Jenkins Reviewed-by: Balazs Varga --- sc/source/ui/inc/tpdefaults.hxx | 3 ++ sc/source/ui/optdlg/tpdefaults.cxx | 20 +++++++++++++ sc/uiconfig/scalc/ui/optdefaultpage.ui | 51 ++++++++++++++++++++++++++++++---- 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/sc/source/ui/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx index 76ad8fc133ff..d3760948b6b3 100644 --- a/sc/source/ui/inc/tpdefaults.hxx +++ b/sc/source/ui/inc/tpdefaults.hxx @@ -38,8 +38,11 @@ private: OUString maOldPrefixValue; std::unique_ptr m_xEdNSheets; + std::unique_ptr m_xEdNSheetsImg; std::unique_ptr m_xEdSheetPrefix; + std::unique_ptr m_xEdSheetPrefixImg; std::unique_ptr m_xEdJumboSheets; + std::unique_ptr m_xEdJumboSheetsImg; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index 760c029fe9af..4528da5e48b5 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -14,13 +14,17 @@ #include #include #include +#include #include ScTpDefaultsOptions::ScTpDefaultsOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rCoreSet) : SfxTabPage(pPage, pController, "modules/scalc/ui/optdefaultpage.ui", "OptDefaultPage", &rCoreSet) , m_xEdNSheets(m_xBuilder->weld_spin_button("sheetsnumber")) + , m_xEdNSheetsImg(m_xBuilder->weld_widget("locksheetsnumber")) , m_xEdSheetPrefix(m_xBuilder->weld_entry("sheetprefix")) + , m_xEdSheetPrefixImg(m_xBuilder->weld_widget("locksheetprefix")) , m_xEdJumboSheets(m_xBuilder->weld_check_button("jumbo_sheets")) + , m_xEdJumboSheetsImg(m_xBuilder->weld_widget("lockjumbo_sheets")) { m_xEdNSheets->connect_changed( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) ); m_xEdSheetPrefix->connect_changed( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) ); @@ -90,6 +94,22 @@ void ScTpDefaultsOptions::Reset(const SfxItemSet* rCoreSet) m_xEdNSheets->set_value(aOpt.GetInitTabCount()); m_xEdSheetPrefix->set_text( aOpt.GetInitTabPrefix() ); m_xEdJumboSheets->set_state( aOpt.GetInitJumboSheets() ? TRISTATE_TRUE : TRISTATE_FALSE ); + + bool bReadOnly = officecfg::Office::Calc::Defaults::Sheet::SheetCount::isReadOnly(); + m_xEdNSheets->set_sensitive(!bReadOnly); + m_xEdNSheetsImg->set_visible(bReadOnly); + + bReadOnly = officecfg::Office::Calc::Defaults::Sheet::SheetPrefix::isReadOnly(); + m_xEdSheetPrefix->set_sensitive(!bReadOnly); + m_xEdSheetPrefixImg->set_visible(bReadOnly); + + if (m_xEdJumboSheets->is_visible()) + { + bReadOnly = officecfg::Office::Calc::Defaults::Sheet::JumboSheets::isReadOnly(); + m_xEdJumboSheets->set_sensitive(!bReadOnly); + m_xEdJumboSheetsImg->set_visible(bReadOnly); + } + m_xEdNSheets->save_value(); m_xEdSheetPrefix->save_value(); m_xEdJumboSheets->save_state(); diff --git a/sc/uiconfig/scalc/ui/optdefaultpage.ui b/sc/uiconfig/scalc/ui/optdefaultpage.ui index 95056beed213..de220b478041 100644 --- a/sc/uiconfig/scalc/ui/optdefaultpage.ui +++ b/sc/uiconfig/scalc/ui/optdefaultpage.ui @@ -21,7 +21,7 @@ 0 none - + True False @@ -39,7 +39,7 @@ 0 - 0 + 1 0 @@ -53,7 +53,7 @@ 0 - 0 + 1 1 @@ -66,7 +66,7 @@ True - 1 + 2 1 @@ -80,7 +80,7 @@ adjustment1 - 1 + 2 0 @@ -94,11 +94,50 @@ True - 0 + 1 2 2 + + + False + True + center + center + res/lock.png + + + 0 + 0 + + + + + False + True + center + center + res/lock.png + + + 0 + 1 + + + + + False + True + center + center + res/lock.png + + + 0 + 2 + + -- cgit v1.2.3