[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 3 commits - include/editeng include/oox include/svl include/svx offapi/com oox/source svx/source sw/source xmlsecurity/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Wed Nov 29 13:49:35 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 | 88 ++++++++++-
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 | 19 +-
xmlsecurity/source/helper/ooxmlsecparser.cxx | 1
13 files changed, 447 insertions(+), 23 deletions(-)
New commits:
commit 8a3484c584fce424691af73aea6c9136a1267d5d
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 ddd2a04593a8..c74844a15772 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 2bd7d3d1a86d..bcf43d70f567 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -207,6 +207,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 022f98da8c06..91a41b440038 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_SFX_START 260
// RID_SFX_END 9999
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index 90027f4429ad..123ba1dc69bd 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 ImpLinkAnmeldung();
@@ -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 cf0bf7a4c662..5cfd2890f432 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 8cad39ebfe0c..ca2b95a3e919 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -30,6 +30,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>
@@ -578,11 +579,85 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
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
@@ -595,15 +670,16 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
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 efcc700d1e4d..72c77c7dddee 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1195,13 +1195,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
@@ -1214,14 +1214,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 a45f779f5237..d5c92c2369cb 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -475,6 +475,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 c67599d3a8a3..ad51e4a6af38 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -334,7 +334,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 246ec629ab38..db56f3e9f06a 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1546,6 +1546,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 );
}
@@ -1636,6 +1736,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 b7ad64d7b455..a5b2c38b72a6 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -929,6 +929,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;
}
commit 80a16f6f4685c689fa10e3b924ed70960903e536
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Nov 23 15:50:34 2017 +0100
Simplify method
Change-Id: I4de0c0fc0127b454f19ecf154d8ce58f189852cf
Reviewed-on: https://gerrit.libreoffice.org/45164
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index a8160a3f68c1..b7ad64d7b455 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -924,13 +924,12 @@ void DocxSdrExport::Impl::textFrameShadow(const SwFrameFormat& rFrameFormat)
bool DocxSdrExport::Impl::isSupportedDMLShape(const uno::Reference<drawing::XShape>& xShape)
{
- bool supported = true;
-
uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW);
- if (xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonShape") || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
- supported = false;
+ if (xServiceInfo->supportsService("com.sun.star.drawing.PolyPolygonShape")
+ || xServiceInfo->supportsService("com.sun.star.drawing.PolyLineShape"))
+ return false;
- return supported;
+ return true;
}
void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat& rFrameFormat,const Point& rNdTopLeft, int nAnchorId)
commit caf85b65c60a3a3d154b33a92c4277eabfd3a10c
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Fri Nov 3 15:38:06 2017 +0100
Missing initialization of m_bInSignatureLineId
Change-Id: I563f7324129828d13c4549d330d58d6ab972472c
Reviewed-on: https://gerrit.libreoffice.org/44268
Reviewed-by: Serge Krot (CIB) <Serge.Krot at cib.de>
Tested-by: Serge Krot (CIB) <Serge.Krot at cib.de>
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx
index 50099c255418..0823115f9cca 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx
@@ -24,6 +24,7 @@ OOXMLSecParser::OOXMLSecParser(XSecController* pXSecController)
,m_bInCertDigest(false)
,m_bInValidSignatureImage(false)
,m_bInInvalidSignatureImage(false)
+ ,m_bInSignatureLineId(false)
,m_bReferenceUnresolved(false)
{
}
More information about the Libreoffice-commits
mailing list