diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-09-03 15:23:46 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-09-03 17:03:26 +0200 |
commit | d74f44882336226990a290eaaf37f7b477c98777 (patch) | |
tree | 0e3945657ce1bf09aa8c93c3328271d700d9cdc4 /sw | |
parent | 6bf4fac3759a4fb986382b032efbb22aa8c23175 (diff) |
bnc#816593 DOCX import: fix auto table width wrt nested tables
This is a backport of the fix + 3 other commits from master, which were
needed to make the testcase pass on -4-1 as well.
(cherry picked from commits 74c5ed19f430327988194cdcd6bdff09591a93fa,
824cc4bf4ae9035d4108e8da8e81eb57284f0b54,
53d27a30ce5f2c9f7d37a4089286116854c16215 and
76d1ca523ddcf89cc269fe51c70e66066943ef5a)
Change-Id: I62a1f526cf1d4e4056daa1495d61f1b9f5c0b1b2
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
writerfilter/source/dmapper/DomainMapperTableManager.cxx
Diffstat (limited to 'sw')
-rwxr-xr-x | sw/qa/extras/ooxmlimport/data/table-auto-nested.docx | bin | 0 -> 10297 bytes | |||
-rwxr-xr-x | sw/qa/extras/ooxmlimport/data/table-floating.docx | bin | 0 -> 14996 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 32 |
3 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/table-auto-nested.docx b/sw/qa/extras/ooxmlimport/data/table-auto-nested.docx Binary files differnew file mode 100755 index 000000000000..85f47dbba0b3 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/table-auto-nested.docx diff --git a/sw/qa/extras/ooxmlimport/data/table-floating.docx b/sw/qa/extras/ooxmlimport/data/table-floating.docx Binary files differnew file mode 100755 index 000000000000..1e0cb30ece49 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/table-floating.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 34635419ba19..bbdb706b4751 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -130,6 +130,8 @@ public: void testTableAutoColumnFixedSize(); void testFdo66474(); void testBnc780044Spacing(); + void testTableFloating(); + void testTableAutoNested(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -209,6 +211,8 @@ void Test::run() {"table-auto-column-fixed-size.docx", &Test::testTableAutoColumnFixedSize}, {"fdo66474.docx", &Test::testFdo66474}, {"bnc780044_spacing.docx", &Test::testBnc780044Spacing}, + {"table-floating.docx", &Test::testTableFloating}, + {"table-auto-nested.docx", &Test::testTableAutoNested}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1306,6 +1310,34 @@ void Test::testBnc780044Spacing() CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage()); } +void Test::testTableFloating() +{ + // Both the size and the position of the table was incorrect. + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + // Second table was too wide: 16249, i.e. as wide as the first table. + CPPUNIT_ASSERT_EQUAL(sal_Int32(11248), getProperty<sal_Int32>(xTables->getByIndex(1), "Width")); + + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + // This was 0, should be the the opposite of (left margin + half of the border width). + CPPUNIT_ASSERT_EQUAL(sal_Int32(-199), getProperty<sal_Int32>(xFrame, "HoriOrientPosition")); + // Was 0 as well, should be the right margin. + CPPUNIT_ASSERT_EQUAL(sal_Int32(191), getProperty<sal_Int32>(xFrame, "RightMargin")); +} + +void Test::testTableAutoNested() +{ + // This was 176, when compat option is not enabled, the auto paragraph bottom margin value was incorrect. + CPPUNIT_ASSERT_EQUAL(sal_Int32(494), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin")); + + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + // This was 115596, i.e. the width of the outer table was too large. + CPPUNIT_ASSERT_EQUAL(sal_Int32(23051), getProperty<sal_Int32>(xTables->getByIndex(1), "Width")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |