diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/vmlexport.cxx | 94 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 54 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 12 |
3 files changed, 145 insertions, 15 deletions
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 |