summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2021-11-30 11:59:55 +0100
committerLászló Németh <nemeth@numbertext.org>2022-01-03 13:37:29 +0100
commit87db920b141fe9846cbd1b37fff3a9806a9b5c2d (patch)
tree197004c5fe459965dce715c1a6afc7f6c2b79016 /sw
parentad51b6c85da5fd2e12130f453bcd5dbc8bf83f0e (diff)
tdf#98736 OOXML export: keep CaptionShape as TextShape
Caption shapes were lost during OOXML export. As a workaround, export them as text shapes, losing only the leader lines, but not their text shapes and text content. Change-Id: I372708fa4c9356c807a0a239c722691fd88ec1a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126123 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter4.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index fa9258949c07..0101e246a42d 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -290,6 +290,7 @@ public:
void testInsertPdf();
void testTdf143760WrapContourToOff();
void testTdf127989();
+ void testCaptionShape();
CPPUNIT_TEST_SUITE(SwUiWriterTest4);
CPPUNIT_TEST(testTdf96515);
@@ -413,6 +414,7 @@ public:
CPPUNIT_TEST(testInsertPdf);
CPPUNIT_TEST(testTdf143760WrapContourToOff);
CPPUNIT_TEST(testTdf127989);
+ CPPUNIT_TEST(testCaptionShape);
CPPUNIT_TEST_SUITE_END();
};
@@ -4067,6 +4069,27 @@ void SwUiWriterTest4::testTdf127989()
CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "FillBackground"));
}
+void SwUiWriterTest4::testCaptionShape()
+{
+ createSwDoc();
+
+ // Add a caption shape to the document.
+ uno::Reference<css::lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(
+ xFactory->createInstance("com.sun.star.drawing.CaptionShape"), uno::UNO_QUERY);
+ xShape->setSize(awt::Size(10000, 10000));
+ xShape->setPosition(awt::Point(1000, 1000));
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ xDrawPage->add(xShape);
+
+ // Save it as DOCX and load it again.
+ reload("Office Open XML Text", "captionshape.docx");
+
+ // Without fix in place, the shape was lost on export.
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4);
CPPUNIT_PLUGIN_IMPLEMENT();