cui/source/options/optfltr.cxx |   33 ++++++++++-
 cui/source/options/optfltr.hxx |    8 ++
 cui/uiconfig/ui/optfltrpage.ui |  120 ++++++++++++++++++++++++++++++++++++++---
 3 files changed, 151 insertions(+), 10 deletions(-)

New commits:
commit 30877bdc01d3a9cda1878f66ca7a84760f5f8c67
Author:     Balazs Varga <[email protected]>
AuthorDate: Wed Nov 1 23:03:19 2023 +0100
Commit:     Balazs Varga <[email protected]>
CommitDate: Thu Nov 2 13:50:51 2023 +0100

    tdf#157860 - UI: Part 14 - Unify lockdown behavior of Options dialog
    
    for Load/Save VBA Properties Page.
    
    Change-Id: I9526c2a5aa25fbdea1edbc0051d9b6a29c643d8d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158781
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <[email protected]>

diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 0f1df6ef6755..7c04c20b27d0 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -20,6 +20,9 @@
 #include <unotools/moduleoptions.hxx>
 #include <unotools/fltrcfg.hxx>
 #include <officecfg/Office/Common.hxx>
+#include <officecfg/Office/Calc.hxx>
+#include <officecfg/Office/Writer.hxx>
+#include <officecfg/Office/Impress.hxx>
 #include "optfltr.hxx"
 #include <strings.hrc>
 #include <dialmgr.hxx>
@@ -39,13 +42,21 @@ enum class MSFltrPg2_CheckBoxEntries {
 OfaMSFilterTabPage::OfaMSFilterTabPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rSet)
     : SfxTabPage(pPage, pController, "cui/ui/optfltrpage.ui", "OptFltrPage", 
&rSet)
     , m_xWBasicCodeCB(m_xBuilder->weld_check_button("wo_basic"))
+    , m_xWBasicCodeImg(m_xBuilder->weld_widget("lockwo_basic"))
     , m_xWBasicWbctblCB(m_xBuilder->weld_check_button("wo_exec"))
+    , m_xWBasicWbctblImg(m_xBuilder->weld_widget("lockwo_exec"))
     , m_xWBasicStgCB(m_xBuilder->weld_check_button("wo_saveorig"))
+    , m_xWBasicStgImg(m_xBuilder->weld_widget("lockwo_saveorig"))
     , m_xEBasicCodeCB(m_xBuilder->weld_check_button("ex_basic"))
+    , m_xEBasicCodeImg(m_xBuilder->weld_widget("lockex_basic"))
     , m_xEBasicExectblCB(m_xBuilder->weld_check_button("ex_exec"))
+    , m_xEBasicExectblImg(m_xBuilder->weld_widget("lockex_exec"))
     , m_xEBasicStgCB(m_xBuilder->weld_check_button("ex_saveorig"))
+    , m_xEBasicStgImg(m_xBuilder->weld_widget("lockex_saveorig"))
     , m_xPBasicCodeCB(m_xBuilder->weld_check_button("pp_basic"))
+    , m_xPBasicCodeImg(m_xBuilder->weld_widget("lockpp_basic"))
     , m_xPBasicStgCB(m_xBuilder->weld_check_button("pp_saveorig"))
+    , m_xPBasicStgImg(m_xBuilder->weld_widget("lockpp_saveorig"))
 {
     m_xWBasicCodeCB->connect_toggled( LINK( this, OfaMSFilterTabPage, 
LoadWordBasicCheckHdl_Impl ) );
     m_xEBasicCodeCB->connect_toggled( LINK( this, OfaMSFilterTabPage, 
LoadExcelBasicCheckHdl_Impl ) );
@@ -57,12 +68,14 @@ OfaMSFilterTabPage::~OfaMSFilterTabPage()
 
 IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadWordBasicCheckHdl_Impl, 
weld::Toggleable&, void)
 {
-    m_xWBasicWbctblCB->set_sensitive(m_xWBasicCodeCB->get_active());
+    m_xWBasicWbctblCB->set_sensitive(m_xWBasicCodeCB->get_active() && 
!officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
+    
m_xWBasicWbctblImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
 }
 
 IMPL_LINK_NOARG(OfaMSFilterTabPage, LoadExcelBasicCheckHdl_Impl, 
weld::Toggleable&, void)
 {
-    m_xEBasicExectblCB->set_sensitive(m_xEBasicCodeCB->get_active());
+    m_xEBasicExectblCB->set_sensitive(m_xEBasicCodeCB->get_active() && 
!officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
+    
m_xEBasicExectblImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
 }
 
 std::unique_ptr<SfxTabPage> OfaMSFilterTabPage::Create( weld::Container* 
pPage, weld::DialogController* pController,
@@ -125,24 +138,40 @@ void OfaMSFilterTabPage::Reset( const SfxItemSet* )
     const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
 
     m_xWBasicCodeCB->set_active( rOpt.IsLoadWordBasicCode() );
+    
m_xWBasicCodeCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Load::isReadOnly());
+    
m_xWBasicCodeImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Load::isReadOnly());
     m_xWBasicCodeCB->save_state();
     m_xWBasicWbctblCB->set_active( rOpt.IsLoadWordBasicExecutable() );
+    
m_xWBasicWbctblCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
+    
m_xWBasicWbctblImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Executable::isReadOnly());
     m_xWBasicWbctblCB->save_state();
     m_xWBasicStgCB->set_active( rOpt.IsLoadWordBasicStorage() );
+    
m_xWBasicStgCB->set_sensitive(!officecfg::Office::Writer::Filter::Import::VBA::Save::isReadOnly());
+    
m_xWBasicStgImg->set_visible(officecfg::Office::Writer::Filter::Import::VBA::Save::isReadOnly());
     m_xWBasicStgCB->save_state();
     LoadWordBasicCheckHdl_Impl( *m_xWBasicCodeCB );
 
     m_xEBasicCodeCB->set_active( rOpt.IsLoadExcelBasicCode() );
+    
m_xEBasicCodeCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Load::isReadOnly());
+    
m_xEBasicCodeImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Load::isReadOnly());
     m_xEBasicCodeCB->save_state();
     m_xEBasicExectblCB->set_active( rOpt.IsLoadExcelBasicExecutable() );
+    
m_xEBasicExectblCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
+    
m_xEBasicExectblImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Executable::isReadOnly());
     m_xEBasicExectblCB->save_state();
     m_xEBasicStgCB->set_active( rOpt.IsLoadExcelBasicStorage() );
+    
m_xEBasicStgCB->set_sensitive(!officecfg::Office::Calc::Filter::Import::VBA::Save::isReadOnly());
+    
m_xEBasicStgImg->set_visible(officecfg::Office::Calc::Filter::Import::VBA::Save::isReadOnly());
     m_xEBasicStgCB->save_state();
     LoadExcelBasicCheckHdl_Impl( *m_xEBasicCodeCB );
 
     m_xPBasicCodeCB->set_active( rOpt.IsLoadPPointBasicCode() );
+    
m_xPBasicCodeCB->set_sensitive(!officecfg::Office::Impress::Filter::Import::VBA::Load::isReadOnly());
+    
m_xPBasicCodeImg->set_visible(officecfg::Office::Impress::Filter::Import::VBA::Load::isReadOnly());
     m_xPBasicCodeCB->save_state();
     m_xPBasicStgCB->set_active( rOpt.IsLoadPPointBasicStorage() );
+    
m_xPBasicStgCB->set_sensitive(!officecfg::Office::Impress::Filter::Import::VBA::Save::isReadOnly());
+    
m_xPBasicStgImg->set_visible(officecfg::Office::Impress::Filter::Import::VBA::Save::isReadOnly());
     m_xPBasicStgCB->save_state();
 }
 
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
index fcde68941e62..dd4fcf18cd2e 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -23,13 +23,21 @@
 class OfaMSFilterTabPage : public SfxTabPage
 {
     std::unique_ptr<weld::CheckButton> m_xWBasicCodeCB;
+    std::unique_ptr<weld::Widget> m_xWBasicCodeImg;
     std::unique_ptr<weld::CheckButton> m_xWBasicWbctblCB;
+    std::unique_ptr<weld::Widget> m_xWBasicWbctblImg;
     std::unique_ptr<weld::CheckButton> m_xWBasicStgCB;
+    std::unique_ptr<weld::Widget> m_xWBasicStgImg;
     std::unique_ptr<weld::CheckButton> m_xEBasicCodeCB;
+    std::unique_ptr<weld::Widget> m_xEBasicCodeImg;
     std::unique_ptr<weld::CheckButton> m_xEBasicExectblCB;
+    std::unique_ptr<weld::Widget> m_xEBasicExectblImg;
     std::unique_ptr<weld::CheckButton> m_xEBasicStgCB;
+    std::unique_ptr<weld::Widget> m_xEBasicStgImg;
     std::unique_ptr<weld::CheckButton> m_xPBasicCodeCB;
+    std::unique_ptr<weld::Widget> m_xPBasicCodeImg;
     std::unique_ptr<weld::CheckButton> m_xPBasicStgCB;
+    std::unique_ptr<weld::Widget> m_xPBasicStgImg;
 
     DECL_LINK(LoadWordBasicCheckHdl_Impl, weld::Toggleable&, void);
     DECL_LINK(LoadExcelBasicCheckHdl_Impl, weld::Toggleable&, void);
diff --git a/cui/uiconfig/ui/optfltrpage.ui b/cui/uiconfig/ui/optfltrpage.ui
index 975456140597..0e17874bfaea 100644
--- a/cui/uiconfig/ui/optfltrpage.ui
+++ b/cui/uiconfig/ui/optfltrpage.ui
@@ -15,7 +15,7 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=1 n-rows=3 -->
+          <!-- n-columns=2 n-rows=3 -->
           <object class="GtkGrid" id="grid1">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -37,7 +37,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -57,7 +57,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">1</property>
               </packing>
             </child>
@@ -75,6 +75,45 @@
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockwo_basic">
+                <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="lockwo_exec">
+                <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="lockwo_saveorig">
+                <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>
@@ -106,7 +145,7 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=1 n-rows=3 -->
+          <!-- n-columns=2 n-rows=3 -->
           <object class="GtkGrid" id="grid2">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -128,7 +167,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -148,7 +187,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">1</property>
               </packing>
             </child>
@@ -166,6 +205,45 @@
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockex_basic">
+                <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="lockex_exec">
+                <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="lockex_saveorig">
+                <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>
@@ -197,7 +275,7 @@
         <property name="label-xalign">0</property>
         <property name="shadow-type">none</property>
         <child>
-          <!-- n-columns=1 n-rows=2 -->
+          <!-- n-columns=2 n-rows=2 -->
           <object class="GtkGrid" id="grid3">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
@@ -219,7 +297,7 @@
                 </child>
               </object>
               <packing>
-                <property name="left-attach">0</property>
+                <property name="left-attach">1</property>
                 <property name="top-attach">0</property>
               </packing>
             </child>
@@ -237,6 +315,32 @@
                   </object>
                 </child>
               </object>
+              <packing>
+                <property name="left-attach">1</property>
+                <property name="top-attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkImage" id="lockpp_basic">
+                <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="lockpp_saveorig">
+                <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>

Reply via email to