tdf#83877 OOXML Roundtrip of SignatureLine properties
Change-Id: I521e5f35663c5ab3c2702f1416fcec872f2f5e3f Reviewed-on: https://gerrit.libreoffice.org/44683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
@@ -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"
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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}, \
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -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 ) );
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user