diff options
-rw-r--r-- | xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 12 | ||||
-rw-r--r-- | xmlsecurity/source/helper/documentsignaturemanager.cxx | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index c82cff01f3a1..61789f68686f 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -244,8 +244,12 @@ void DigitalSignaturesDialog::SetSignatureStream( const css::uno::Reference < cs bool DigitalSignaturesDialog::canAddRemove() { - //m56 bool ret = true; + + if (!maSignatureManager.mxStore.is()) + // It's always possible to append a PDF signature. + return ret; + OSL_ASSERT(maSignatureManager.mxStore.is()); bool bDoc1_1 = DocumentSignatureHelper::isODFPre_1_2(m_sODFVersion); SaveODFItem item; @@ -357,7 +361,11 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, Button*, void) return; mbSignaturesChanged = true; - sal_Int32 nStatus = maSignatureManager.maSignatureHelper.GetSignatureInformation( nSecurityId ).nStatus; + sal_Int32 nStatus = xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED; + + if (maSignatureManager.mxStore.is()) + // In the PDF case the signature information is only available after parsing. + nStatus = maSignatureManager.maSignatureHelper.GetSignatureInformation( nSecurityId ).nStatus; if ( nStatus == css::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED ) { diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx index 05fbf3d0f5a7..1db23198dcfc 100644 --- a/xmlsecurity/source/helper/documentsignaturemanager.cxx +++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx @@ -385,6 +385,12 @@ void DocumentSignatureManager::read(bool bUseTempStream, bool bCacheLastSignatur void DocumentSignatureManager::write() { + if (!mxStore.is()) + { + // Something not ZIP based, assume PDF, which is written directly in add() already. + return; + } + // Export all other signatures... SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(embed::ElementModes::WRITE|embed::ElementModes::TRUNCATE, false); |