diff options
author | sushil_shinde <sushil.shinde@synerzip.com> | 2013-10-21 21:34:55 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-11-12 09:54:08 +0100 |
commit | 965d29d00eb14250a994393f5d6b437e49760830 (patch) | |
tree | e6d7bea8361e352b708a1face3d8e4866c9234a2 | |
parent | 439b518b1a96b8cffd96da6fd060e7be074a2035 (diff) |
#65836- Fix for exporting image inside vml data was corrupting file.
- Handled exporting of image for all type of format in vmlexport.
- fixed issue - .rels file was not getting exported for vmlexport.
- Not handled for .wmf image (will work on it)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/6369
Change-Id: I9ccf7a36ae316a658f06d1074caa4e4b2f5d271f
-rw-r--r-- | oox/source/export/vmlexport.cxx | 9 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/image_data.docx | bin | 0 -> 50255 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 4 |
4 files changed, 17 insertions, 4 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 6274e19b0b5e..8eeb9dc2183b 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -555,6 +555,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) ) impl_AddColor( pAttrList, XML_color2, nValue ); + bool imageData = false; EscherPropSortStruct aStruct; if ( rProps.GetOpt( ESCHER_Prop_fillBlip, aStruct ) && m_pTextExport) { @@ -563,9 +564,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect aStream.Write(aStruct.pBuf + nHeaderSize, aStruct.nPropSize - nHeaderSize); aStream.Seek(0); Graphic aGraphic; - GraphicConverter::Import(aStream, aGraphic, CVT_PNG); + GraphicConverter::Import(aStream, aGraphic); OUString aImageId = m_pTextExport->GetDrawingML().WriteImage( aGraphic ); pAttrList->add(FSNS(XML_r, XML_id), OUStringToOString(aImageId, RTL_TEXTENCODING_UTF8)); + imageData = true; } if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) ) @@ -575,7 +577,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1. pAttrList->add(XML_opacity, OString::number(double((nValue * 100) >> 16) / 100)); - m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) ); + if (imageData) + m_pSerializer->singleElementNS( XML_v, XML_imagedata, XFastAttributeListRef( pAttrList ) ); + else + m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) ); } bAlreadyWritten[ ESCHER_Prop_fillType ] = true; bAlreadyWritten[ ESCHER_Prop_fillColor ] = true; diff --git a/sw/qa/extras/ooxmlexport/data/image_data.docx b/sw/qa/extras/ooxmlexport/data/image_data.docx Binary files differnew file mode 100644 index 000000000000..a2f89b146c7e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/image_data.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index c19a70aa61e8..94b48a062c4a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -1588,6 +1588,14 @@ DECLARE_OOXML_TEST(testVMLData, "TestVMLData.docx") CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/w:pict/v:shape", "stroked").match("f")); } +DECLARE_OOXML_TEST(testImageData, "image_data.docx") +{ + // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element. + + xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 19f80e7dae1f..2712f75e0b98 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1158,7 +1158,7 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData ) //We need to write w:drawing tag after the w:rPr. WritePostponedChart(); - //We need to write w:drawing tag after the w:rPr. + //We need to write w:pict tag after the w:rPr. WritePostponedVMLDrawing(); // merge the properties _before_ the run text (strictly speaking, just @@ -3260,7 +3260,7 @@ void DocxAttributeOutput::WriteVMLDrawing( const SdrObject* sdrObj, const SwFrmF } m_pSerializer->startElementNS( XML_w, XML_pict, FSEND ); - + m_rDrawingML.SetFS(m_pSerializer); // See WinwordAnchoring::SetAnchoring(), these are not part of the SdrObject, have to be passed around manually. SwFmtHoriOrient rHoriOri = (rFrmFmt).GetHoriOrient(); |