diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2019-12-02 15:54:13 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-12-04 13:42:24 +0100 |
commit | de18598b9bc35bd2f2b6fa8410282e4bb526e88e (patch) | |
tree | 98831aaa1c108c5dd0f88501a2cc3407b20afdcd | |
parent | tdf#129043 Correctly deliver combo box events when used with keyboard (diff) | |
download | core-de18598b9bc35bd2f2b6fa8410282e4bb526e88e.tar.gz core-de18598b9bc35bd2f2b6fa8410282e4bb526e88e.zip |
Disable macro menu entries when DisableMacrosExecution is set
Change-Id: Ica9a4f4a6510717dcd9fe53676e5a6f261f005ce
Reviewed-on: https://gerrit.libreoffice.org/84231
Reviewed-by: Serge Krot (CIB) <Serge.Krot@cib.de>
Tested-by: Serge Krot (CIB) <Serge.Krot@cib.de>
Conflicts:
framework/source/uielement/macrosmenucontroller.cxx
sfx2/source/appl/appserv.cxx
-rw-r--r-- | framework/source/uielement/macrosmenucontroller.cxx | 5 | ||||
-rw-r--r-- | sfx2/sdi/appslots.sdi | 4 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 9 | ||||
-rwxr-xr-x | sfx2/source/view/viewfrm.cxx | 3 |
4 files changed, 20 insertions, 1 deletions
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 4f2b2625ba00..e0e7c1fefa6e 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <officecfg/Office/Common.hxx> #include <vcl/svapp.hxx> #include <vcl/i18nhelp.hxx> #include <vcl/commandinfoprovider.hxx> @@ -64,6 +65,10 @@ MacrosMenuController::~MacrosMenuController() // private function void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & rPopupMenu ) { + bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); + if (bMacrosDisabled) + return; + VCLXPopupMenu* pVCLPopupMenu = static_cast<VCLXPopupMenu *>(VCLXMenu::GetImplementation( rPopupMenu )); PopupMenu* pPopupMenu = nullptr; diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index c1444d478a68..ab45ab309073 100644 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -232,18 +232,22 @@ shell SfxApplication SID_BASICIDE_APPEAR // status(final|play) [ ExecMethod = OfaExec_Impl; + StateMethod = OfaState_Impl; ] SID_SCRIPTORGANIZER // status(final|play) [ ExecMethod = OfaExec_Impl; + StateMethod = OfaState_Impl; ] SID_MACROORGANIZER // status(final|play) [ ExecMethod = OfaExec_Impl; + StateMethod = OfaState_Impl; ] SID_RUNMACRO // status(final|play) [ ExecMethod = OfaExec_Impl; + StateMethod = OfaState_Impl; ] SID_BASICCHOOSER // status(final|play) [ diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 1535f0c4a2da..385967f521ff 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -1714,6 +1714,15 @@ void SfxApplication::OfaState_Impl(SfxItemSet &rSet) rSet.DisableItem( FN_XFORMS_INIT ); } + bool bMacrosDisabled + = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); + if (bMacrosDisabled) + { + rSet.DisableItem(SID_RUNMACRO); + rSet.DisableItem(SID_MACROORGANIZER); + rSet.DisableItem(SID_SCRIPTORGANIZER); + rSet.DisableItem(SID_BASICIDE_APPEAR); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 1ff5b5b04adf..fcb26866ca3a 100755 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2930,7 +2930,8 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) { SvtMiscOptions aMiscOptions; const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()}; - if ( !aMiscOptions.IsMacroRecorderMode() || + bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get(); + if (bMacrosDisabled || !aMiscOptions.IsMacroRecorderMode() || ( sName!="swriter" && sName!="scalc" ) ) { rSet.DisableItem( nWhich ); |