diff options
author | Bakos Attila <bakos.attilakaroly@nisz.hu> | 2019-10-28 14:03:11 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-11-04 09:48:37 +0100 |
commit | 44e44239de35c1548809c96e13bfa9d64c7ca441 (patch) | |
tree | 11bca5409e5d68ff38e27b88bbac8cbd8dbeefe6 | |
parent | f9fb1e1abc2f6326e3c495e11eca7d64f8fdfc27 (diff) |
tdf#120315 DOCX import: fix cells merged vertically
Due to rounding mistake cells weren't merged vertically,
when their horizontal positions are different a little bit.
Change-Id: I10623719a3759b35fcd04b154590b8ac6ec3ac45
Reviewed-on: https://gerrit.libreoffice.org/81604
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf120315.docx | bin | 0 -> 12276 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 18 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 7 |
3 files changed, 21 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf120315.docx b/sw/qa/extras/ooxmlexport/data/tdf120315.docx Binary files differnew file mode 100644 index 000000000000..d3943ea0b291 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf120315.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index ceee45bc9bc1..93d896837a36 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -14,6 +14,7 @@ #include <editsh.hxx> #include <frmatr.hxx> +#include <com/sun/star/text/TableColumnSeparator.hpp> class Test : public SwModelTestBase { @@ -31,6 +32,23 @@ protected: }; +DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx") +{ + // tdf#120315 cells of the second column weren't vertically merged + // because their horizontal positions are different a little bit + 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(); + CPPUNIT_ASSERT_EQUAL(getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(0), "TableColumnSeparators")[0] + .Position, + getProperty<uno::Sequence<text::TableColumnSeparator>>( + xTableRows->getByIndex(1), "TableColumnSeparators")[2] + .Position); +} + DECLARE_OOXMLEXPORT_TEST(testTdf108350_noFontdefaults, "tdf108350_noFontdefaults.docx") { uno::Reference< container::XNameAccess > paragraphStyles = getStyles("ParagraphStyles"); diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index 6adbcdc075f7..e09dd45f1642 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -650,7 +650,7 @@ void DomainMapperTableManager::endOfRowAction() } uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 ); text::TableColumnSeparator* pSeparators = aSeparators.getArray(); - sal_Int16 nLastRelPos = 0; + double nLastRelPos = 0.0; sal_uInt32 nBorderGridIndex = m_nGridBefore; size_t nWidthsBound = m_nCell.back( ) - 1; @@ -666,10 +666,9 @@ void DomainMapperTableManager::endOfRowAction() for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount ) fGridWidth += (*pTableGrid)[nBorderGridIndex++]; - sal_Int16 nRelPos = - sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative); + double nRelPos = static_cast<double>((fGridWidth * 10000) / nFullWidthRelative); - pSeparators[nBorder].Position = nRelPos + nLastRelPos; + pSeparators[nBorder].Position = sal::static_int_cast< sal_Int16 >( nRelPos + nLastRelPos ); pSeparators[nBorder].IsVisible = true; nLastRelPos = nLastRelPos + nRelPos; ++aSpansIter; |