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

New commits:
commit ea0f4d74143a8109c7c118eb4e5b4bfa611b6a21
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Thu Dec 7 08:31:29 2023 +0100
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Thu Dec 7 15:06:38 2023 +0100

    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 <balazs.varga.ext...@allotropia.de>

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<weld::SpinButton> m_xEdNSheets;
+    std::unique_ptr<weld::Widget> m_xEdNSheetsImg;
     std::unique_ptr<weld::Entry> m_xEdSheetPrefix;
+    std::unique_ptr<weld::Widget> m_xEdSheetPrefixImg;
     std::unique_ptr<weld::CheckButton> m_xEdJumboSheets;
+    std::unique_ptr<weld::Widget> 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 <defaultsoptions.hxx>
 #include <document.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Calc.hxx>
 #include <config_features.h>
 
 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 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=2 n-rows=3 -->
+          <!-- n-columns=3 n-rows=3 -->
           <object class="GtkGrid" id="grid2">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -39,7 +39,7 @@
                 <property name="xalign">0</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -53,7 +53,7 @@
                 <property name="xalign">0</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">1</property>
               </packing>
             </child>
@@ -66,7 +66,7 @@
                 <property name="truncate-multiline">True</property>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">1</property>
               </packing>
             </child>
@@ -80,7 +80,7 @@
                 <property name="adjustment">adjustment1</property>
               </object>
               <packing>
-                <property name="left-attach">1</property>
+                <property name="left-attach">2</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -94,11 +94,50 @@
                 <property name="draw-indicator">True</property>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">2</property>
                 <property name="width">2</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkImage" id="locksheetsnumber">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="locksheetprefix">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockjumbo_sheets">
+                <property name="can-focus">False</property>
+                <property name="no-show-all">True</property>
+                <property name="halign">center</property>
+                <property name="valign">center</property>
+                <property name="icon-name">res/lock.png</property>
+              </object>
+              <packing>
+                <property name="left-attach">0</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
           </object>
         </child>
         <child type="label">

Reply via email to