[Libreoffice-commits] core.git: include/xmloff xmloff/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Mon Dec 4 16:27:30 UTC 2017


 include/xmloff/shapeexport.hxx     |    1 
 xmloff/source/draw/shapeexport.cxx |   48 +++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

New commits:
commit bfd613a4628c8827168f64fc2a97685785d04a84
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Nov 23 15:06:08 2017 +0100

    tdf#83877 ODF extension to write signature lines
    
    This adds a <loext:signatureline> element to draw:image if the image
    is a signatureline.
    
    Example:
    <draw:image xlink:href="...">
      <loext:signatureline loext:id="..." loext:suggested-signer-name="..." loext:suggested-signer-title="..." loext:suggested-signer-email="..." loext:signing-instructions="..." loext:show-sign-date="true" loext:can-add-comment="false"/>
    </draw:image>
    
    Change-Id: I4d77acec528175fba66556661ab74462f5bd875f
    Reviewed-on: https://gerrit.libreoffice.org/45153
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

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<css::drawing::XShape>& 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<drawing::XShape>& xShape)
+{
+    uno::Reference<beans::XPropertySet> 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<XMLStyleExport> 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() )
             {


More information about the Libreoffice-commits mailing list