summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-12-02 15:54:13 +0100
committerSerge Krot (CIB) <Serge.Krot@cib.de>2019-12-02 18:28:31 +0100
commite58eda7df5b384c0f054fcbd4a8dc4a47bed2080 (patch)
treed0953de4d96fefe708882cb5641c2f6d1f9029b1 /sfx2
parenta322e61b51a04e189618e1d0c8c17f9c080a3d1d (diff)
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>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/sdi/appslots.sdi4
-rw-r--r--sfx2/source/appl/appserv.cxx10
-rw-r--r--sfx2/source/view/viewfrm.cxx3
3 files changed, 16 insertions, 1 deletions
diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi
index 6bd28f73b37f..c12eb098b37e 100644
--- a/sfx2/sdi/appslots.sdi
+++ b/sfx2/sdi/appslots.sdi
@@ -231,18 +231,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 334c10a07ecd..c73d8d9d39c9 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1690,6 +1690,16 @@ 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)
+ {
+ 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 5e81262fda4f..8678b1ffeca7 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2982,7 +2982,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 );