summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-04 15:24:20 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-04 17:18:10 +0100
commitf065747552379bc3bf56fd479a04fd3de1ef72b7 (patch)
treef7fb0eaff401944cc0c92711c958bb00365f58ea
parente69c4f978228fb443cf0f6d2a6679cb5a4c82940 (diff)
xmlsecurity: support tmp storage instead of tmp stream for OOXML
First step towards having a working export, since OOXML uses one stream / signature, so we need a storage for all signatures, not just a stream. Change-Id: Id5edfd3ce7e8e4177b0071badc6eb4330a525281
-rw-r--r--xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx2
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx18
2 files changed, 18 insertions, 2 deletions
diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
index ff8b66e3ebe1..4a97049038d5 100644
--- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
@@ -57,6 +57,8 @@ private:
css::uno::Reference < css::embed::XStorage > mxStore;
css::uno::Reference < css::io::XStream > mxSignatureStream;
css::uno::Reference < css::io::XStream > mxTempSignatureStream;
+ /// Storage containing all OOXML signatures, unused for ODF.
+ css::uno::Reference<css::embed::XStorage> mxTempSignatureStorage;
SignatureInformations maCurrentSignatureInformations;
bool mbVerifySignatures;
bool mbSignaturesChanged;
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 212dbe766883..be0b412d45b2 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -57,6 +57,7 @@
#include <vcl/layout.hxx>
#include <unotools/configitem.hxx>
+#include <comphelper/storagehelper.hxx>
using namespace css::security;
using namespace css::uno;
@@ -796,13 +797,26 @@ SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream(
sal_Int32 nStreamOpenMode, bool bTempStream)
{
SignatureStreamHelper aHelper;
+ if (mxStore.is())
+ {
+ uno::Reference<container::XNameAccess> xNameAccess(mxStore, uno::UNO_QUERY);
+ if (xNameAccess.is() && xNameAccess->hasByName("[Content_Types].xml"))
+ aHelper.nStorageFormat = embed::StorageFormats::OFOPXML;
+ }
+
if (bTempStream)
{
if (nStreamOpenMode & css::embed::ElementModes::TRUNCATE)
{
//We write always into a new temporary stream.
mxTempSignatureStream.set(css::io::TempFile::create(mxCtx), UNO_QUERY_THROW);
- aHelper.xSignatureStream = mxTempSignatureStream;
+ if (aHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
+ aHelper.xSignatureStream = mxTempSignatureStream;
+ else
+ {
+ mxTempSignatureStorage = comphelper::OStorageHelper::GetStorageOfFormatFromStream(ZIP_STORAGE_FORMAT_STRING, mxTempSignatureStream);
+ aHelper.xSignatureStorage = mxTempSignatureStorage;
+ }
}
else
{
@@ -833,7 +847,7 @@ SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream(
if (nStreamOpenMode & css::embed::ElementModes::TRUNCATE)
{
- if (aHelper.xSignatureStream.is())
+ if (aHelper.xSignatureStream.is() && aHelper.nStorageFormat != embed::StorageFormats::OFOPXML)
{
css::uno::Reference < css::io::XTruncate > xTruncate(
aHelper.xSignatureStream, UNO_QUERY_THROW);