Kaydet (Commit) 7f671122 authored tarafından Miklos Vajna's avatar Miklos Vajna

xmlsecurity: show PDF signature right after adding it

Also:

- handle PDF in DocumentSignatureManager::write(), so the PDF file is
  not truncated when closing the document signatures dialog, and
- handle PDF in DigitalSignaturesDialog::canAddRemove()

Change-Id: I77c1fcdcbdcb079ce934f37546129d9d280e5d2e
üst c48cd497
......@@ -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 )
{
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment