diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-11-07 16:05:07 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-11-07 17:41:49 +0100 |
commit | 89780c208837973e21ddbf098d77f4369018ee9e (patch) | |
tree | 62fb9fa37ddce6bb2a500969d004afce567a99de /dbaccess | |
parent | 505f97b5b23954d689d55640977da6ec1af523b9 (diff) |
Pass XInteractionHandler to hasTrustedScriptingSignature instead of a bool
This allows to use the same interaction handler there, as used in
DocumentMacroMode::adjustMacroMode. hasTrustedScriptingSignature
used to find its own interaction handler; and that would conflict
with e.g. ODatabaseModelImpl::adjustMacroMode_AutoReject, which
passes nullptr to adjustMacroMode, with intention to not show any
UI; but with signed macros (see tdf#97694), the UI would still
appear.
Change-Id: Ia209f96bef67dccfe1da23c4d172ac47497f8eb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159070
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/ModelImpl.cxx | 24 | ||||
-rw-r--r-- | dbaccess/source/core/inc/ModelImpl.hxx | 3 |
2 files changed, 12 insertions, 15 deletions
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 66f8309ac657..98023c53c38b 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -1357,7 +1357,8 @@ SignatureState ODatabaseModelImpl::getScriptingSignatureState() return m_nScriptingSignatureState; } -bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor) +bool ODatabaseModelImpl::hasTrustedScriptingSignature( + const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction) { bool bResult = false; @@ -1389,20 +1390,15 @@ bool ODatabaseModelImpl::hasTrustedScriptingSignature(bool bAllowUIToAddAuthor) }); } - if (!bResult && bAllowUIToAddAuthor) + if (!bResult && _rxInteraction) { - Reference<XInteractionHandler> xInteraction; - xInteraction = m_aMediaDescriptor.getOrDefault("InteractionHandler", xInteraction); - if (xInteraction.is()) - { - task::DocumentMacroConfirmationRequest aRequest; - aRequest.DocumentURL = m_sDocFileLocation; - aRequest.DocumentStorage = xStorage; - aRequest.DocumentSignatureInformation = aInfo; - aRequest.DocumentVersion = aODFVersion; - aRequest.Classification = task::InteractionClassification_QUERY; - bResult = SfxMedium::CallApproveHandler(xInteraction, uno::Any(aRequest), true); - } + task::DocumentMacroConfirmationRequest aRequest; + aRequest.DocumentURL = m_sDocFileLocation; + aRequest.DocumentStorage = xStorage; + aRequest.DocumentSignatureInformation = aInfo; + aRequest.DocumentVersion = aODFVersion; + aRequest.Classification = task::InteractionClassification_QUERY; + bResult = SfxMedium::CallApproveHandler(_rxInteraction, uno::Any(aRequest), true); } } catch (uno::Exception&) diff --git a/dbaccess/source/core/inc/ModelImpl.hxx b/dbaccess/source/core/inc/ModelImpl.hxx index a582ece2575f..2fc19830ca42 100644 --- a/dbaccess/source/core/inc/ModelImpl.hxx +++ b/dbaccess/source/core/inc/ModelImpl.hxx @@ -479,7 +479,8 @@ public: virtual bool macroCallsSeenWhileLoading() const override; virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override; virtual SignatureState getScriptingSignatureState() override; - virtual bool hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) override; + virtual bool hasTrustedScriptingSignature( + const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction) override; // IModifiableDocument virtual void storageIsModified() override; |