sw/qa/extras/ooxmlexport/data/tdf120315.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 18 +++++++++++++++ writerfilter/source/dmapper/DomainMapperTableManager.cxx | 7 ++--- 3 files changed, 21 insertions(+), 4 deletions(-)
New commits: commit 44e44239de35c1548809c96e13bfa9d64c7ca441 Author: Bakos Attila <bakos.attilakar...@nisz.hu> AuthorDate: Mon Oct 28 14:03:11 2019 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Nov 4 09:48:37 2019 +0100 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 <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf120315.docx b/sw/qa/extras/ooxmlexport/data/tdf120315.docx new file mode 100644 index 000000000000..d3943ea0b291 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf120315.docx differ 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits