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/+/178275 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
@@ -58,6 +58,7 @@
|
|||||||
#include <svl/whiter.hxx>
|
#include <svl/whiter.hxx>
|
||||||
#include <svx/svxids.hrc>
|
#include <svx/svxids.hrc>
|
||||||
#include <tools/debug.hxx>
|
#include <tools/debug.hxx>
|
||||||
|
#include <unotools/securityoptions.hxx>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vcl/locktoplevels.hxx>
|
#include <vcl/locktoplevels.hxx>
|
||||||
#include <vcl/errinf.hxx>
|
#include <vcl/errinf.hxx>
|
||||||
@@ -318,7 +319,7 @@ void ModulWindow::BasicExecute()
|
|||||||
{
|
{
|
||||||
// #116444# check security settings before macro execution
|
// #116444# check security settings before macro execution
|
||||||
ScriptDocument aDocument( GetDocument() );
|
ScriptDocument aDocument( GetDocument() );
|
||||||
bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
|
bool bMacrosDisabled = SvtSecurityOptions::IsMacroDisabled();
|
||||||
if (bMacrosDisabled || (aDocument.isDocument() && !aDocument.allowMacros()))
|
if (bMacrosDisabled || (aDocument.isDocument() && !aDocument.allowMacros()))
|
||||||
{
|
{
|
||||||
std::unique_ptr<weld::MessageDialog> xBox(
|
std::unique_ptr<weld::MessageDialog> xBox(
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <toolkit/awt/vclxmenu.hxx>
|
#include <toolkit/awt/vclxmenu.hxx>
|
||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
|
#include <unotools/securityoptions.hxx>
|
||||||
|
|
||||||
using namespace com::sun::star::uno;
|
using namespace com::sun::star::uno;
|
||||||
using namespace com::sun::star::lang;
|
using namespace com::sun::star::lang;
|
||||||
@@ -67,8 +68,7 @@ MacrosMenuController::~MacrosMenuController()
|
|||||||
// private function
|
// private function
|
||||||
void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & rPopupMenu )
|
void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & rPopupMenu )
|
||||||
{
|
{
|
||||||
bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
|
if (SvtSecurityOptions::IsMacroDisabled())
|
||||||
if (bMacrosDisabled)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SolarMutexGuard aSolarMutexGuard;
|
SolarMutexGuard aSolarMutexGuard;
|
||||||
|
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_libraries,protocolhandler,\
|
|||||||
sal \
|
sal \
|
||||||
sfx \
|
sfx \
|
||||||
tl \
|
tl \
|
||||||
|
utl \
|
||||||
vcl \
|
vcl \
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <framework/documentundoguard.hxx>
|
#include <framework/documentundoguard.hxx>
|
||||||
#include <officecfg/Office/Common.hxx>
|
#include <officecfg/Office/Common.hxx>
|
||||||
|
#include <unotools/securityoptions.hxx>
|
||||||
|
|
||||||
#include <com/sun/star/uri/XUriReference.hpp>
|
#include <com/sun/star/uri/XUriReference.hpp>
|
||||||
#include <com/sun/star/uri/XVndSunStarScriptUrlReference.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 URL& aURL, const Sequence < PropertyValue >& lArgs,
|
||||||
const Reference< XDispatchResultListener >& xListener )
|
const Reference< XDispatchResultListener >& xListener )
|
||||||
{
|
{
|
||||||
if (officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get())
|
if (SvtSecurityOptions::IsMacroDisabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sal_Int16 aState = css::frame::DispatchResultState::FAILURE;
|
sal_Int16 aState = css::frame::DispatchResultState::FAILURE;
|
||||||
|
@@ -72,6 +72,7 @@
|
|||||||
#include <vcl/toolbox.hxx>
|
#include <vcl/toolbox.hxx>
|
||||||
|
|
||||||
#include <unotools/moduleoptions.hxx>
|
#include <unotools/moduleoptions.hxx>
|
||||||
|
#include <unotools/securityoptions.hxx>
|
||||||
#include <rtl/bootstrap.hxx>
|
#include <rtl/bootstrap.hxx>
|
||||||
|
|
||||||
#include <com/sun/star/frame/ModuleManager.hpp>
|
#include <com/sun/star/frame/ModuleManager.hpp>
|
||||||
@@ -2057,9 +2058,7 @@ void SfxApplication::OfaState_Impl(SfxItemSet &rSet)
|
|||||||
if ( comphelper::LibreOfficeKit::isActive() )
|
if ( comphelper::LibreOfficeKit::isActive() )
|
||||||
rSet.DisableItem( SID_AUTO_CORRECT_DLG );
|
rSet.DisableItem( SID_AUTO_CORRECT_DLG );
|
||||||
|
|
||||||
bool bMacrosDisabled
|
if (SvtSecurityOptions::IsMacroDisabled())
|
||||||
= officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
|
|
||||||
if (bMacrosDisabled)
|
|
||||||
{
|
{
|
||||||
rSet.DisableItem(SID_RUNMACRO);
|
rSet.DisableItem(SID_RUNMACRO);
|
||||||
rSet.DisableItem(SID_MACROORGANIZER);
|
rSet.DisableItem(SID_MACROORGANIZER);
|
||||||
|
@@ -3401,8 +3401,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet)
|
|||||||
case SID_RECORDMACRO :
|
case SID_RECORDMACRO :
|
||||||
{
|
{
|
||||||
const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()};
|
const OUString& sName{GetObjectShell()->GetFactory().GetFactoryName()};
|
||||||
bool bMacrosDisabled = officecfg::Office::Common::Security::Scripting::DisableMacrosExecution::get();
|
if (SvtSecurityOptions::IsMacroDisabled() ||
|
||||||
if (bMacrosDisabled ||
|
|
||||||
!officecfg::Office::Common::Misc::MacroRecorderMode::get() ||
|
!officecfg::Office::Common::Misc::MacroRecorderMode::get() ||
|
||||||
( sName!="swriter" && sName!="scalc" ) )
|
( sName!="swriter" && sName!="scalc" ) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user