oox/source/drawingml/shape.cxx | 13 ++++++++++--- sw/qa/extras/ooxmlimport/data/tdf122717.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 13 +++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-)
New commits: commit 8ff2119a06df1fae0447b21507878fbd34149488 Author: Xisco Fauli <[email protected]> AuthorDate: Thu Mar 25 17:38:20 2021 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Mar 29 11:00:45 2021 +0200 tdf#122717: fix handling of zero width/height lines The code was introduced in 627c2469843c9461b665c4571f1214aca7fc36a4 < tdf#96674 drawingML import: fix handling of zero width/height lines > and later on removed by 36bade04d3780bc54c51b46bb0b63e69789658a5 < tdf106792 Get rid of SvxShapePolyPolygonBezier > with the comment "I doubt that the additional code to make a line not exactly hor/ver is needed. Checked and it is not needed, thus removed the change from tdf#96674 in shape.cxx." it turned out, it's still needed Change-Id: Ib64ee17227e3e588e94381abeabe5a2ff2e0b7d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113102 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 3e4eb070787d4d44b3bdc95046e5b231dbbef42b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113119 Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 11d344f6271e4171f8006c2cb29372f612cbdc00) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113123 Tested-by: Xisco Fauli <[email protected]> diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 5aeab36ba880..69fcadd4900c 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -848,10 +848,17 @@ Reference< XShape > const & Shape::createAndInsert( uno::Reference<lang::XServiceInfo> xModelInfo(rFilterBase.getModel(), uno::UNO_QUERY); for( i = 0; i < nNumPoints; ++i ) { - const basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); + basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); - // tdf#106792 Not needed anymore due to the change in SdrPathObj::NbcResize: - // tdf#96674: Guard against zero width or height. + // Guard against zero width or height. + if (i) + { + const basegfx::B2DPoint& rPreviousPoint = aPoly.getB2DPoint(i - 1); + if (aPoint.getX() - rPreviousPoint.getX() == 0) + aPoint.setX(aPoint.getX() + 1); + if (aPoint.getY() - rPreviousPoint.getY() == 0) + aPoint.setY(aPoint.getY() + 1); + } pPoints[i] = awt::Point(static_cast<sal_Int32>(aPoint.getX()), static_cast<sal_Int32>(aPoint.getY())); } diff --git a/sw/qa/extras/ooxmlimport/data/tdf122717.docx b/sw/qa/extras/ooxmlimport/data/tdf122717.docx new file mode 100644 index 000000000000..9a2098272c75 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf122717.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index fe1b4ed5028d..9df5b896100e 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1398,6 +1398,19 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx") CPPUNIT_ASSERT(aActualSize.Height > 0); } +DECLARE_OOXMLIMPORT_TEST(testTdf122717, "tdf122717.docx") +{ + uno::Reference<drawing::XShape> xShape = getShape(1); + CPPUNIT_ASSERT(xShape.is()); + awt::Size aActualSize(xShape->getSize()); + // Without the fix in place, this test would have failed with + // - Expected: 2 + // - Actual : 8160 + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aActualSize.Width); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8160), aActualSize.Height); + +} + DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx") { sal_Int32 nFlyHeight = parseDump("//fly/infos/bounds", "height").toInt32(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
