From bfd613a4628c8827168f64fc2a97685785d04a84 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Thu, 23 Nov 2017 15:06:08 +0100 Subject: tdf#83877 ODF extension to write signature lines This adds a element to draw:image if the image is a signatureline. Example: Change-Id: I4d77acec528175fba66556661ab74462f5bd875f Reviewed-on: https://gerrit.libreoffice.org/45153 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt --- include/xmloff/shapeexport.hxx | 1 + xmloff/source/draw/shapeexport.cxx | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx index c883886126a5..1865210d5bde 100644 --- a/include/xmloff/shapeexport.hxx +++ b/include/xmloff/shapeexport.hxx @@ -217,6 +217,7 @@ private: SAL_DLLPRIVATE void ImpExportEvents( const css::uno::Reference< css::drawing::XShape >& xShape ); SAL_DLLPRIVATE void ImpExportDescription( const css::uno::Reference< css::drawing::XShape >& xShape ); // #i68101# SAL_DLLPRIVATE void ImpExportGluePoints( const css::uno::Reference< css::drawing::XShape >& xShape ); + SAL_DLLPRIVATE void ImpExportSignatureLine(const css::uno::Reference& xShape); // single shape exporters SAL_DLLPRIVATE void ImpExportGroupShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 887f5ecfd372..86b4f621b182 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -1256,6 +1256,53 @@ void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape } } +void XMLShapeExport::ImpExportSignatureLine(const uno::Reference& xShape) +{ + uno::Reference xPropSet(xShape, uno::UNO_QUERY); + + bool bIsSignatureLine = false; + xPropSet->getPropertyValue("IsSignatureLine") >>= bIsSignatureLine; + if (!bIsSignatureLine) + return; + + OUString aSignatureLineId; + xPropSet->getPropertyValue("SignatureLineId") >>= aSignatureLineId; + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "id", aSignatureLineId); + + OUString aSuggestedSignerName; + xPropSet->getPropertyValue("SignatureLineSuggestedSignerName") >>= aSuggestedSignerName; + if (!aSuggestedSignerName.isEmpty()) + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "suggested-signer-name", aSuggestedSignerName); + + OUString aSuggestedSignerTitle; + xPropSet->getPropertyValue("SignatureLineSuggestedSignerTitle") >>= aSuggestedSignerTitle; + if (!aSuggestedSignerTitle.isEmpty()) + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "suggested-signer-title", aSuggestedSignerTitle); + + OUString aSuggestedSignerEmail; + xPropSet->getPropertyValue("SignatureLineSuggestedSignerEmail") >>= aSuggestedSignerEmail; + if (!aSuggestedSignerEmail.isEmpty()) + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "suggested-signer-email", aSuggestedSignerEmail); + + OUString aSigningInstructions; + xPropSet->getPropertyValue("SignatureLineSigningInstructions") >>= aSigningInstructions; + if (!aSigningInstructions.isEmpty()) + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "signing-instructions", aSigningInstructions); + + bool bShowSignDate = false; + xPropSet->getPropertyValue("SignatureLineShowSignDate") >>= bShowSignDate; + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "show-sign-date", + bShowSignDate ? OUString("true") : OUString("false")); + + bool bCanAddComment = false; + xPropSet->getPropertyValue("SignatureLineCanAddComment") >>= bCanAddComment; + mrExport.AddAttribute(XML_NAMESPACE_LO_EXT, "can-add-comment", + bCanAddComment ? OUString("true") : OUString("false")); + + SvXMLElementExport aSignatureLineElement(mrExport, XML_NAMESPACE_LO_EXT, "signatureline", true, + true); +} + void XMLShapeExport::ExportGraphicDefaults() { rtl::Reference aStEx(new XMLStyleExport(mrExport, mrExport.GetAutoStylePool().get())); @@ -2364,6 +2411,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape( GetExport().AddAttribute(XML_NAMESPACE_LO_EXT, "mime-type", aMimeType); SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, true, true); + ImpExportSignatureLine( xShape ); if( !sImageURL.isEmpty() ) { -- cgit v1.2.3