Kaydet (Commit) 965d29d0 authored tarafından sushil_shinde's avatar sushil_shinde Kaydeden (comit) Miklos Vajna

#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
üst 439b518b
......@@ -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;
......
......@@ -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();
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment