diff options
Diffstat (limited to 'oox/source/export/drawingml.cxx')
-rw-r--r-- | oox/source/export/drawingml.cxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0364764f1d3d..141455452809 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -119,10 +119,12 @@ namespace drawingml { // not thread safe int DrawingML::mnImageCounter = 1; +int DrawingML::mnWdpImageCounter = 1; void DrawingML::ResetCounters() { mnImageCounter = 1; + mnWdpImageCounter = 1; } bool DrawingML::GetProperty( Reference< XPropertySet > rXPropSet, const OUString& aName ) @@ -2590,6 +2592,7 @@ void DrawingML::WriteArtisticEffect( Reference< XPropertySet > rXPropSet ) Sequence< PropertyValue > aAttrs; aEffect.Value >>= aAttrs; sax_fastparser::FastAttributeList *aAttrList = mpFS->createAttrList(); + OString sRelId; for( sal_Int32 i=0; i < aAttrs.getLength(); ++i ) { sal_Int32 nToken = ArtisticEffectProperties::getEffectToken( aAttrs[i].Name ); @@ -2599,6 +2602,12 @@ void DrawingML::WriteArtisticEffect( Reference< XPropertySet > rXPropSet ) aAttrs[i].Value >>= nVal; aAttrList->add( nToken, OString::number( nVal ).getStr() ); } + else if( aAttrs[i].Name == "OriginalGraphic" ) + { + Sequence< sal_Int8 > aGraphicData; + aAttrs[i].Value >>= aGraphicData; + sRelId = WriteWdpPicture( aGraphicData ); + } } mpFS->startElementNS( XML_a, XML_extLst, FSEND ); @@ -2608,7 +2617,9 @@ void DrawingML::WriteArtisticEffect( Reference< XPropertySet > rXPropSet ) mpFS->startElementNS( XML_a14, XML_imgProps, FSNS( XML_xmlns, XML_a14 ), "http://schemas.microsoft.com/office/drawing/2010/main", FSEND ); - mpFS->startElementNS( XML_a14, XML_imgLayer, FSEND ); + mpFS->startElementNS( XML_a14, XML_imgLayer, + FSNS( XML_r, XML_embed), sRelId.getStr(), + FSEND ); mpFS->startElementNS( XML_a14, XML_imgEffect, FSEND ); sax_fastparser::XFastAttributeListRef xAttrList( aAttrList ); @@ -2621,6 +2632,23 @@ void DrawingML::WriteArtisticEffect( Reference< XPropertySet > rXPropSet ) mpFS->endElementNS( XML_a, XML_extLst ); } +OString DrawingML::WriteWdpPicture( const Sequence< sal_Int8 >& rPictureData ) +{ + OUString sFileName = "media/hdphoto" + OUString::number( mnWdpImageCounter++ ) + ".wdp"; + uno::Reference< io::XOutputStream > xOutStream = + mpFB->openFragmentStream( "word/" + sFileName, + "image/vnd.ms-photo" ); + OUString sId; + xOutStream->writeBytes( rPictureData ); + xOutStream->closeOutput(); + + sId = mpFB->addRelation( mpFS->getOutputStream(), + "http://schemas.microsoft.com/office/2007/relationships/hdphoto", + sFileName, false ); + + return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); +} + } } |