From 30877bdc01d3a9cda1878f66ca7a84760f5f8c67 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Wed, 1 Nov 2023 23:03:19 +0100 Subject: [PATCH] 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 --- 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(-) 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 #include #include +#include +#include +#include #include "optfltr.hxx" #include #include @@ -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 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 m_xWBasicCodeCB; + std::unique_ptr m_xWBasicCodeImg; std::unique_ptr m_xWBasicWbctblCB; + std::unique_ptr m_xWBasicWbctblImg; std::unique_ptr m_xWBasicStgCB; + std::unique_ptr m_xWBasicStgImg; std::unique_ptr m_xEBasicCodeCB; + std::unique_ptr m_xEBasicCodeImg; std::unique_ptr m_xEBasicExectblCB; + std::unique_ptr m_xEBasicExectblImg; std::unique_ptr m_xEBasicStgCB; + std::unique_ptr m_xEBasicStgImg; std::unique_ptr m_xPBasicCodeCB; + std::unique_ptr m_xPBasicCodeImg; std::unique_ptr m_xPBasicStgCB; + std::unique_ptr 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 @@ 0 none - + True False @@ -37,7 +37,7 @@ - 0 + 1 0 @@ -57,7 +57,7 @@ - 0 + 1 1 @@ -75,6 +75,45 @@ + + 1 + 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 @@ -106,7 +145,7 @@ 0 none - + True False @@ -128,7 +167,7 @@ - 0 + 1 0 @@ -148,7 +187,7 @@ - 0 + 1 1 @@ -166,6 +205,45 @@ + + 1 + 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 @@ -197,7 +275,7 @@ 0 none - + True False @@ -219,7 +297,7 @@ - 0 + 1 0 @@ -237,6 +315,32 @@ + + 1 + 1 + + + + + False + True + center + center + res/lock.png + + + 0 + 0 + + + + + False + True + center + center + res/lock.png + 0 1