[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - oox/source sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Mon Jan 11 04:44:13 PST 2016


 oox/source/drawingml/shape.cxx              |   13 ++++++++++++-
 sw/qa/extras/ooxmlimport/data/tdf96674.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx    |   10 ++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit c5f4c528123d6c65b489ac18ab7892bc92866b09
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jan 5 09:08:21 2016 +0100

    tdf#96674 drawingML import: fix handling of zero width/height lines
    
    (cherry picked from commit 627c2469843c9461b665c4571f1214aca7fc36a4)
    
    Change-Id: If3d9f6272031e08ab228cfa58963d60ceede2498
    Reviewed-on: https://gerrit.libreoffice.org/21342
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index d7247be..4a9223f 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -510,7 +510,18 @@ Reference< XShape > Shape::createAndInsert(
         bool bIsWriter = xModelInfo->supportsService("com.sun.star.text.TextDocument");
         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)
                 // Writer's draw page is in twips, and these points get passed
                 // to core without any unit conversion when Writer
diff --git a/sw/qa/extras/ooxmlimport/data/tdf96674.docx b/sw/qa/extras/ooxmlimport/data/tdf96674.docx
new file mode 100644
index 0000000..752479c
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf96674.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 87435f5..043f7f4 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2859,6 +2859,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf78902, "tdf78902.docx")
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+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);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list