sw/qa/extras/ooxmlexport/data/tdf107104.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 4 +++- sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 7 +++++++ sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 4 ++-- writerfilter/source/dmapper/GraphicImport.cxx | 6 ++++++ 5 files changed, 18 insertions(+), 3 deletions(-)
New commits: commit e6e5a68f52f4e06b73f0ece3a3886f3bfc30f56d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Apr 25 09:25:34 2017 +0200 tdf#107104 DOCX drawingML import: fix invisible arrow shape This is the drawingML equivalent of commit 3d9ebded1358395ed81db7a63629b046aec2aeac (Misc improvements for docx VML import, 2010-10-06), which made sure that shapes are never invisible just because they have zero height or width. For this particular bugdoc the Word-produced WW8 equivalent width is 20 twips, but let's be consistent with the VML import and just round up to 1 mm100. Also fix two existing tests that wanted to test something else, but implicitly asserted that some shapes indeed have zero width/height. Change-Id: I9600424520d0a3deecc711b44622eccc041a59da Reviewed-on: https://gerrit.libreoffice.org/36927 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf107104.docx b/sw/qa/extras/ooxmlexport/data/tdf107104.docx new file mode 100644 index 000000000000..2f8c87d8d3d5 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107104.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 80f28f09875a..2891b3ff162f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -909,7 +909,9 @@ 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"); + sal_Int32 nX = getXPath(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").toInt32(); + // This was negative. + CPPUNIT_ASSERT(nX >= 0); } // part of tdf#93676, word gives the frame in the exported .docx a huge height, diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 3311f1b68184..15e1f05e629e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -457,6 +457,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106492, "tdf106492.docx") assertXPath(pXmlDoc, "//w:sectPr", 3); } +DECLARE_OOXMLEXPORT_TEST(testTdf107104, "tdf107104.docx") +{ + CPPUNIT_ASSERT(getShape(1)->getSize().Width > 0); + // This failed: the second arrow was invisible because it had zero height. + CPPUNIT_ASSERT(getShape(2)->getSize().Width > 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 185ec428edff..741ee50fa336 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1199,8 +1199,8 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx") uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY); CPPUNIT_ASSERT(xShape.is()); awt::Size aActualSize(xShape->getSize()); - // This was 3493: the vertical line was horizontal. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aActualSize.Width); + // Width was 3493: the vertical line was horizontal. + CPPUNIT_ASSERT(aActualSize.Width < aActualSize.Height); CPPUNIT_ASSERT(aActualSize.Height > 0); } diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index ac1451f5c7a1..22878b6121f1 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -536,6 +536,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) case NS_ooxml::LN_CT_PositiveSize2D_cy: { sal_Int32 nDim = oox::drawingml::convertEmuToHmm(nIntValue); + // drawingML equivalent of oox::vml::ShapeType::getAbsRectangle(): + // make sure a shape isn't hidden implicitly just because it has + // zero height or width. + if (nDim == 0) + nDim = 1; + if( nName == NS_ooxml::LN_CT_PositiveSize2D_cx ) m_pImpl->setXSize(nDim); else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits