fdo#74605 negative value for wp:extents value causing corruption

Description:
After roundtrip
<wp:extent cx="-22327235" cy="149225" />
The cx value is negative so that the roundtrip file gives error while opening.

Conflicts:
	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
	https://gerrit.libreoffice.org/7898

Change-Id: I563f292ac5aaaeb0726159db1f4852a7e237f7ea
This commit is contained in:
PriyankaGaikwad 2014-02-06 16:40:17 +05:30 committed by Miklos Vajna
parent e7aab255c1
commit 0ff99adddc
3 changed files with 10 additions and 2 deletions

Binary file not shown.

View File

@ -3190,6 +3190,14 @@ DECLARE_OOXMLEXPORT_TEST(testOuterShdw,"testOuterShdw.docx")
assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:effectLst[1]/a:outerShdw[1]", "dist", "57811035");
}
DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx")
{
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent","cx","0");
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();

View File

@ -348,8 +348,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS
OString aWidth(OString::number(TwipsToEMU(rSize.Width())));
OString aHeight(OString::number(TwipsToEMU(rSize.Height())));
m_pImpl->m_pSerializer->singleElementNS(XML_wp, XML_extent,
XML_cx, aWidth.getStr(),
XML_cy, aHeight.getStr(),
XML_cx, (rSize.Width() > 0 ? aWidth.getStr() : "0"),
XML_cy, (rSize.Height() > 0 ? aHeight.getStr() : "0"),
FSEND);
// effectExtent, extent including the effect (shadow only for now)