sw/qa/extras/layout/data/tdf134685.docx |binary sw/qa/extras/layout/layout.cxx | 10 ++++++++++ writerfilter/source/dmapper/TableData.hxx | 9 +++++++-- writerfilter/source/dmapper/TableManager.cxx | 7 ++++--- writerfilter/source/dmapper/TableManager.hxx | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-)
New commits: commit 08796e1dfc34c8c17970bf3d7b360f57ce582f06 Author: László Németh <nem...@numbertext.org> AuthorDate: Fri Jul 17 14:39:45 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Tue Aug 11 21:49:59 2020 +0200 tdf#134685 DOCX table import: fix gridBefore + cell width Improve workaround to handle nested tables started at cell start in a row with gridBefore. Omitted gridBefore cells from commit 5483d4e10aad27889b961b9cb94d7ba6c86aed0b (tdf#134606 DOCX table import: fix gridBefore + nesting) resulted less cells in the row than defined by the grid, and the different code path could lead to narrow cell width with partially invisible nested table. Fix this by adding gridBefore cell count to the cell span in the first cell. Regression from commit 70274f86cdc1c023ffdd0130c262c1479262d76b (tdf#116194 DOCX import: fix missing tables with w:gridBefore) Conflicts: sw/qa/extras/layout/layout.cxx writerfilter/source/dmapper/TableManager.hxx (cherry-picked from commit abea0d6647c7f1f7e76c73c26cb80e6a67dc5111) Change-Id: If332305d54ff2b34b258270a607fb31ff7380149 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98973 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100476 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/sw/qa/extras/layout/data/tdf134685.docx b/sw/qa/extras/layout/data/tdf134685.docx new file mode 100644 index 000000000000..86b59fa982f3 Binary files /dev/null and b/sw/qa/extras/layout/data/tdf134685.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index f109a809355e..67ad3cb16343 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2941,6 +2941,16 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf127606) assertXPath(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]/Special", "nHeight", "260"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf134685) +{ + createDoc("tdf134685.docx"); + xmlDocPtr pXmlDoc = parseLayoutDump(); + sal_Int32 nWidth + = getXPath(pXmlDoc, "/root/page/body/tab/row[6]/cell[1]/infos/bounds", "width").toInt32(); + // This was 2223: the content was only partially visible according to the lost cell width + CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(14000), nWidth); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109077) { createDoc("tdf109077.docx"); diff --git a/writerfilter/source/dmapper/TableData.hxx b/writerfilter/source/dmapper/TableData.hxx index 14fedc66fba8..1632696bceb6 100644 --- a/writerfilter/source/dmapper/TableData.hxx +++ b/writerfilter/source/dmapper/TableData.hxx @@ -249,10 +249,15 @@ public: nRet.push_back(aCell->getGridSpan()); return nRet; } - void setCurrentGridSpan(sal_uInt32 nSpan) + void setCurrentGridSpan(sal_uInt32 nSpan, bool bFirstCell = false) { if ( mCells.size() ) - mCells.back()->setGridSpan(nSpan); + { + if ( bFirstCell ) + mCells.front()->setGridSpan(nSpan); + else + mCells.back()->setGridSpan(nSpan); + } } }; diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx index 596d036a506a..678092a15280 100644 --- a/writerfilter/source/dmapper/TableManager.cxx +++ b/writerfilter/source/dmapper/TableManager.cxx @@ -64,9 +64,9 @@ std::vector<sal_uInt32> TableManager::getCurrentGridSpans() return mTableDataStack.top()->getCurrentRow()->getGridSpans(); } -void TableManager::setCurrentGridSpan(sal_uInt32 nGridSpan) +void TableManager::setCurrentGridSpan(sal_uInt32 nGridSpan, bool bFirstCell) { - mTableDataStack.top()->getCurrentRow()->setCurrentGridSpan(nGridSpan); + mTableDataStack.top()->getCurrentRow()->setCurrentGridSpan(nGridSpan, bFirstCell); } void TableManager::endOfRowAction() {} @@ -456,6 +456,8 @@ void TableManager::endRow() { // don't add gridBefore cells in not valid TextRange setCurrentGridBefore(0); + setCurrentGridSpan(getCurrentGridSpans().front() + nGridBefore, + /*bFirstCell=*/true); } } } @@ -518,7 +520,6 @@ TableManager::TableManager() TableManager::~TableManager() = default; } - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx index efac7afdbd7c..f06f06b0cd72 100644 --- a/writerfilter/source/dmapper/TableManager.hxx +++ b/writerfilter/source/dmapper/TableManager.hxx @@ -470,7 +470,7 @@ public: sal_uInt32 getCurrentGridBefore(); void setCurrentGridBefore( sal_uInt32 nSkipGrids ); std::vector<sal_uInt32> getCurrentGridSpans(); - void setCurrentGridSpan( sal_uInt32 nGridSpan ); + void setCurrentGridSpan( sal_uInt32 nGridSpan, bool bFirstCell = false ); void setTableStartsAtCellStart(bool bTableStartsAtCellStart); void setCellLastParaAfterAutospacing(bool bIsAfterAutospacing); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits