[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 6 10:25:16 UTC 2021
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 | 6 ++++--
writerfilter/source/dmapper/TableManager.hxx | 2 +-
5 files changed, 22 insertions(+), 5 deletions(-)
New commits:
commit 7e0814991c898371496c382619cc711e6333e827
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Fri Jul 17 14:39:45 2020 +0200
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Jan 6 11:24:43 2021 +0100
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)
Change-Id: If332305d54ff2b34b258270a607fb31ff7380149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98973
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit abea0d6647c7f1f7e76c73c26cb80e6a67dc5111)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108854
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at 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 aa48934b8f64..63b950abf0f7 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3208,6 +3208,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");
+ xmlDocUniquePtr 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 e16c890783dd..dbbe0d31c31a 100644
--- a/writerfilter/source/dmapper/TableData.hxx
+++ b/writerfilter/source/dmapper/TableData.hxx
@@ -250,10 +250,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 582b4d4705a6..b94096665a29 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() {}
@@ -472,6 +472,8 @@ void TableManager::endRow()
{
// don't add gridBefore cells in not valid TextRange
setCurrentGridBefore(0);
+ setCurrentGridSpan(getCurrentGridSpans().front() + nGridBefore,
+ /*bFirstCell=*/true);
}
}
}
diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx
index d1c6ee431bc8..caf33597a206 100644
--- a/writerfilter/source/dmapper/TableManager.hxx
+++ b/writerfilter/source/dmapper/TableManager.hxx
@@ -503,7 +503,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);
More information about the Libreoffice-commits
mailing list