[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - xmlsecurity/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 25 09:38:48 UTC 2021


 xmlsecurity/source/helper/ooxmlsecexporter.cxx |  198 +++++++++++++++----------
 1 file changed, 126 insertions(+), 72 deletions(-)

New commits:
commit 1e18994a0028ef17498abe72755f3cbf08397f8b
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue May 19 15:33:44 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Thu Mar 25 10:38:15 2021 +0100

    oox, svx, sw, xmlsecurity: clang-format these files
    
    I added these files more or less recently and they have long lines. Use
    clang-format to break at a sane column limit.
    
    Change-Id: Id4ef832e4843fc81f4a497385e49ccb835a7197f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94503
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 868acbd97b58b200731ca25ece4019de734e5726)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113057
    Tested-by: Michael Stahl <michael.stahl at allotropia.de>
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index cf87d6e1ad17..e38aba90ee66 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -85,25 +85,19 @@ public:
 
 bool OOXMLSecExporter::Impl::isOOXMLBlacklist(const OUString& rStreamName)
 {
-    static const std::initializer_list<OUStringLiteral> vBlacklist =
-    {
-        "/%5BContent_Types%5D.xml",
-        "/docProps/app.xml",
-        "/docProps/core.xml",
-        // Don't attempt to sign other signatures for now.
-        "/_xmlsignatures"
-    };
+    static const std::initializer_list<OUStringLiteral> vBlacklist
+        = { "/%5BContent_Types%5D.xml", "/docProps/app.xml", "/docProps/core.xml",
+            // Don't attempt to sign other signatures for now.
+            "/_xmlsignatures" };
     // Just check the prefix, as we don't care about the content type part of the stream name.
-    return std::any_of(vBlacklist.begin(), vBlacklist.end(), [&](const OUStringLiteral& rLiteral)
-    {
+    return std::any_of(vBlacklist.begin(), vBlacklist.end(), [&](const OUStringLiteral& rLiteral) {
         return rStreamName.startsWith(rLiteral);
     });
 }
 
 bool OOXMLSecExporter::Impl::isOOXMLRelationBlacklist(const OUString& rRelationName)
 {
-    static const std::initializer_list<OUStringLiteral> vBlacklist =
-    {
+    static const std::initializer_list<OUStringLiteral> vBlacklist = {
         "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",
         "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
         "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin"
@@ -113,7 +107,8 @@ bool OOXMLSecExporter::Impl::isOOXMLRelationBlacklist(const OUString& rRelationN
 
 void OOXMLSecExporter::Impl::writeSignedInfo()
 {
-    m_xDocumentHandler->startElement("SignedInfo", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignedInfo", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
 
     writeCanonicalizationMethod();
     writeSignatureMethod();
@@ -126,18 +121,18 @@ void OOXMLSecExporter::Impl::writeCanonicalizationMethod()
 {
     rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
     pAttributeList->AddAttribute("Algorithm", ALGO_C14N);
-    m_xDocumentHandler->startElement("CanonicalizationMethod", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_xDocumentHandler->startElement(
+        "CanonicalizationMethod", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     m_xDocumentHandler->endElement("CanonicalizationMethod");
-
 }
 
 void OOXMLSecExporter::Impl::writeCanonicalizationTransform()
 {
     rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
     pAttributeList->AddAttribute("Algorithm", ALGO_C14N);
-    m_xDocumentHandler->startElement("Transform", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_xDocumentHandler->startElement(
+        "Transform", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     m_xDocumentHandler->endElement("Transform");
-
 }
 
 void OOXMLSecExporter::Impl::writeSignatureMethod()
@@ -149,7 +144,8 @@ void OOXMLSecExporter::Impl::writeSignatureMethod()
     else
         pAttributeList->AddAttribute("Algorithm", ALGO_RSASHA256);
 
-    m_xDocumentHandler->startElement("SignatureMethod", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_xDocumentHandler->startElement(
+        "SignatureMethod", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     m_xDocumentHandler->endElement("SignatureMethod");
 }
 
@@ -163,21 +159,27 @@ void OOXMLSecExporter::Impl::writeSignedInfoReferences()
             {
                 rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
                 if (rReference.ouURI != "idSignedProperties")
-                    pAttributeList->AddAttribute("Type", "http://www.w3.org/2000/09/xmldsig#Object");
+                    pAttributeList->AddAttribute("Type",
+                                                 "http://www.w3.org/2000/09/xmldsig#Object");
                 else
-                    pAttributeList->AddAttribute("Type", "http://uri.etsi.org/01903#SignedProperties");
+                    pAttributeList->AddAttribute("Type",
+                                                 "http://uri.etsi.org/01903#SignedProperties");
                 pAttributeList->AddAttribute("URI", "#" + rReference.ouURI);
-                m_xDocumentHandler->startElement("Reference", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+                m_xDocumentHandler->startElement(
+                    "Reference", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
             }
             if (rReference.ouURI == "idSignedProperties")
             {
-                m_xDocumentHandler->startElement("Transforms", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+                m_xDocumentHandler->startElement(
+                    "Transforms",
+                    uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
                 writeCanonicalizationTransform();
                 m_xDocumentHandler->endElement("Transforms");
             }
 
             DocumentSignatureHelper::writeDigestMethod(m_xDocumentHandler);
-            m_xDocumentHandler->startElement("DigestValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+            m_xDocumentHandler->startElement(
+                "DigestValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
             m_xDocumentHandler->characters(rReference.ouDigestValue);
             m_xDocumentHandler->endElement("DigestValue");
             m_xDocumentHandler->endElement("Reference");
@@ -187,16 +189,20 @@ void OOXMLSecExporter::Impl::writeSignedInfoReferences()
 
 void OOXMLSecExporter::Impl::writeSignatureValue()
 {
-    m_xDocumentHandler->startElement("SignatureValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters(m_rInformation.ouSignatureValue);
     m_xDocumentHandler->endElement("SignatureValue");
 }
 
 void OOXMLSecExporter::Impl::writeKeyInfo()
 {
-    m_xDocumentHandler->startElement("KeyInfo", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
-    m_xDocumentHandler->startElement("X509Data", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
-    m_xDocumentHandler->startElement("X509Certificate", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "KeyInfo", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "X509Data", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "X509Certificate", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters(m_rInformation.ouX509Certificate);
     m_xDocumentHandler->endElement("X509Certificate");
     m_xDocumentHandler->endElement("X509Data");
@@ -207,7 +213,8 @@ void OOXMLSecExporter::Impl::writePackageObject()
 {
     rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
     pAttributeList->AddAttribute("Id", "idPackageObject");
-    m_xDocumentHandler->startElement("Object", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_xDocumentHandler->startElement(
+        "Object", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
 
     writeManifest();
     writePackageObjectSignatureProperties();
@@ -217,7 +224,8 @@ void OOXMLSecExporter::Impl::writePackageObject()
 
 void OOXMLSecExporter::Impl::writeManifest()
 {
-    m_xDocumentHandler->startElement("Manifest", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "Manifest", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     const SignatureReferenceInformations& rReferences = m_rInformation.vSignatureReferenceInfors;
     for (const SignatureReferenceInformation& rReference : rReferences)
     {
@@ -234,15 +242,22 @@ void OOXMLSecExporter::Impl::writeManifest()
 
 void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI)
 {
-    uno::Reference<embed::XHierarchicalStorageAccess> xHierarchicalStorageAccess(m_xRootStorage, uno::UNO_QUERY);
-    uno::Reference<io::XInputStream> xRelStream(xHierarchicalStorageAccess->openStreamElementByHierarchicalName(rURI, embed::ElementModes::READ), uno::UNO_QUERY);
+    uno::Reference<embed::XHierarchicalStorageAccess> xHierarchicalStorageAccess(m_xRootStorage,
+                                                                                 uno::UNO_QUERY);
+    uno::Reference<io::XInputStream> xRelStream(
+        xHierarchicalStorageAccess->openStreamElementByHierarchicalName(rURI,
+                                                                        embed::ElementModes::READ),
+        uno::UNO_QUERY);
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("Algorithm", ALGO_RELATIONSHIP);
-        m_xDocumentHandler->startElement("Transform", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "Transform", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
 
-    const uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, rURI, m_xComponentContext);
+    const uno::Sequence<uno::Sequence<beans::StringPair>> aRelationsInfo
+        = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, rURI,
+                                                               m_xComponentContext);
     for (const uno::Sequence<beans::StringPair>& rPairs : aRelationsInfo)
     {
         OUString aId;
@@ -261,7 +276,9 @@ void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI)
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("xmlns:mdssi", NS_MDSSI);
         pAttributeList->AddAttribute("SourceId", aId);
-        m_xDocumentHandler->startElement("mdssi:RelationshipReference", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "mdssi:RelationshipReference",
+            uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
         m_xDocumentHandler->endElement("mdssi:RelationshipReference");
     }
 
@@ -270,23 +287,28 @@ void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI)
 
 void OOXMLSecExporter::Impl::writePackageObjectSignatureProperties()
 {
-    m_xDocumentHandler->startElement("SignatureProperties", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureProperties", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("Id", "idSignatureTime");
         pAttributeList->AddAttribute("Target", "#idPackageSignature");
-        m_xDocumentHandler->startElement("SignatureProperty", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "SignatureProperty", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("xmlns:mdssi", NS_MDSSI);
-        m_xDocumentHandler->startElement("mdssi:SignatureTime", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "mdssi:SignatureTime", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
-    m_xDocumentHandler->startElement("mdssi:Format", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "mdssi:Format", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("YYYY-MM-DDThh:mm:ssTZD");
     m_xDocumentHandler->endElement("mdssi:Format");
 
-    m_xDocumentHandler->startElement("mdssi:Value", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "mdssi:Value", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     if (!m_rInformation.ouDateTime.isEmpty())
         m_aSignatureTimeValue = m_rInformation.ouDateTime;
     else
@@ -312,10 +334,12 @@ void OOXMLSecExporter::Impl::writeManifestReference(const SignatureReferenceInfo
 {
     rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
     pAttributeList->AddAttribute("URI", rReference.ouURI);
-    m_xDocumentHandler->startElement("Reference", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_xDocumentHandler->startElement(
+        "Reference", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
 
     // Transforms
-    if (rReference.ouURI.endsWith("?ContentType=application/vnd.openxmlformats-package.relationships+xml"))
+    if (rReference.ouURI.endsWith(
+            "?ContentType=application/vnd.openxmlformats-package.relationships+xml"))
     {
         OUString aURI = rReference.ouURI;
         // Ignore leading slash.
@@ -326,7 +350,8 @@ void OOXMLSecExporter::Impl::writeManifestReference(const SignatureReferenceInfo
         if (nQueryPos != -1)
             aURI = aURI.copy(0, nQueryPos);
 
-        m_xDocumentHandler->startElement("Transforms", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+        m_xDocumentHandler->startElement(
+            "Transforms", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
 
         writeRelationshipTransform(aURI);
         writeCanonicalizationTransform();
@@ -335,7 +360,8 @@ void OOXMLSecExporter::Impl::writeManifestReference(const SignatureReferenceInfo
     }
 
     DocumentSignatureHelper::writeDigestMethod(m_xDocumentHandler);
-    m_xDocumentHandler->startElement("DigestValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "DigestValue", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters(rReference.ouDigestValue);
     m_xDocumentHandler->endElement("DigestValue");
     m_xDocumentHandler->endElement("Reference");
@@ -346,14 +372,17 @@ void OOXMLSecExporter::Impl::writeOfficeObject()
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("Id", "idOfficeObject");
-        m_xDocumentHandler->startElement("Object", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "Object", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
-    m_xDocumentHandler->startElement("SignatureProperties", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureProperties", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("Id", "idOfficeV1Details");
         pAttributeList->AddAttribute("Target", "#idPackageSignature");
-        m_xDocumentHandler->startElement("SignatureProperty", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "SignatureProperty", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
     writeSignatureInfo();
     m_xDocumentHandler->endElement("SignatureProperty");
@@ -365,49 +394,67 @@ void OOXMLSecExporter::Impl::writeSignatureInfo()
 {
     rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
     pAttributeList->AddAttribute("xmlns", "http://schemas.microsoft.com/office/2006/digsig");
-    m_xDocumentHandler->startElement("SignatureInfoV1", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_xDocumentHandler->startElement(
+        "SignatureInfoV1", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
 
-    m_xDocumentHandler->startElement("SetupID", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SetupID", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters(m_rInformation.ouSignatureLineId);
     m_xDocumentHandler->endElement("SetupID");
-    m_xDocumentHandler->startElement("SignatureText", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureText", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->endElement("SignatureText");
-    m_xDocumentHandler->startElement("SignatureImage", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureImage", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->endElement("SignatureImage");
-    m_xDocumentHandler->startElement("SignatureComments", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureComments", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters(m_rInformation.ouDescription);
     m_xDocumentHandler->endElement("SignatureComments");
     // Just hardcode something valid according to [MS-OFFCRYPTO].
-    m_xDocumentHandler->startElement("WindowsVersion", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "WindowsVersion", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("6.1");
     m_xDocumentHandler->endElement("WindowsVersion");
-    m_xDocumentHandler->startElement("OfficeVersion", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "OfficeVersion", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("16.0");
     m_xDocumentHandler->endElement("OfficeVersion");
-    m_xDocumentHandler->startElement("ApplicationVersion", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "ApplicationVersion", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("16.0");
     m_xDocumentHandler->endElement("ApplicationVersion");
-    m_xDocumentHandler->startElement("Monitors", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "Monitors", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("1");
     m_xDocumentHandler->endElement("Monitors");
-    m_xDocumentHandler->startElement("HorizontalResolution", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "HorizontalResolution", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("1280");
     m_xDocumentHandler->endElement("HorizontalResolution");
-    m_xDocumentHandler->startElement("VerticalResolution", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "VerticalResolution", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("800");
     m_xDocumentHandler->endElement("VerticalResolution");
-    m_xDocumentHandler->startElement("ColorDepth", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "ColorDepth", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("32");
     m_xDocumentHandler->endElement("ColorDepth");
-    m_xDocumentHandler->startElement("SignatureProviderId", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureProviderId", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("{00000000-0000-0000-0000-000000000000}");
     m_xDocumentHandler->endElement("SignatureProviderId");
-    m_xDocumentHandler->startElement("SignatureProviderUrl", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureProviderUrl", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->endElement("SignatureProviderUrl");
-    m_xDocumentHandler->startElement("SignatureProviderDetails", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
-    m_xDocumentHandler->characters("9"); // This is what MSO 2016 writes, though [MS-OFFCRYPTO] doesn't document what the value means.
+    m_xDocumentHandler->startElement(
+        "SignatureProviderDetails",
+        uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->characters(
+        "9"); // This is what MSO 2016 writes, though [MS-OFFCRYPTO] doesn't document what the value means.
     m_xDocumentHandler->endElement("SignatureProviderDetails");
-    m_xDocumentHandler->startElement("SignatureType", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "SignatureType", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     m_xDocumentHandler->characters("2");
     m_xDocumentHandler->endElement("SignatureType");
 
@@ -416,15 +463,19 @@ void OOXMLSecExporter::Impl::writeSignatureInfo()
 
 void OOXMLSecExporter::Impl::writePackageSignature()
 {
-    m_xDocumentHandler->startElement("Object", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+    m_xDocumentHandler->startElement(
+        "Object", uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
     {
         rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
         pAttributeList->AddAttribute("xmlns:xd", NS_XD);
         pAttributeList->AddAttribute("Target", "#idPackageSignature");
-        m_xDocumentHandler->startElement("xd:QualifyingProperties", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+        m_xDocumentHandler->startElement(
+            "xd:QualifyingProperties",
+            uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
     }
 
-    DocumentSignatureHelper::writeSignedProperties(m_xDocumentHandler, m_rInformation, m_aSignatureTimeValue, false);
+    DocumentSignatureHelper::writeSignedProperties(m_xDocumentHandler, m_rInformation,
+                                                   m_aSignatureTimeValue, false);
 
     m_xDocumentHandler->endElement("xd:QualifyingProperties");
     m_xDocumentHandler->endElement("Object");
@@ -460,11 +511,13 @@ void OOXMLSecExporter::Impl::writeSignatureLineImages()
     }
 }
 
-OOXMLSecExporter::OOXMLSecExporter(const uno::Reference<uno::XComponentContext>& xComponentContext,
-                                   const uno::Reference<embed::XStorage>& xRootStorage,
-                                   const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler,
-                                   const SignatureInformation& rInformation)
-    : m_pImpl(std::make_unique<Impl>(xComponentContext, xRootStorage, xDocumentHandler, rInformation))
+OOXMLSecExporter::OOXMLSecExporter(
+    const uno::Reference<uno::XComponentContext>& xComponentContext,
+    const uno::Reference<embed::XStorage>& xRootStorage,
+    const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler,
+    const SignatureInformation& rInformation)
+    : m_pImpl(
+          std::make_unique<Impl>(xComponentContext, xRootStorage, xDocumentHandler, rInformation))
 {
 }
 
@@ -475,7 +528,8 @@ void OOXMLSecExporter::writeSignature()
     rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
     pAttributeList->AddAttribute("xmlns", NS_XMLDSIG);
     pAttributeList->AddAttribute("Id", "idPackageSignature");
-    m_pImpl->getDocumentHandler()->startElement("Signature", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+    m_pImpl->getDocumentHandler()->startElement(
+        "Signature", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
 
     m_pImpl->writeSignedInfo();
     m_pImpl->writeSignatureValue();


More information about the Libreoffice-commits mailing list