diff options
author | Sarper Akdemir <sarper.akdemir.extern@allotropia.de> | 2024-01-29 18:40:26 +0300 |
---|---|---|
committer | Sarper Akdemir <sarper.akdemir.extern@allotropia.de> | 2024-03-07 12:30:15 +0100 |
commit | cb685f603e15d73fc518b8d4e896f96f21bab4ea (patch) | |
tree | d66c54d29b288024451f5da5da1cfba8541d15bd /embeddedobj | |
parent | c5980ce30fada189f3ce51bea9d4e25f05c69634 (diff) |
tdf#158375: make it possible to hot disable embedded objects
Do not require a reload of the current document for the
embedded objects to be disabled.
Also make sure the existing active embedded objects are
disabled when DisableActiveContent is enabled via options
dialog.
Change-Id: I5a8f302af0cac64575c3e5ec6dbe71ec50a15442
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164367
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/commonembedding/embedobj.cxx | 4 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/specialobject.cxx | 5 | ||||
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 0b3843852e58..61e5d1f39ef4 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -40,6 +40,7 @@ #include <comphelper/multicontainer2.hxx> #include <comphelper/lok.hxx> #include <sal/log.hxx> +#include <officecfg/Office/Common.hxx> #include <vcl/svapp.hxx> @@ -475,6 +476,9 @@ uno::Sequence< sal_Int32 > const & OCommonEmbeddedObject::GetIntermediateStatesS void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState ) { + if ( officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() + && nNewState != embed::EmbedStates::LOADED ) + throw embed::UnreachableStateException(); ::osl::ResettableMutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO diff --git a/embeddedobj/source/commonembedding/specialobject.cxx b/embeddedobj/source/commonembedding/specialobject.cxx index 3dc1eb7e47ef..a2f282ed1aae 100644 --- a/embeddedobj/source/commonembedding/specialobject.cxx +++ b/embeddedobj/source/commonembedding/specialobject.cxx @@ -29,6 +29,7 @@ #include <cppuhelper/queryinterface.hxx> #include <osl/diagnose.h> #include <cppuhelper/supportsservice.hxx> +#include <officecfg/Office/Common.hxx> #include <specialobject.hxx> @@ -137,6 +138,10 @@ sal_Int32 SAL_CALL OSpecialEmbeddedObject::getMapUnit( sal_Int64 nAspect ) void SAL_CALL OSpecialEmbeddedObject::changeState( sal_Int32 nNewState ) { + if ( officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() + && nNewState != embed::EmbedStates::LOADED ) + throw embed::UnreachableStateException(); + if ( nNewState == embed::EmbedStates::UI_ACTIVE ) nNewState = embed::EmbedStates::INPLACE_ACTIVE; OCommonEmbeddedObject::changeState( nNewState ); diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index 8379a78693f1..69b3ca8d239e 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -52,7 +52,7 @@ #include <comphelper/propertyvalue.hxx> #include <sal/log.hxx> #include <comphelper/diagnose_ex.hxx> - +#include <officecfg/Office/Common.hxx> #include <targetstatecontrol.hxx> @@ -438,6 +438,9 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >& void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState ) { + if ( officecfg::Office::Common::Security::Scripting::DisableActiveContent::get() + && nNewState != embed::EmbedStates::LOADED ) + throw embed::UnreachableStateException(); // begin wrapping related part ==================== uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; if ( xWrappedObject.is() ) |