[Libreoffice-commits] core.git: oox/source sw/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 19 02:07:02 PDT 2014


 oox/source/vml/vmlshapecontext.cxx          |    3 ++-
 sw/qa/extras/ooxmlimport/data/fdo74401.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx    |    9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 81f9fe3a14f0fc99afbfa7ce3a26a9c7855d0919
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 19 09:59:32 2014 +0100

    fdo#74401 VML groupshape import: only handle v:rect as TextShape
    
    Regression from commit 75934fc178ed90b56d77eb1efebed5bdac8427b6 (VML
    import: handle shape with text inside groupshape as TextShape,
    2014-01-17), the problem was that TextShape is also a kind of rectangle,
    so that shouldn't be used for all shape with text in groupshapes, just
    for v:rect elements.
    
    This fix gives the required text wrapping for the referenced bugdoc
    without turning the rest of the shapes into rectangles.
    
    Change-Id: I6e343c65a869e335b641728adbc7984ee85377b5

diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index d213815..fe7e8ec 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -459,7 +459,8 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const Attri
                 dynamic_cast<SimpleShape&>( mrShape ).setService(
                         "com.sun.star.text.TextFrame");
             }
-            else
+            else if (getCurrentElement() == VML_TOKEN(rect))
+                // Transform only rectangles into a TextShape inside a groupshape.
                 dynamic_cast<SimpleShape&>(mrShape).setService("com.sun.star.drawing.TextShape");
             return new TextBoxContext( *this, mrShapeModel.createTextBox(mrShape.getTypeModel()), rAttribs,
                 mrShape.getDrawing().getFilter().getGraphicHelper());
diff --git a/sw/qa/extras/ooxmlimport/data/fdo74401.docx b/sw/qa/extras/ooxmlimport/data/fdo74401.docx
new file mode 100644
index 0000000..fd3cbab
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo74401.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 87571c8..6943c4b 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2004,6 +2004,15 @@ DECLARE_OOXMLIMPORT_TEST(testFdo38414, "fdo38414.docx" )
     OUString height4 = parseDump("/root/page/body/tab/row[1]/cell[4]/infos/bounds", "height" );
     CPPUNIT_ASSERT_EQUAL( height3, height4 );
 }
+
+DECLARE_OOXMLIMPORT_TEST(testFdo74401, "fdo74401.docx")
+{
+    uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
+    uno::Reference<drawing::XShapeDescriptor> xShape(xGroupShape->getByIndex(1), uno::UNO_QUERY);
+    // The triangle (second child) was a TextShape before, so it was shown as a rectangle.
+    CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.CustomShape"), xShape->getShapeType());
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list