diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-02-09 15:00:33 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-02-09 15:23:32 +0000 |
commit | d48b805794a6317e13826d52bbeaa37576ac57bb (patch) | |
tree | 8f1927139bdd0ff394d261ed3e7b3b26c7c45ed7 /sw/qa | |
parent | 60933220b2b6daa4b6acb177e4639c14519f459b (diff) |
tdf#105852: don't merge cells if there were no merge continuation
In RTF, it's possible to start a cells merge using \clmgf, and simply
omit following cells in the row - they must merge automatically.
This makes HorizontallyMergedCell::m_nLastCol/Row uninitialized.
Previously, the uninitialized values arrived as 0,0 - thus the first
range's cell got merged with cell 0,0.
This change prevents the merge; in scenario above, absence of additional
cells in row will create merged cell automatically.
Change-Id: I68b84b7ec70d9512c541a077689369fa4a8dc0c5
Reviewed-on: https://gerrit.libreoffice.org/34079
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/rtfimport/data/tdf105852.rtf | 50 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 14 |
2 files changed, 64 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf105852.rtf b/sw/qa/extras/rtfimport/data/tdf105852.rtf new file mode 100644 index 000000000000..bf3e073a2c8d --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf105852.rtf @@ -0,0 +1,50 @@ +{\rtf1\ansicpg1251 + +{\trowd +\cellx720 +\cellx6240 +\cellx7680 +\cellx9360 +A1\cell +A2\cell +A3\cell +A4\cell +\row} +{\trowd +\cellx720 +\cellx6240 +\cellx7680 +\cellx9360 +B1\cell +B2\cell +B3\cell +B4\cell +\row} +{\trowd +\clmgf\cellx9360 +C1\cell +\row} +{\trowd +\cellx720 +\cellx6240 +\cellx7680 +\cellx9360 +D1\cell +D2\cell +D3\cell +D4\cell +\row} +{\trowd +\clmgf\cellx9360 +E1\cell +\row} +{\trowd +\cellx720 +\cellx6240 +\cellx7680 +\cellx9360 +F1\cell +F2\cell +F3\cell +F4\cell +\row}\par}
\ No newline at end of file diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 63608a0efa5f..855b2da3967e 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2765,6 +2765,20 @@ DECLARE_RTFIMPORT_TEST(testTdf104744, "tdf104744.rtf") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); } +DECLARE_RTFIMPORT_TEST(testTdf105852, "tdf105852.rtf") +{ + 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); + // All rows but last were merged -> there were only 2 rows + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), xTableRows->getCount()); + // The first row must have 4 cells. + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength()); + // The third row must have 1 merged cell. + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(2), "TableColumnSeparators").getLength()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |