summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/helper/documentsignaturehelper.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-04 12:34:39 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-04 16:01:34 +0100
commitc30bf0284c643b6c574fcc5dabb840bb51174b30 (patch)
treeee444e95a6e55483334d6db68bb0ce7ac7353702 /xmlsecurity/source/helper/documentsignaturehelper.cxx
parent4351ff1f12268a0b97413e811503ac65a51665eb (diff)
xmlsecurity OOXML export: handle keeping all signatures but one
The removal of the _xmlsignatures sub-storage in DocumentSignatureHelper::OpenSignatureStream() serves 3 purposes: 1) Remove no longer needed signature streams 2) Truncate signatures relation stream 3) Truncate still needed signature streams 2) and 3) could be done using io::XTruncate as well, but if the whole storage is removed to handle 1), then individual truncate() calls are not necessary. Change-Id: Id9ed9c87c94f340dc947124b28f085561798d361
Diffstat (limited to 'xmlsecurity/source/helper/documentsignaturehelper.cxx')
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 9c14715ac8cd..b0097368d560 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -390,6 +390,10 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream(
{
try
{
+ if (xNameAccess->hasByName("_xmlsignatures") && (nOpenMode & embed::ElementModes::TRUNCATE))
+ // Truncate, then all signatures will be written -> remove previous ones.
+ rxStore->removeElement("_xmlsignatures");
+
aHelper.xSignatureStorage = rxStore->openStorageElement("_xmlsignatures", nSubStorageOpenMode);
aHelper.nStorageFormat = embed::StorageFormats::OFOPXML;
}