Kaydet (Commit) 627c2469 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#96674 drawingML import: fix handling of zero width/height lines

Change-Id: If3d9f6272031e08ab228cfa58963d60ceede2498
üst f44bd6b0
...@@ -510,7 +510,18 @@ Reference< XShape > Shape::createAndInsert( ...@@ -510,7 +510,18 @@ Reference< XShape > Shape::createAndInsert(
bool bIsWriter = xModelInfo->supportsService("com.sun.star.text.TextDocument"); bool bIsWriter = xModelInfo->supportsService("com.sun.star.text.TextDocument");
for( i = 0; i < nNumPoints; ++i ) for( i = 0; i < nNumPoints; ++i )
{ {
const ::basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) ); basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
// 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.getX() == 0)
aPoint.setY(aPoint.getY() + 1);
}
if (bIsWriter && bInGroup) if (bIsWriter && bInGroup)
// Writer's draw page is in twips, and these points get passed // Writer's draw page is in twips, and these points get passed
// to core without any unit conversion when Writer // to core without any unit conversion when Writer
......
...@@ -3017,6 +3017,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf94043, "tdf94043.docx") ...@@ -3017,6 +3017,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf94043, "tdf94043.docx")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xTextColumns, "SeparatorLineWidth")); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), getProperty<sal_Int32>(xTextColumns, "SeparatorLineWidth"));
} }
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);
CPPUNIT_ASSERT(aActualSize.Height > 0);
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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