summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-12-02 15:54:13 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-12-03 09:33:15 +0100
commite5c258b5422f9c98dcddc102b323c00f99a48a5f (patch)
tree89c4f9efa10e46d012abb30c5e4b343864a43198 /sfx2
parent926b39e6c7acbaace8e311dba0a2527ac8c20b09 (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> (cherry picked from commit e58eda7df5b384c0f054fcbd4a8dc4a47bed2080) Reviewed-on: https://gerrit.libreoffice.org/84293 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@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 80d66831f0bb..3264a1c9497a 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 );