oox/source/export/shapes.cxx | 4 ++-- sd/qa/unit/data/odp/cellspan.odp |binary sd/qa/unit/export-tests.cxx | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-)
New commits: commit 0381026924947c6164d1eebe7395c91f619965ce Author: Mark Hung <[email protected]> Date: Thu Jun 2 01:45:55 2016 +0800 tdf#100179 correct cell merging in pptx. Change-Id: I7a5bc6fb33c64d1ff398986eff5b960fe037df4d Reviewed-on: https://gerrit.libreoffice.org/25791 Tested-by: Jenkins <[email protected]> Reviewed-by: Mark Hung <[email protected]> diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index e389fc6..8d63d2c 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1321,7 +1321,7 @@ void ShapeExport::WriteTable( const Reference< XShape >& rXShape ) // having : horizontal merge mpFS->startElementNS(XML_a, XML_tc, XML_gridSpan, I32S(xCell->getColumnSpan()), FSEND); - for(sal_Int32 columnIndex = nColumn; columnIndex < xCell->getColumnSpan(); ++columnIndex) { + for(sal_Int32 columnIndex = nColumn; columnIndex < nColumn + xCell->getColumnSpan(); ++columnIndex) { sal_Int32 transposeIndexForMergeCell = (nRow*nColumnCount) + columnIndex; mergedCellMap[transposeIndexForMergeCell] = std::make_pair(transposedIndexofCell, xCell); @@ -1333,7 +1333,7 @@ void ShapeExport::WriteTable( const Reference< XShape >& rXShape ) mpFS->startElementNS(XML_a, XML_tc, XML_rowSpan, I32S(xCell->getRowSpan()), FSEND); - for(sal_Int32 rowIndex = nRow; rowIndex < xCell->getRowSpan(); ++rowIndex) { + for(sal_Int32 rowIndex = nRow; rowIndex < nRow + xCell->getRowSpan(); ++rowIndex) { sal_Int32 transposeIndexForMergeCell = (rowIndex*nColumnCount) + nColumn; mergedCellMap[transposeIndexForMergeCell] = std::make_pair(transposedIndexofCell, xCell); diff --git a/sd/qa/unit/data/odp/cellspan.odp b/sd/qa/unit/data/odp/cellspan.odp new file mode 100755 index 0000000..775e1e4 Binary files /dev/null and b/sd/qa/unit/data/odp/cellspan.odp differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index a2c3be2..5d79439 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -128,6 +128,7 @@ public: void testCellLeftAndRightMargin(); void testRightToLeftParaghraph(); void testTextboxWithHyperlink(); + void testMergedCells(); void testTableCellBorder(); void testBulletColor(); void testTdf62176(); @@ -185,6 +186,7 @@ public: CPPUNIT_TEST(testCellLeftAndRightMargin); CPPUNIT_TEST(testRightToLeftParaghraph); CPPUNIT_TEST(testTextboxWithHyperlink); + CPPUNIT_TEST(testMergedCells); CPPUNIT_TEST(testTableCellBorder); CPPUNIT_TEST(testBulletColor); CPPUNIT_TEST(testTdf62176); @@ -1356,6 +1358,23 @@ void SdExportTest::testCellLeftAndRightMargin() xDocShRef->DoClose(); } +void SdExportTest::testMergedCells() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/cellspan.odp"), ODP); + xDocShRef = saveAndReload( xDocShRef, PPTX ); + const SdrPage *pPage = GetPage( 1, xDocShRef ); + + sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0)); + + CPPUNIT_ASSERT( pTableObj ); + uno::Reference< table::XTable > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW); + uno::Reference< text::XTextRange > xText1(xTable->getCellByPosition(3, 0), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL( OUString("0,3"), xText1->getString() ); + + uno::Reference< text::XTextRange > xText2(xTable->getCellByPosition(3, 2), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL( OUString("2,3"), xText2->getString() ); +} + void SdExportTest::testTableCellBorder() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/n90190.pptx"), PPTX); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
