[Libreoffice-commits] core.git: Branch 'feature/cib_contract3756' - framework/source sfx2/sdi sfx2/source
Samuel Mehrbrodt (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 3 08:50:05 UTC 2019
framework/source/uielement/macrosmenucontroller.cxx | 5 +++++
sfx2/sdi/appslots.sdi | 4 ++++
sfx2/source/appl/appserv.cxx | 10 ++++++++++
sfx2/source/view/viewfrm.cxx | 3 ++-
4 files changed, 21 insertions(+), 1 deletion(-)
New commits:
commit 7b6bbb359a7eb9ee0a2f556f3b85e26dc38426b3
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Dec 2 15:54:13 2019 +0100
Commit: Serge Krot (CIB) <Serge.Krot at cib.de>
CommitDate: Tue Dec 3 09:49:11 2019 +0100
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 at cib.de>
Tested-by: Serge Krot (CIB) <Serge.Krot at cib.de>
(cherry picked from commit e58eda7df5b384c0f054fcbd4a8dc4a47bed2080)
Reviewed-on: https://gerrit.libreoffice.org/84300
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index c1335518f31f..95d7e3958938 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 *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( rPopupMenu ));
PopupMenu* pPopupMenu = nullptr;
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 100755
--- 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 );
More information about the Libreoffice-commits
mailing list