summaryrefslogtreecommitdiff
path: root/oox/qa/unit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-03-02 20:23:04 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-03-03 07:57:05 +0100
commit198685ded79d64b21023ee85e9a15fa1b32705a0 (patch)
tree800dd6e517a641aac2531704f750c210ee129abf /oox/qa/unit
parent45bd7006ccf807b2cfe432e6143593e9ec3dbdac (diff)
tdf#84399 VML import: map <v:shape o:spt="202"> to TextShape
This partially reverts commit 81f9fe3a14f0fc99afbfa7ce3a26a9c7855d0919 (fdo#74401 VML groupshape import: only handle v:rect as TextShape, 2014-03-19), which wanted to map triangles to custom shapes. It was overlooked that we can have not only explicit rectangles and custom shapes, but also <v:shape> elements which have their shape type explicitly set to TextBox. The later is now again handled similar to rectangles. This keeps the triangle case working, but fixes the <v:shape o:spt="202"> case. We need to make this decision while parsing the XML, so some rework is needed to have earlier access to its container (group shape or draw page) and also to its shape type. Change-Id: I33a4b3cd03b0df5d93cffa19e7ea834113df2bdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89852 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/qa/unit')
-rw-r--r--oox/qa/unit/data/group-spt202.docxbin0 -> 28238 bytes
-rw-r--r--oox/qa/unit/vml.cxx19
2 files changed, 19 insertions, 0 deletions
diff --git a/oox/qa/unit/data/group-spt202.docx b/oox/qa/unit/data/group-spt202.docx
new file mode 100644
index 000000000000..14bf00b50ed5
--- /dev/null
+++ b/oox/qa/unit/data/group-spt202.docx
Binary files differ
diff --git a/oox/qa/unit/vml.cxx b/oox/qa/unit/vml.cxx
index 833fc449d84c..b27876426956 100644
--- a/oox/qa/unit/vml.cxx
+++ b/oox/qa/unit/vml.cxx
@@ -72,6 +72,25 @@ CPPUNIT_TEST_FIXTURE(OoxVmlTest, testLayoutFlowAltAlone)
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, nWritingMode);
}
+CPPUNIT_TEST_FIXTURE(OoxVmlTest, testSpt202ShapeType)
+{
+ // Load a document with a groupshape, 2nd child is a <v:shape>, its type has o:spt set to 202
+ // (TextBox).
+ load("group-spt202.docx");
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xGroup(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(1), uno::UNO_QUERY);
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: com.sun.star.drawing.TextShape
+ // - Actual : com.sun.star.drawing.CustomShape
+ // and then the size of the group shape was incorrect, e.g. its right edge was outside the page
+ // boundaries.
+ CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.TextShape"), xShape->getShapeType());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */