summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-03-19 09:59:32 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-19 10:06:38 +0100
commit81f9fe3a14f0fc99afbfa7ce3a26a9c7855d0919 (patch)
tree4dea4df2056ea35e66aecc1dd3537882cac88c5d
parent75122338eba5515786198b734d43577d727e3c67 (diff)
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
-rw-r--r--oox/source/vml/vmlshapecontext.cxx3
-rw-r--r--sw/qa/extras/ooxmlimport/data/fdo74401.docxbin0 -> 18425 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx9
3 files changed, 11 insertions, 1 deletions
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index d213815dd8f1..fe7e8ec7e3fe 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 000000000000..fd3cbabdd9d2
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/fdo74401.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 87571c81f9cc..6943c4b366d1 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();