summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-11-19 12:41:39 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-11-19 12:42:10 +0100
commitad913681c0e0cdaaa706329f518f59ee54b86d43 (patch)
treeb8557b2c7bdc960b607bb8082962151df2912b7b /sw
parent63cb9b5ee42c3e08e7fc29461487426af891c983 (diff)
n#780645 DOCX import: add support for fixed column width
In general, DOCX tables provide a grid for the table, then use spans in case different number of cells are used in different rows. In this case, the cell width is ignored, as the wished width can be counted from the grid and span values. However, it's also valid to simply provide more cells then the amount defined by the grid, and in this case the cell width should decide the final width of the cells. This commit adds support for this later case. Change-Id: I0dd6c1f0c06f81c2afa00489b7ad1f33ff300a7c
Diffstat (limited to 'sw')
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/n780645.docxbin0 -> 4001 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx13
2 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/n780645.docx b/sw/qa/extras/ooxmlimport/data/n780645.docx
new file mode 100755
index 000000000000..12ffa3870130
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/n780645.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2c98832414be..36fdba3e367a 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -107,6 +107,7 @@ public:
void testFdo52208();
void testN785767();
void testN773061();
+ void testN780645();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -167,6 +168,7 @@ void Test::run()
{"fdo52208.docx", &Test::testFdo52208},
{"n785767.docx", &Test::testN785767},
{"n773061.docx", &Test::testN773061},
+ {"n780645.docx", &Test::testN780645},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
@@ -1030,6 +1032,17 @@ void Test::testN773061()
CPPUNIT_ASSERT_EQUAL( getProperty< sal_Int32 >( xFrame, "BottomBorderDistance" ), sal_Int32( 0 ));
}
+void Test::testN780645()
+{
+ // The problem was that when the number of cells didn't match the grid, we
+ // didn't take care of direct cell widths.
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<table::XTableRows> xTableRows(xTextTable->getRows(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(2135), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); // was 1999
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();