summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx24
-rw-r--r--dbaccess/source/core/inc/ModelImpl.hxx3
-rw-r--r--include/sfx2/docmacromode.hxx10
-rw-r--r--sfx2/source/doc/docmacromode.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx26
-rw-r--r--sfx2/source/inc/objshimp.hxx3
6 files changed, 34 insertions, 34 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;
diff --git a/include/sfx2/docmacromode.hxx b/include/sfx2/docmacromode.hxx
index 2a0421aa0c90..f7213b709b87 100644
--- a/include/sfx2/docmacromode.hxx
+++ b/include/sfx2/docmacromode.hxx
@@ -152,10 +152,18 @@ namespace sfx2
When this happens, this method here should be replaced by a method at this
new class.
+ @param _rxInteraction
+ A handler for interactions which might become necessary to trust a correct
+ but not yet trusted signature, possibly also adding the author certificate to
+ trusted list.
+
+ If the user needs to be asked, and if this parameter is <NULL/>, the most
+ defensive assumptions will be made, i.e. false will be returned.
+
@seealso <sfx2/signaturestate.hxx>
*/
virtual bool
- hasTrustedScriptingSignature( bool bAllowUIToAddAuthor ) = 0;
+ hasTrustedScriptingSignature( const css::uno::Reference< css::task::XInteractionHandler >& _rxInteraction ) = 0;
protected:
~IMacroDocumentAccess() {}
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 637f137866ba..b1488b5dbe48 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -200,7 +200,7 @@ namespace sfx2
const bool bAllowUI = nMacroExecutionMode != MacroExecMode::FROM_LIST_AND_SIGNED_NO_WARN
&& (nMacroExecutionMode == MacroExecMode::ALWAYS_EXECUTE
|| !SvtSecurityOptions::IsReadOnly(SvtSecurityOptions::EOption::MacroTrustedAuthors));
- const bool bHasTrustedMacroSignature = m_xData->m_rDocumentAccess.hasTrustedScriptingSignature(bAllowUI);
+ const bool bHasTrustedMacroSignature = m_xData->m_rDocumentAccess.hasTrustedScriptingSignature(bAllowUI ? rxInteraction : nullptr);
SignatureState nSignatureState = m_xData->m_rDocumentAccess.getScriptingSignatureState();
if ( nSignatureState == SignatureState::BROKEN )
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index a8f39d06f492..c6bd3b62ddd6 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1847,7 +1847,8 @@ SignatureState SfxObjectShell_Impl::getScriptingSignatureState()
return nSignatureState;
}
-bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor )
+bool SfxObjectShell_Impl::hasTrustedScriptingSignature(
+ const css::uno::Reference<css::task::XInteractionHandler>& _rxInteraction)
{
bool bResult = false;
@@ -1883,22 +1884,15 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
[&xSigner](const security::DocumentSignatureInformation& rInfo) {
return xSigner->isAuthorTrusted( rInfo.Signer ); });
- if ( !bResult && bAllowUIToAddAuthor )
+ if (!bResult && _rxInteraction)
{
- uno::Reference< task::XInteractionHandler > xInteraction;
- if ( rDocShell.GetMedium() )
- xInteraction = rDocShell.GetMedium()->GetInteractionHandler();
-
- if ( xInteraction.is() )
- {
- task::DocumentMacroConfirmationRequest aRequest;
- aRequest.DocumentURL = getDocumentLocation();
- aRequest.DocumentStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl();
- aRequest.DocumentSignatureInformation = aInfo;
- aRequest.DocumentVersion = aVersion;
- aRequest.Classification = task::InteractionClassification_QUERY;
- bResult = SfxMedium::CallApproveHandler( xInteraction, uno::Any( aRequest ), true );
- }
+ task::DocumentMacroConfirmationRequest aRequest;
+ aRequest.DocumentURL = getDocumentLocation();
+ aRequest.DocumentStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl();
+ aRequest.DocumentSignatureInformation = aInfo;
+ aRequest.DocumentVersion = aVersion;
+ aRequest.Classification = task::InteractionClassification_QUERY;
+ bResult = SfxMedium::CallApproveHandler( _rxInteraction, uno::Any( aRequest ), true );
}
}
}
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index 7f9624436a15..e7cf6e6ee062 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -149,7 +149,8 @@ struct SfxObjectShell_Impl final : public ::sfx2::IMacroDocumentAccess
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;
};
#endif