summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/ooxmlsecexporter.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index abb0a648b520..9ca95c5d755e 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -18,13 +18,16 @@
#include <comphelper/ofopxmlhelper.hxx>
#include <o3tl/make_unique.hxx>
#include <rtl/ref.hxx>
+#include <svx/xoutbmp.hxx>
#include <unotools/datetime.hxx>
+#include <vcl/salctype.hxx>
#include <xmloff/attrlist.hxx>
#include <documentsignaturehelper.hxx>
#include <xsecctl.hxx>
using namespace com::sun::star;
+using namespace css::xml::sax;
struct OOXMLSecExporter::Impl
{
@@ -68,6 +71,7 @@ struct OOXMLSecExporter::Impl
/// Writes <SignatureInfoV1>.
void writeSignatureInfo();
void writePackageSignature();
+ void writeSignatureLineImages();
};
bool OOXMLSecExporter::Impl::isOOXMLBlacklist(const OUString& rStreamName)
@@ -417,6 +421,36 @@ void OOXMLSecExporter::Impl::writePackageSignature()
m_xDocumentHandler->endElement("Object");
}
+void OOXMLSecExporter::Impl::writeSignatureLineImages()
+{
+ if (m_rInformation.aValidSignatureImage.is())
+ {
+ rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute("Id", "idValidSigLnImg");
+ m_xDocumentHandler->startElement(
+ "Object", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+ OUString aGraphicInBase64;
+ Graphic aGraphic(m_rInformation.aValidSignatureImage);
+ if (!XOutBitmap::GraphicToBase64(aGraphic, aGraphicInBase64, false, ConvertDataFormat::EMF))
+ SAL_WARN("xmlsecurity.helper", "could not convert graphic to base64");
+ m_xDocumentHandler->characters(aGraphicInBase64);
+ m_xDocumentHandler->endElement("Object");
+ }
+ if (m_rInformation.aInvalidSignatureImage.is())
+ {
+ rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute("Id", "idInvalidSigLnImg");
+ m_xDocumentHandler->startElement(
+ "Object", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+ OUString aGraphicInBase64;
+ Graphic aGraphic(m_rInformation.aInvalidSignatureImage);
+ if (!XOutBitmap::GraphicToBase64(aGraphic, aGraphicInBase64, false, ConvertDataFormat::EMF))
+ SAL_WARN("xmlsecurity.helper", "could not convert graphic to base64");
+ m_xDocumentHandler->characters(aGraphicInBase64);
+ m_xDocumentHandler->endElement("Object");
+ }
+}
+
OOXMLSecExporter::OOXMLSecExporter(const uno::Reference<uno::XComponentContext>& xComponentContext,
const uno::Reference<embed::XStorage>& xRootStorage,
const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler,
@@ -440,6 +474,7 @@ void OOXMLSecExporter::writeSignature()
m_pImpl->writePackageObject();
m_pImpl->writeOfficeObject();
m_pImpl->writePackageSignature();
+ m_pImpl->writeSignatureLineImages();
m_pImpl->m_xDocumentHandler->endElement("Signature");
}