basctl/source/basicide/baside2.cxx | 3 ++- framework/source/uielement/macrosmenucontroller.cxx | 4 ++-- scripting/Library_protocolhandler.mk | 1 + scripting/source/protocolhandler/scripthandler.cxx | 3 ++- sfx2/source/appl/appserv.cxx | 5 ++--- sfx2/source/view/viewfrm.cxx | 3 +-- 6 files changed, 10 insertions(+), 9 deletions(-)
New commits: commit a7d567d25e3f13ce78b494a6f49bb0b24cbc0fb3 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Dec 11 11:42:46 2024 +0500 Commit: Miklos Vajna <[email protected]> CommitDate: Wed Dec 11 09:56:14 2024 +0100 Use SvtSecurityOptions::IsMacroDisabled() instead of officecfg check The change is most important for Viewer app mode, which also disables macros Change-Id: Ie305649dafbb3717e7986a4b437c38b09ffc1802 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178276 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index b01e5c238a6c..5571faf33029 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -56,6 +56,7 @@ #include <svl/whiter.hxx> #include <svx/svxids.hrc> #include <tools/debug.hxx> +#include <unotools/securityoptions.hxx> #include <utility> #include <vcl/locktoplevels.hxx> #include <vcl/errinf.hxx> @@ -312,7 +313,7 @@ void ModulWindow::BasicExecute() { // #116444# check security settings before macro execution ScriptDocument aDocument( GetDocument() ); - bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); + bool bMacrosDisabled = SvtSecurityOptions::IsMacroDisabled(); if (bMacrosDisabled || (aDocument.isDocument() && !aDocument.allowMacros())) { std::unique_ptr<weld::MessageDialog> xBox( diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 0cc8fba505c7..b38acf3038a8 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -28,6 +28,7 @@ #include <osl/mutex.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/supportsservice.hxx> +#include <unotools/securityoptions.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -70,8 +71,7 @@ MacrosMenuController::~MacrosMenuController() // private function void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & rPopupMenu ) { - bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); - if (bMacrosDisabled) + if (SvtSecurityOptions::IsMacroDisabled()) return; SolarMutexGuard aSolarMutexGuard; diff --git a/scripting/Library_protocolhandler.mk b/scripting/Library_protocolhandler.mk index 31599c3d865b..d0fb4169625a 100644 --- a/scripting/Library_protocolhandler.mk +++ b/scripting/Library_protocolhandler.mk @@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_libraries,protocolhandler,\ sal \ sfx \ tl \ + utl \ vcl \ )) diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 54ca264b32f6..294228d717f8 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -43,6 +43,7 @@ #include <cppuhelper/supportsservice.hxx> #include <framework/documentundoguard.hxx> #include <officecfg/Office/Common.hxx> +#include <unotools/securityoptions.hxx> #include <com/sun/star/uri/XUriReference.hpp> #include <com/sun/star/uri/XVndSunStarScriptUrlReference.hpp> @@ -117,7 +118,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( const URL& aURL, const Sequence < PropertyValue >& lArgs, const Reference< XDispatchResultListener >& xListener ) { - if (officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get()) + if (SvtSecurityOptions::IsMacroDisabled()) return; bool bSuccess = false; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index f53570f78a8c..cae76cbeeb48 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -69,6 +69,7 @@ #include <vcl/toolbox.hxx> #include <unotools/moduleoptions.hxx> +#include <unotools/securityoptions.hxx> #include <rtl/bootstrap.hxx> #include <com/sun/star/frame/ModuleManager.hpp> @@ -1897,9 +1898,7 @@ void SfxApplication::OfaState_Impl(SfxItemSet &rSet) if ( comphelper::LibreOfficeKit::isActive() ) rSet.DisableItem( SID_AUTO_CORRECT_DLG ); - bool bMacrosDisabled - = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); - if (bMacrosDisabled) + if (SvtSecurityOptions::IsMacroDisabled()) { rSet.DisableItem(SID_RUNMACRO); rSet.DisableItem(SID_MACROORGANIZER); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 05202e85f57b..d9f710923081 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3320,8 +3320,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_RECORDMACRO : { const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()}; - bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); - if (bMacrosDisabled || + if (SvtSecurityOptions::IsMacroDisabled() || !officecfg::Office::Common::Misc::MacroRecorderMode::get() || ( sName!="swriter" && sName!="scalc" ) ) {
