[Libreoffice-commits] core.git: sw/qa writerfilter/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 19:12:24 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx                  |    3 +++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx   |    6 ++++--
 3 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 19ffc31ac047e9e8986591937ad945bc7dc2b875
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Tue Jul 7 10:36:12 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Wed Jul 15 21:11:33 2020 +0200

    tdf129452 writerfilter: only affect vertical Merge_restart
    
    If multiple merged cells are stacked on top of each other,
    then don't follow the whole stack down to the bottom as
    if it is one cell. In other words, merged-vertically is
    not true or false, but start or continuing.
    
    This stand-alone patch covers a corner case missed
    by this bug's earlier LO 6.4 commit.
    
    Change-Id: Ibaec6d609ff5b8a993be8dce0741fa2ca905da26
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98242
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx
index 0e8ddd6d3833..399c06be1a30 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx and b/sw/qa/extras/ooxmlexport/data/tdf129452_BottomBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index c32928cccdf2..99c908351898 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1059,6 +1059,9 @@ DECLARE_OOXMLEXPORT_TEST(testBottomBorders, "tdf129452_BottomBorders.docx")
 
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[1]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0);
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[4]/w:tc[2]/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 0);
+
+    // But also don't treat separately merged cells as one - the topmost merged cell shouldn't gain a border.
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[4]/w:tcPr/w:tcBorders/w:bottom", 0);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFontTypes, "tdf120344_FontTypes.docx")
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 901fdfc0c115..2046d36db613 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -907,7 +907,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
 
                 // tdf#129452 Checking if current cell is vertically merged with all the other cells below to the bottom.
                 // This must be done in order to apply the bottom border of the table to the first cell in a vertical merge.
-                bool bMergedVertically = bool(m_aCellProperties[nRow][nCell]->getProperty(PROP_VERTICAL_MERGE));
+                std::optional<PropertyMap::Property> oProp = m_aCellProperties[nRow][nCell]->getProperty(PROP_VERTICAL_MERGE);
+                bool bMergedVertically = oProp && oProp->second.get<bool>();  // starting cell
                 if ( bMergedVertically )
                 {
                     const sal_uInt32 nColumn = m_rDMapper_Impl.getTableManager().findColumn(nRow, nCell);
@@ -916,7 +917,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
                         const sal_uInt32 nColumnCell = m_rDMapper_Impl.getTableManager().findColumnCell(i, nColumn);
                         if ( m_aCellProperties[i].size() > sal::static_int_cast<std::size_t>(nColumnCell) )
                         {
-                            bMergedVertically = bool(m_aCellProperties[i][nColumnCell]->getProperty(PROP_VERTICAL_MERGE));
+                            oProp = m_aCellProperties[i][nColumnCell]->getProperty(PROP_VERTICAL_MERGE);
+                            bMergedVertically = oProp && !oProp->second.get<bool>(); //continuing cell
                         }
                         else
                             bMergedVertically = false;


More information about the Libreoffice-commits mailing list