oox/source/drawingml/table/tablecell.cxx |    4 ++--
 sd/qa/unit/data/pptx/tdf149865.pptx      |binary
 sd/qa/unit/import-tests.cxx              |   22 ++++++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit 070682854800cb983b452a5b5bd16943433c4b2b
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Mon Sep 9 16:19:14 2024 +0200
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Wed Sep 11 12:28:06 2024 +0200

    tdf#149865 - FILEOPEN PPTX: fix table lacks border
    
    Fix wrong border line styles if we have merged cells.
    
    Change-Id: I238aa08c65b9aefd7b77b0f4ae3c3df979a7171d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173109
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>
    Tested-by: Jenkins

diff --git a/oox/source/drawingml/table/tablecell.cxx 
b/oox/source/drawingml/table/tablecell.cxx
index 2784ea818eb2..21948145e1d2 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -202,11 +202,11 @@ static void applyTableStylePart( const 
::oox::core::XmlFilterBase& rFilterBase,
     {
         if (nCol == 0)
             applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder );
-        if (nCol == nMaxCol)
+        if (nCol >= nMaxCol)
             applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder 
);
         if (nRow == 0)
             applyBorder( rFilterBase, rTableStylePart, XML_top, rTopBorder );
-        if (nRow == nMaxRow)
+        if (nRow >= nMaxRow)
             applyBorder( rFilterBase, rTableStylePart, XML_bottom, 
rBottomBorder );
 
         applyBorder( rFilterBase, rTableStylePart, XML_insideH, rInsideHBorder 
);
diff --git a/sd/qa/unit/data/pptx/tdf149865.pptx 
b/sd/qa/unit/data/pptx/tdf149865.pptx
new file mode 100644
index 000000000000..3b5a0cbb8f7a
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf149865.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 220bf3e30342..6e6cd651d3b9 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1653,6 +1653,28 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, 
testTableBorderLineStyle)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest, testTableMergedCellsBorderLineStyle)
+{
+    createSdImpressDoc("pptx/tdf149865.pptx");
+
+    const SdrPage* pPage = GetPage(1);
+
+    sdr::table::SdrTableObj* pTableObj;
+    uno::Reference<table::XCellRange> xTable;
+    uno::Reference<beans::XPropertySet> xCell;
+    table::BorderLine2 aBorderLine;
+
+    pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT(pTableObj);
+    xTable.set(pTableObj->getTable(), uno::UNO_QUERY_THROW);
+    xCell.set(xTable->getCellByPosition(4, 1), uno::UNO_QUERY_THROW);
+    xCell->getPropertyValue(u"RightBorder"_ustr) >>= aBorderLine;
+    table::BorderLine2 expectedRight(0x30ba78, 0, 17, 0, 0, 17);
+    CPPUNIT_ASSERT_EQUAL(expectedRight.LineStyle, aBorderLine.LineStyle);
+    CPPUNIT_ASSERT_EQUAL(expectedRight.Color, aBorderLine.Color);
+    CPPUNIT_ASSERT_EQUAL(expectedRight.LineWidth, aBorderLine.LineWidth);
+}
+
 CPPUNIT_TEST_FIXTURE(SdImportTest, testBnc862510_6)
 {
     // Black text was imported instead of gray

Reply via email to