[Libreoffice-commits] core.git: include/editeng include/oox include/svl include/svx offapi/com oox/source svx/source sw/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Tue Nov 28 06:58:56 UTC 2017


 include/editeng/unoprnms.hxx                       |    9 +
 include/oox/vml/vmlshape.hxx                       |    6 
 include/svl/solar.hrc                              |    2 
 include/svx/svdograf.hxx                           |   70 +++++++++
 include/svx/unoshprp.hxx                           |   23 ++-
 offapi/com/sun/star/drawing/GraphicObjectShape.idl |   24 +++
 oox/source/export/vmlexport.cxx                    |   94 +++++++++++-
 oox/source/vml/vmlshape.cxx                        |   54 ++++++-
 oox/source/vml/vmlshapecontext.cxx                 |   12 +
 svx/source/svdraw/svdograf.cxx                     |    5 
 svx/source/unodraw/unoshap2.cxx                    |  157 +++++++++++++++++++++
 sw/source/filter/ww8/docxsdrexport.cxx             |   10 +
 12 files changed, 446 insertions(+), 20 deletions(-)

New commits:
commit ecd683d3f98444b69a96cbf8bff57d4e691e6cfd
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Nov 23 15:03:22 2017 +0100

    tdf#83877 OOXML Roundtrip of SignatureLine properties
    
    Change-Id: I521e5f35663c5ab3c2702f1416fcec872f2f5e3f
    Reviewed-on: https://gerrit.libreoffice.org/44683
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index c059c942f751..44b4ce8843c9 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -167,6 +167,15 @@
 #define UNO_NAME_GRAPHOBJ_URLPREFIX             "vnd.sun.star.GraphicObject:"
 #define UNO_NAME_GRAPHOBJ_URLPKGPREFIX          "vnd.sun.star.Package:"
 #define UNO_NAME_GRAPHOBJ_GRAPHIC               "Graphic"
+#define UNO_NAME_GRAPHOBJ_IS_SIGNATURELINE      "IsSignatureLine"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_ID      "SignatureLineId"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_NAME "SignatureLineSuggestedSignerName"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_TITLE "SignatureLineSuggestedSignerTitle"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL "SignatureLineSuggestedSignerEmail"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS "SignatureLineSigningInstructions"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE "SignatureLineShowSignDate"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT "SignatureLineCanAddComment"
+#define UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE "SignatureLineUnsignedImage"
 
 #define UNO_NAME_OLE2_METAFILE                  "MetaFile"
 #define UNO_NAME_OLE2_PERSISTNAME               "PersistName"
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 3874556ad8df..9b2683e95bea 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -210,6 +210,12 @@ struct ShapeModel
     OUString     maVmlPath;          ///< VML path for this shape
     bool         mbIsSignatureLine;  ///< Shape is a signature line
     OUString     maSignatureId;      ///< ID of the signature
+    OUString     maSignatureLineSuggestedSignerName;
+    OUString     maSignatureLineSuggestedSignerTitle;
+    OUString     maSignatureLineSuggestedSignerEmail;
+    OUString     maSignatureLineSigningInstructions;
+    bool         mbSignatureLineShowSignDate;
+    bool         mbSignatureLineCanAddComment;
 
     explicit            ShapeModel();
                         ~ShapeModel();
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
index f284ff4fe473..1945323042b5 100644
--- a/include/svl/solar.hrc
+++ b/include/svl/solar.hrc
@@ -23,7 +23,7 @@
 // defines ------------------------------------------------------------------
 
 #define OWN_ATTR_VALUE_START                    3900
-#define OWN_ATTR_VALUE_END                      3993
+#define OWN_ATTR_VALUE_END                      4002
 
 #define RID_LIB_START               10000
 #define RID_LIB_END                 19999
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index ecf9eeef927a..74cb44b022db 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SVX_SVDOGRAF_HXX
 
 #include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
 #include <vcl/graph.hxx>
 #include <svx/svdorect.hxx>
 #include <svtools/grfmgr.hxx>
@@ -105,6 +106,16 @@ private:
     bool mbInsidePaint:1;
     bool mbIsPreview:1;
 
+    bool mbIsSignatureLine;
+    OUString maSignatureLineId;
+    OUString maSignatureLineSuggestedSignerName;
+    OUString maSignatureLineSuggestedSignerTitle;
+    OUString maSignatureLineSuggestedSignerEmail;
+    OUString maSignatureLineSigningInstructions;
+    bool mbIsSignatureLineShowSignDate;
+    bool mbIsSignatureLineCanAddComment;
+    css::uno::Reference<css::graphic::XGraphic> mpSignatureLineUnsignedGraphic;
+
 private:
 
     void                    ImpRegisterLink();
@@ -210,6 +221,65 @@ public:
 
     // add handles for crop mode when selected
     virtual void addCropHandles(SdrHdlList& rTarget) const override;
+
+    // Signature Line
+    void setIsSignatureLine(bool bIsSignatureLine) { mbIsSignatureLine = bIsSignatureLine; };
+    bool isSignatureLine() const { return mbIsSignatureLine; };
+    void setSignatureLineId(const OUString& rSignatureLineId)
+    {
+        maSignatureLineId = rSignatureLineId;
+    };
+    const OUString& getSignatureLineId() const { return maSignatureLineId; };
+    void setSignatureLineSuggestedSignerName(const OUString& rSuggestedSignerName)
+    {
+        maSignatureLineSuggestedSignerName = rSuggestedSignerName;
+    };
+    const OUString& getSignatureLineSuggestedSignerName() const
+    {
+        return maSignatureLineSuggestedSignerName;
+    };
+    void setSignatureLineSuggestedSignerTitle(const OUString& rSuggestedSignerTitle)
+    {
+        maSignatureLineSuggestedSignerTitle = rSuggestedSignerTitle;
+    };
+    const OUString& getSignatureLineSuggestedSignerTitle() const
+    {
+        return maSignatureLineSuggestedSignerTitle;
+    };
+    void setSignatureLineSuggestedSignerEmail(const OUString& rSuggestedSignerEmail)
+    {
+        maSignatureLineSuggestedSignerEmail = rSuggestedSignerEmail;
+    };
+    const OUString& getSignatureLineSuggestedSignerEmail() const
+    {
+        return maSignatureLineSuggestedSignerEmail;
+    };
+    void setSignatureLineSigningInstructions(const OUString& rSigningInstructions)
+    {
+        maSignatureLineSigningInstructions = rSigningInstructions;
+    };
+    const OUString& getSignatureLineSigningInstructions() const
+    {
+        return maSignatureLineSigningInstructions;
+    };
+    void setSignatureLineShowSignDate(bool bIsSignatureLineShowSignDate)
+    {
+        mbIsSignatureLineShowSignDate = bIsSignatureLineShowSignDate;
+    };
+    bool isSignatureLineShowSignDate() const { return mbIsSignatureLineShowSignDate; };
+    void setSignatureLineCanAddComment(bool bIsSignatureCanAddComment)
+    {
+        mbIsSignatureLineCanAddComment = bIsSignatureCanAddComment;
+    };
+    bool isSignatureLineCanAddComment() const { return mbIsSignatureLineCanAddComment; };
+    const css::uno::Reference<css::graphic::XGraphic> getSignatureLineUnsignedGraphic() const
+    {
+        return mpSignatureLineUnsignedGraphic;
+    };
+    void setSignatureLineUnsignedGraphic(css::uno::Reference<css::graphic::XGraphic> rGraphic)
+    {
+        mpSignatureLineUnsignedGraphic = rGraphic;
+    };
 };
 
 #endif // INCLUDED_SVX_SVDOGRAF_HXX
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 74fb7b18184c..1f34dc5112b2 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -181,7 +181,16 @@
 #define OWN_ATTR_INTEROPGRABBAG                 (OWN_ATTR_VALUE_START+91)
 #define OWN_ATTR_MEDIA_MIMETYPE                 (OWN_ATTR_VALUE_START+92)
 #define OWN_ATTR_FALLBACK_GRAPHIC               (OWN_ATTR_VALUE_START+93)
-// ATTENTION: maximum is OWN_ATTR_VALUE_START+93 svx, see include/svl/solar.hrc
+#define OWN_ATTR_IS_SIGNATURELINE               (OWN_ATTR_VALUE_START+94)
+#define OWN_ATTR_SIGNATURELINE_ID               (OWN_ATTR_VALUE_START+95)
+#define OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME  (OWN_ATTR_VALUE_START+96)
+#define OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE (OWN_ATTR_VALUE_START+97)
+#define OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL (OWN_ATTR_VALUE_START+98)
+#define OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS   (OWN_ATTR_VALUE_START+99)
+#define OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE   (OWN_ATTR_VALUE_START+100)
+#define OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT  (OWN_ATTR_VALUE_START+101)
+#define OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE   (OWN_ATTR_VALUE_START+102)
+// ATTENTION: maximum is OWN_ATTR_VALUE_START+102 svx, see include/svl/solar.hrc
 
 // #FontWork#
 #define FONTWORK_PROPERTIES \
@@ -422,8 +431,16 @@
     { OUString(UNO_NAME_GRAPHOBJ_REPLACEMENTGRAFURL),   OWN_ATTR_REPLACEMENTGRAFURL , ::cppu::UnoType<OUString>::get(), 0, 0 }, \
     { OUString(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL),        OWN_ATTR_GRAFSTREAMURL      , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID, 0 }, \
     { OUString(UNO_NAME_GRAPHOBJ_FILLBITMAP),           OWN_ATTR_VALUE_FILLBITMAP   , cppu::UnoType<css::awt::XBitmap>::get()  ,    0,     0},    \
-    { OUString(UNO_NAME_GRAPHOBJ_GRAPHIC),              OWN_ATTR_VALUE_GRAPHIC      , cppu::UnoType<css::graphic::XGraphic>::get()  ,   0,     0},
-
+    { OUString(UNO_NAME_GRAPHOBJ_GRAPHIC),              OWN_ATTR_VALUE_GRAPHIC      , cppu::UnoType<css::graphic::XGraphic>::get()  ,   0,     0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_IS_SIGNATURELINE),     OWN_ATTR_IS_SIGNATURELINE   , cppu::UnoType<bool>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_ID),     OWN_ATTR_SIGNATURELINE_ID   , cppu::UnoType<OUString>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_NAME), OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME, cppu::UnoType<OUString>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_TITLE), OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE, cppu::UnoType<OUString>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL), OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL, cppu::UnoType<OUString>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SIGNING_INSTRUCTIONS), OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS, cppu::UnoType<OUString>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_SHOW_SIGN_DATE), OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE, cppu::UnoType<bool>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT), OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT, cppu::UnoType<bool>::get(), 0, 0}, \
+    { OUString(UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE), OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0},
 
 #define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
     { OUString(UNO_NAME_3D_SCENE_AMBIENTCOLOR),     SDRATTR_3DSCENE_AMBIENTCOLOR   , ::cppu::UnoType<sal_Int32>::get(),   0,  0}, \
diff --git a/offapi/com/sun/star/drawing/GraphicObjectShape.idl b/offapi/com/sun/star/drawing/GraphicObjectShape.idl
index 0a5dc2327509..3a6e8d219bd6 100644
--- a/offapi/com/sun/star/drawing/GraphicObjectShape.idl
+++ b/offapi/com/sun/star/drawing/GraphicObjectShape.idl
@@ -110,6 +110,30 @@ published service GraphicObjectShape
     /** This is the graphic that represents this graphic shape
     */
     [optional, property] com::sun::star::graphic::XGraphic Graphic;
+
+    /// Whether this shape is actually a signature line.
+    [optional, property] boolean IsSignatureLine;
+    /// The ID of the signature line, used to connect to a signature.
+    [optional, property] string SignatureLineId;
+    /// Suggested Signer, Name of the Signer
+    [optional, property] string SignatureLineSuggestedSignerName;
+    /// Suggested Signer, Line 2 (Title or additional information)
+    [optional, property] string SignatureLineSuggestedSignerTitle;
+    /// Suggested Signer Email
+    [optional, property] string SignatureLineSuggestedSignerEmail;
+    /// Signing instructions, to be shown at signing time
+    [optional, property] string SignatureLineSigningInstructions;
+    /// Whether the signing date should be shown in the shape
+    [optional, property] boolean SignatureLineShowSignDate;
+    /// Whether the user can attach a comment at signing time
+    [optional, property] boolean SignatureLineCanAddComment;
+    /** Image to be displayed when the signature line is unsigned
+     *
+     *  Images for signed signature lines (valid and invalid)
+     *  are to be retrieved via com::sun::star::security::DocumentSignatureInformation
+     *  (you can get the matching signature with the SignatureLineId property).
+     */
+    [optional, property] com::sun::star::graphic::XGraphic SignatureLineUnsignedImage;
 };
 
 
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 27c733375707..766fb8f0cf91 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -31,6 +31,7 @@
 #include <tools/stream.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <svx/svdotext.hxx>
+#include <svx/svdograf.hxx>
 #include <vcl/cvtgrf.hxx>
 #include <filter/msfilter/msdffimp.hxx>
 #include <filter/msfilter/util.hxx>
@@ -601,15 +602,91 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
             case ESCHER_Prop_fillOpacity: // 386
                 {
                     sal_uInt32 nValue;
-                    sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList();
+                    sax_fastparser::FastAttributeList* pAttrList
+                        = FastSerializerHelper::createAttrList();
 
                     bool imageData = false;
                     EscherPropSortStruct aStruct;
-                    if ( rProps.GetOpt( ESCHER_Prop_fillBlip, aStruct ) && m_pTextExport)
+                    const SdrGrafObj* pSdrGrafObj = dynamic_cast<const SdrGrafObj*>(m_pSdrObject);
+
+                    if (pSdrGrafObj && pSdrGrafObj->isSignatureLine())
+                    {
+                        sax_fastparser::FastAttributeList* pAttrListSignatureLine
+                            = FastSerializerHelper::createAttrList();
+                        pAttrListSignatureLine->add(XML_issignatureline, "t");
+                        if (!pSdrGrafObj->getSignatureLineId().isEmpty())
+                        {
+                            pAttrListSignatureLine->add(
+                                XML_id, OUStringToOString(pSdrGrafObj->getSignatureLineId(),
+                                                          RTL_TEXTENCODING_UTF8));
+                        }
+                        if (!pSdrGrafObj->getSignatureLineSuggestedSignerName().isEmpty())
+                        {
+                            pAttrListSignatureLine->add(
+                                FSNS(XML_o, XML_suggestedsigner),
+                                OUStringToOString(
+                                    pSdrGrafObj->getSignatureLineSuggestedSignerName(),
+                                    RTL_TEXTENCODING_UTF8));
+                        }
+                        if (!pSdrGrafObj->getSignatureLineSuggestedSignerTitle().isEmpty())
+                        {
+                            pAttrListSignatureLine->add(
+                                FSNS(XML_o, XML_suggestedsigner2),
+                                OUStringToOString(
+                                    pSdrGrafObj->getSignatureLineSuggestedSignerTitle(),
+                                    RTL_TEXTENCODING_UTF8));
+                        }
+                        if (!pSdrGrafObj->getSignatureLineSuggestedSignerEmail().isEmpty())
+                        {
+                            pAttrListSignatureLine->add(
+                                FSNS(XML_o, XML_suggestedsigneremail),
+                                OUStringToOString(
+                                    pSdrGrafObj->getSignatureLineSuggestedSignerEmail(),
+                                    RTL_TEXTENCODING_UTF8));
+                        }
+                        if (!pSdrGrafObj->getSignatureLineSigningInstructions().isEmpty())
+                        {
+                            pAttrListSignatureLine->add(XML_signinginstructionsset, "t");
+                            pAttrListSignatureLine->add(
+                                FSNS(XML_o, XML_signinginstructions),
+                                OUStringToOString(
+                                    pSdrGrafObj->getSignatureLineSigningInstructions(),
+                                    RTL_TEXTENCODING_UTF8));
+                        }
+                        pAttrListSignatureLine->add(
+                            XML_showsigndate,
+                            pSdrGrafObj->isSignatureLineShowSignDate() ? "t" : "f");
+                        pAttrListSignatureLine->add(
+                            XML_allowcomments,
+                            pSdrGrafObj->isSignatureLineCanAddComment() ? "t" : "f");
+
+                        m_pSerializer->singleElementNS(
+                            XML_o, XML_signatureline,
+                            XFastAttributeListRef(pAttrListSignatureLine));
+
+                        // Get signature line graphic
+                        const uno::Reference<graphic::XGraphic> xGraphic
+                            = pSdrGrafObj->getSignatureLineUnsignedGraphic();
+                        Graphic aGraphic(xGraphic);
+
+                        BitmapChecksum nChecksum = aGraphic.GetChecksum();
+                        OUString aImageId = m_pTextExport->FindRelId(nChecksum);
+                        if (aImageId.isEmpty())
+                        {
+                            aImageId = m_pTextExport->GetDrawingML().WriteImage(aGraphic);
+                            m_pTextExport->CacheRelId(nChecksum, aImageId);
+                        }
+                        pAttrList->add(FSNS(XML_r, XML_id),
+                                       OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8));
+                        imageData = true;
+                    }
+                    else if (rProps.GetOpt(ESCHER_Prop_fillBlip, aStruct) && m_pTextExport)
                     {
                         SvMemoryStream aStream;
-                        int nHeaderSize = 25; // The first bytes are WW8-specific, we're only interested in the PNG
-                        aStream.WriteBytes(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize);
+                        // The first bytes are WW8-specific, we're only interested in the PNG
+                        int nHeaderSize = 25;
+                        aStream.WriteBytes(aStruct.pBuf + nHeaderSize,
+                                           aStruct.nPropSize - nHeaderSize);
                         aStream.Seek(0);
                         Graphic aGraphic;
                         GraphicConverter::Import(aStream, aGraphic);
@@ -618,15 +695,16 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
                         OUString aImageId = m_pTextExport->FindRelId(nChecksum);
                         if (aImageId.isEmpty())
                         {
-                            aImageId = m_pTextExport->GetDrawingML().WriteImage( aGraphic );
+                            aImageId = m_pTextExport->GetDrawingML().WriteImage(aGraphic);
                             m_pTextExport->CacheRelId(nChecksum, aImageId);
                         }
-                        pAttrList->add(FSNS(XML_r, XML_id), OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8));
+                        pAttrList->add(FSNS(XML_r, XML_id),
+                                       OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8));
                         imageData = true;
                     }
 
-                    if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
-                        impl_AddBool( pAttrList, FSNS(XML_o, XML_detectmouseclick), nValue != 0 );
+                    if (rProps.GetOpt(ESCHER_Prop_fNoFillHitTest, nValue))
+                        impl_AddBool(pAttrList, FSNS(XML_o, XML_detectmouseclick), nValue != 0);
 
                     if (imageData)
                         m_pSerializer->singleElementNS( XML_v, XML_imagedata, XFastAttributeListRef( pAttrList ) );
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index acc2bfade57a..1cec9461e2df 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1323,13 +1323,13 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
         uno::Sequence< security::DocumentSignatureInformation > xSignatureInfo =
             xSignatures->verifyScriptingContentSignatures(xStorage, uno::Reference< io::XInputStream >());
 
+        OUString aGraphicUrl;
         for (int i=0; i<xSignatureInfo.getLength(); i++)
         {
             // Try to find matching signature line image - if none exists that is fine,
             // then the signature line is not digitally signed.
             if (xSignatureInfo[i].SignatureLineId == getShapeModel().maSignatureId)
             {
-                OUString aGraphicUrl;
                 if (xSignatureInfo[i].SignatureIsValid)
                 {
                     // Signature is valid, use the 'valid' image
@@ -1342,14 +1342,54 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes
                     SAL_WARN_IF(!xSignatureInfo[i].InvalidSignatureLineImage.is(), "oox.vml", "No InvalidSignatureLineImage!");
                     aGraphicUrl = rFilter.getGraphicHelper().createGraphicObject(xSignatureInfo[i].InvalidSignatureLineImage);
                 }
-                Reference< XShape > xShape = SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicUrl);
-                PropertySet aPropSet(xShape);
-                aPropSet.setProperty(PROP_GraphicURL, aGraphicUrl);
-
-                return xShape;
+                break;
             }
         }
-        // In case no matching signature line is found, render the unsigned signature line image (next if branch)
+
+        Reference< XShape > xShape;
+        if (!aGraphicUrl.isEmpty())
+        {
+            // If available, use the signed image from the signature
+            xShape = SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicUrl);
+        }
+        else
+        {
+            // Create shape with the fallback "unsigned" image
+            xShape = SimpleShape::createEmbeddedPictureObject(rxShapes, rShapeRect, aGraphicPath);
+        }
+
+        // Store signature line properties
+        uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
+        xPropertySet->setPropertyValue("IsSignatureLine", uno::makeAny(true));
+        xPropertySet->setPropertyValue("SignatureLineId",
+                                        uno::makeAny(getShapeModel().maSignatureId));
+        xPropertySet->setPropertyValue(
+            "SignatureLineSuggestedSignerName",
+            uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerName));
+        xPropertySet->setPropertyValue(
+            "SignatureLineSuggestedSignerTitle",
+            uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerTitle));
+        xPropertySet->setPropertyValue(
+            "SignatureLineSuggestedSignerEmail",
+            uno::makeAny(getShapeModel().maSignatureLineSuggestedSignerEmail));
+        xPropertySet->setPropertyValue(
+            "SignatureLineSigningInstructions",
+            uno::makeAny(getShapeModel().maSignatureLineSigningInstructions));
+        xPropertySet->setPropertyValue(
+            "SignatureLineShowSignDate",
+            uno::makeAny(getShapeModel().mbSignatureLineShowSignDate));
+        xPropertySet->setPropertyValue(
+            "SignatureLineCanAddComment",
+            uno::makeAny(getShapeModel().mbSignatureLineCanAddComment));
+
+        if (!aGraphicPath.isEmpty())
+        {
+            Reference< XGraphic > xGraphic
+                = rFilter.getGraphicHelper().importEmbeddedGraphic(aGraphicPath);
+            xPropertySet->setPropertyValue("SignatureLineUnsignedImage",
+                                            uno::makeAny(xGraphic));
+        }
+        return xShape;
     }
 
     // try to create a picture object
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index 151f28585a70..423ba1458053 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -494,6 +494,18 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const Attri
         case O_TOKEN( signatureline ):
             mrShapeModel.mbIsSignatureLine = true;
             mrShapeModel.maSignatureId = rAttribs.getString(XML_id, OUString());
+            mrShapeModel.maSignatureLineSuggestedSignerName
+                = rAttribs.getString(O_TOKEN(suggestedsigner), OUString());
+            mrShapeModel.maSignatureLineSuggestedSignerTitle
+                = rAttribs.getString(O_TOKEN(suggestedsigner2), OUString());
+            mrShapeModel.maSignatureLineSuggestedSignerEmail
+                = rAttribs.getString(O_TOKEN(suggestedsigneremail), OUString());
+            mrShapeModel.maSignatureLineSigningInstructions
+                = rAttribs.getString(O_TOKEN(signinginstructions), OUString());
+            mrShapeModel.mbSignatureLineShowSignDate = ConversionHelper::decodeBool(
+                rAttribs.getString(XML_showsigndate, "t")); // default is true
+            mrShapeModel.mbSignatureLineCanAddComment = ConversionHelper::decodeBool(
+                rAttribs.getString(XML_allowcomments, "f")); // default is false
             break;
         case O_TOKEN( lock ):
             // TODO
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index ea8701929a88..47c837f01712 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -329,7 +329,10 @@ void SdrGrafObj::onGraphicChanged()
 SdrGrafObj::SdrGrafObj()
 :   SdrRectObj(),
     pGraphicLink    ( nullptr ),
-    bMirrored       ( false )
+    bMirrored       ( false ),
+    mbIsSignatureLine(false),
+    mbIsSignatureLineShowSignDate(true),
+    mbIsSignatureLineCanAddComment(false)
 {
     pGraphic = new GraphicObject;
     mpReplacementGraphic = nullptr;
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 6b68c7dc6421..fd48bef8aef8 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1429,6 +1429,106 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
         }
         break;
     }
+
+    case OWN_ATTR_IS_SIGNATURELINE:
+    {
+        bool bIsSignatureLine;
+        if (rValue >>= bIsSignatureLine)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setIsSignatureLine(bIsSignatureLine);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_ID:
+    {
+        OUString aSignatureLineId;
+        if (rValue >>= aSignatureLineId)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineId(aSignatureLineId);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME:
+    {
+        OUString aSuggestedSignerName;
+        if (rValue >>= aSuggestedSignerName)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSuggestedSignerName(aSuggestedSignerName);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE:
+    {
+        OUString aSuggestedSignerTitle;
+        if (rValue >>= aSuggestedSignerTitle)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSuggestedSignerTitle(aSuggestedSignerTitle);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL:
+    {
+        OUString aSuggestedSignerEmail;
+        if (rValue >>= aSuggestedSignerEmail)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSuggestedSignerEmail(aSuggestedSignerEmail);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS:
+    {
+        OUString aSigningInstructions;
+        if (rValue >>= aSigningInstructions)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSigningInstructions(aSigningInstructions);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE:
+    {
+        bool bShowSignDate;
+        if (rValue >>= bShowSignDate)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineShowSignDate(bShowSignDate);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT:
+    {
+        bool bCanAddComment;
+        if (rValue >>= bCanAddComment)
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineCanAddComment(bCanAddComment);
+            bOk = true;
+        }
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE:
+    {
+        Reference<graphic::XGraphic> xGraphic(rValue, uno::UNO_QUERY);
+        if (xGraphic.is())
+        {
+            static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineUnsignedGraphic(xGraphic);
+            bOk = true;
+        }
+        break;
+    }
+
     default:
         return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
     }
@@ -1519,6 +1619,63 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
         rValue <<= static_cast< SdrGrafObj* >( mpObj.get() )->getInputStream();
         break;
     }
+
+    case OWN_ATTR_IS_SIGNATURELINE:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->isSignatureLine();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_ID:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineId();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSuggestedSignerName();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSuggestedSignerTitle();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSuggestedSignerEmail();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSigningInstructions();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->isSignatureLineShowSignDate();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT:
+    {
+        rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->isSignatureLineCanAddComment();
+        break;
+    }
+
+    case OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE:
+    {
+        Reference<graphic::XGraphic> xGraphic(
+            static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineUnsignedGraphic());
+        rValue <<= xGraphic;
+        break;
+    }
+
     default:
         return SvxShapeText::getPropertyValueImpl(rName, pProperty,rValue);
     }
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index df9372855cfc..260cf7f78f8c 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -924,6 +924,16 @@ bool DocxSdrExport::Impl::isSupportedDMLShape(const uno::Reference<drawing::XSha
         || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
         return false;
 
+    // For signature line shapes, we don't want DML, just the VML shape.
+    bool bIsSignatureLineShape = false;
+    if (xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+    {
+        uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY);
+        xShapeProperties->getPropertyValue("IsSignatureLine") >>= bIsSignatureLineShape;
+        if (bIsSignatureLineShape)
+            return false;
+    }
+
     return true;
 }
 


More information about the Libreoffice-commits mailing list