Kaydet (Commit) 2d6f8c36 authored tarafından Patrick Jaap's avatar Patrick Jaap Kaydeden (comit) Miklos Vajna

FIX: DOCX export: use all updated attributes during table export

In a previous commit only x/y coordinate were considered.

For better overview make use of the OOXML converter for orients and relations.

Change-Id: I9792ccfbc2ebb58fd768c14278cdfd9b54efe62f
Reviewed-on: https://gerrit.libreoffice.org/69523
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 22d79472
......@@ -71,6 +71,7 @@ public:
void testDropDownFormFieldInsertion();
void testMixedFormFieldInsertion();
void testTdf124261();
void testDocxAttributeTableExport();
CPPUNIT_TEST_SUITE(SwUiWriterTest2);
CPPUNIT_TEST(testRedlineMoveInsertInDelete);
......@@ -100,6 +101,7 @@ public:
CPPUNIT_TEST(testDropDownFormFieldInsertion);
CPPUNIT_TEST(testMixedFormFieldInsertion);
CPPUNIT_TEST(testTdf124261);
CPPUNIT_TEST(testDocxAttributeTableExport);
CPPUNIT_TEST_SUITE_END();
virtual std::unique_ptr<Resetter> preTest(const char* filename) override
......@@ -1158,6 +1160,45 @@ void SwUiWriterTest2::testTdf124261()
#endif
}
void SwUiWriterTest2::testDocxAttributeTableExport()
{
createDoc("floating-table-position.docx");
// get the table frame, set new values and dismiss the references
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(),
uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
// change the properties
// 8133 -> 8000
xShape->setPropertyValue("VertOrientPosition", uno::makeAny(static_cast<sal_Int32>(8000)));
// 5964 -> 5000
xShape->setPropertyValue("HoriOrientPosition", uno::makeAny(static_cast<sal_Int32>(5000)));
// 0 (frame) -> 8 (page print area)
xShape->setPropertyValue("VertOrientRelation", uno::makeAny(static_cast<sal_Int16>(8)));
// 8 (page print area) -> 0 (frame)
xShape->setPropertyValue("HoriOrientRelation", uno::makeAny(static_cast<sal_Int16>(0)));
}
// save it to docx
reload("Office Open XML Text", "floating-table-position.docx");
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(),
uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
// test the new values
sal_Int32 nValue = getProperty<sal_Int32>(xShape, "VertOrientPosition");
CPPUNIT_ASSERT(sal_Int32(7999) <= nValue && nValue <= sal_Int32(8001));
nValue = getProperty<sal_Int32>(xShape, "HoriOrientPosition");
CPPUNIT_ASSERT(sal_Int32(4999) <= nValue && nValue <= sal_Int32(5001));
CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xShape, "VertOrientRelation"));
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xShape, "HoriOrientRelation"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment