summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-04-28 16:53:57 +0200
committerJan Holesovsky <kendy@collabora.com>2021-01-07 16:32:53 +0100
commit7f3da921e023e6c6ffea197385d4dad936ac25dc (patch)
treed5fcf71254ed9e223ecf9d5f12ba153dba7449bf /xmloff
parentd67440cd04bcf2dd9472be77aa5388b6e6084e2c (diff)
replace hard-coded "1.2" ODF version strings
Most of these are calls to DocumentDigitalSignatures::createWithVersion(), where it doesn't make a difference if "1.2" or "1.3" is passed in but maybe it will be different with "1.4". There is another ctor createDefault() which looks appropriate for non-ODF contexts and can also be used when no actual signing or verifying is done. In cases where there's an actual document its Storage has the version. Change-Id: Id636bbf965d9f96c7ed5f50774c509032525b2b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93091 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/draw/SignatureLineContext.cxx9
-rw-r--r--xmloff/source/text/txtparai.cxx2
2 files changed, 6 insertions, 5 deletions
diff --git a/xmloff/source/draw/SignatureLineContext.cxx b/xmloff/source/draw/SignatureLineContext.cxx
index bbc99277cc47..10685ac4f8ff 100644
--- a/xmloff/source/draw/SignatureLineContext.cxx
+++ b/xmloff/source/draw/SignatureLineContext.cxx
@@ -71,10 +71,6 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrf
try
{
// Get the document signatures
- Reference<XDocumentDigitalSignatures> xSignatures(
- security::DocumentDigitalSignatures::createWithVersion(
- comphelper::getProcessComponentContext(), "1.2"));
-
css::uno::Reference<XStorable> xStorable(GetImport().GetModel(), UNO_QUERY_THROW);
Reference<XStorage> xStorage = comphelper::OStorageHelper::GetStorageOfFormatFromURL(
ZIP_STORAGE_FORMAT_STRING, xStorable->getLocation(), ElementModes::READ);
@@ -85,6 +81,11 @@ SignatureLineContext::SignatureLineContext(SvXMLImport& rImport, sal_uInt16 nPrf
return;
}
+ OUString const aODFVersion(comphelper::OStorageHelper::GetODFVersionFromStorage(xStorage));
+ Reference<XDocumentDigitalSignatures> xSignatures(
+ security::DocumentDigitalSignatures::createWithVersion(
+ comphelper::getProcessComponentContext(), aODFVersion));
+
Sequence<DocumentSignatureInformation> xSignatureInfo
= xSignatures->verifyDocumentContentSignatures(xStorage, Reference<XInputStream>());
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index e4f25cfa86cb..61f7a968fe9e 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2251,7 +2251,7 @@ XMLNumberedParaContext::XMLNumberedParaContext(
i_rImport.GetTextImport()->GetTextListHelper() );
if (m_ListId.isEmpty())
{
- SAL_WARN_IF( i_rImport.GetODFVersion() == "1.2", "xmloff.text", "invalid numbered-paragraph: no list-id (1.2)" );
+ SAL_WARN_IF(0 <= i_rImport.GetODFVersion().compareTo("1.2"), "xmloff.text", "invalid numbered-paragraph: no list-id (1.2)");
m_ListId = rTextListsHelper.GetNumberedParagraphListId(m_Level,
StyleName);
SAL_WARN_IF(m_ListId.isEmpty(), "xmloff.text", "numbered-paragraph: no ListId");