extensions/Library_oleautobridge.mk | 4 ++++ extensions/source/ole/servprov.cxx | 7 ++++++- officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit 8f4ff4c601c7480479c97b274e577cf074a9a2ef Author: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de> AuthorDate: Tue Dec 19 23:48:20 2023 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Jan 9 00:50:10 2024 +0100 tdf#158375: add expert option DisableOLEAutomation Add a disable option for OLE Automation interface that is used only on Windows. Change-Id: I86f212977bb604fbae6ac2603bee037b32b5036c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161035 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/extensions/Library_oleautobridge.mk b/extensions/Library_oleautobridge.mk index aa6c6d0cf2a6..38bd19eb8f06 100644 --- a/extensions/Library_oleautobridge.mk +++ b/extensions/Library_oleautobridge.mk @@ -11,6 +11,10 @@ $(eval $(call gb_Library_Library,oleautobridge)) +$(eval $(call gb_Library_use_custom_headers,oleautobridge,\ + officecfg/registry \ +)) + $(eval $(call gb_Library_set_componentfile,oleautobridge,extensions/source/ole/oleautobridge,services)) $(eval $(call gb_Library_use_api,oleautobridge,\ diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index f5a9323d361d..0c3920ccca11 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -33,6 +33,7 @@ #include <cppuhelper/supportsservice.hxx> #include <o3tl/any.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <officecfg/Office/Common.hxx> #include <ooo/vba/XHelperInterface.hpp> #include <sal/log.hxx> @@ -144,8 +145,12 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP OneInstanceOleWrapper::CreateInstance(IUnknown SAL_INFO("extensions.olebridge", "OneInstanceOleWrapper::CreateInstance(" << riid << ")"); - HRESULT ret = ResultFromScode(E_UNEXPECTED); + if (officecfg::Office::Common::Security::Scripting::DisableOLEAutomation::get()) + { + return ResultFromScode(E_NOINTERFACE); + } + HRESULT ret = ResultFromScode(E_UNEXPECTED); const Reference<XInterface>& xInst = m_xInstFunction(); if (xInst.is()) { diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index ecd6a05b927b..73de7af3a267 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -2524,6 +2524,13 @@ </info> <value>false</value> </prop> + <prop oor:name="DisableOLEAutomation" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Specifies whether or not to disable OLE Automation interface. + </desc> + </info> + <value>false</value> + </prop> <prop oor:name="CheckDocumentEvents" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Warn on load when a document binds an event to a macro</desc>