From 9157d8de8d8a7a2707179f371f4e4771f41777be Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Mon, 18 Dec 2023 16:37:16 +0300 Subject: tdf#158375: disable DDE when DisableActiveContent is set Change-Id: I167f6ea5d740b5a53cd02a9b865e65ff980a8877 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160922 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- sfx2/source/appl/linkmgr2.cxx | 10 ++++++++++ sfx2/source/appl/lnkbase2.cxx | 4 ++++ 2 files changed, 14 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index f529fb11d468..a20501a1bad6 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -281,6 +282,11 @@ void LinkManager::UpdateAllLinks( bool bUpdateGrfLinks, weld::Window* pParentWin ) { + // when active content is disabled don't bother updating all links + // also (when bAskUpdate == true) don't show the pop up. + if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get()) + return; + // First make a copy of the array in order to update links // links in ... no contact between them! std::vector aTmpArr; @@ -354,8 +360,12 @@ SvLinkSourceRef LinkManager::CreateObj( SvBaseLink const * pLink ) case SvBaseLinkObjectType::ClientOle: return new SvFileObject; case SvBaseLinkObjectType::Internal: + if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get()) + return SvLinkSourceRef(); return new SvxInternalLink; case SvBaseLinkObjectType::ClientDde: + if (officecfg::Office::Common::Security::Scripting::DisableActiveContent::get()) + return SvLinkSourceRef(); return new SvDDEObject; default: return SvLinkSourceRef(); diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index 7fd3b3d530d5..eea1751cd57e 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -33,6 +33,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -301,6 +302,9 @@ void SvBaseLink::clearStreamToLoadFrom() bool SvBaseLink::Update() { + if(officecfg::Office::Common::Security::Scripting::DisableActiveContent::get()) + return false; + if( isClientType(mnObjType) ) { AddNextRef(); -- cgit