[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sd/qa svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 2 09:51:18 UTC 2018


 sd/qa/unit/data/pptx/tdf119015.pptx  |binary
 sd/qa/unit/import-tests.cxx          |   24 ++++++++++++++++++++++++
 svx/source/table/cellcursor.cxx      |    1 -
 svx/source/table/tablecontroller.cxx |    1 +
 4 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 77419fecba82acde2e169dbfc49ff559213b886f
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jul 31 15:25:18 2018 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Thu Aug 2 11:50:53 2018 +0200

    tdf#119015: don't call TableModel::optimize in CellCursor::merge()
    
    Better do that explicitly in the SvxTableController::MergeRange, so
    that the UI-driven operation still optimizes the table, but import
    code gets the initial column count, and not throw trying to access
    the deleted column.
    
    Change-Id: Ib4b4d716935ec2036ccb839c36f1be5b0cb878d5
    Reviewed-on: https://gerrit.libreoffice.org/58359
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/58371
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sd/qa/unit/data/pptx/tdf119015.pptx b/sd/qa/unit/data/pptx/tdf119015.pptx
new file mode 100644
index 000000000000..8c2313ad9b27
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf119015.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 24c7ea345aa7..f8ead710e9bf 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -177,6 +177,7 @@ public:
 
     bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
     void testPatternImport();
+    void testTdf119015();
 
     CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -253,6 +254,7 @@ public:
     CPPUNIT_TEST(testTdf116899);
     CPPUNIT_TEST(testTdf116266);
     CPPUNIT_TEST(testTdf114821);
+    CPPUNIT_TEST(testTdf119015);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2448,6 +2450,28 @@ void SdImportTest::testTdf116266()
     CPPUNIT_ASSERT_EQUAL(size_t(1), rLinkManager->GetLinks().size());
 }
 
+void SdImportTest::testTdf119015()
+{
+    ::sd::DrawDocShellRef xDocShRef
+        = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf119015.pptx"), PPTX);
+
+    const SdrPage* pPage = GetPage(1, xDocShRef);
+
+    sdr::table::SdrTableObj* pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT(pTableObj);
+    // The position was previously not properly initialized: (0, 0, 100, 100)
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(6991, 6902), Size(14099, 1999)),
+                         pTableObj->GetLogicRect());
+    uno::Reference<table::XTable> xTable(pTableObj->getTable());
+
+    // Test that we actually have three cells: this threw css.lang.IndexOutOfBoundsException
+    uno::Reference<text::XTextRange> xTextRange(xTable->getCellByPosition(2, 0),
+                                                uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL(OUString("A3"), xTextRange->getString());
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx
index db68fdb61ab4..2b12292d42cc 100644
--- a/svx/source/table/cellcursor.cxx
+++ b/svx/source/table/cellcursor.cxx
@@ -251,7 +251,6 @@ void SAL_CALL CellCursor::merge(  )
     try
     {
         mxTable->merge( aStart.mnCol, aStart.mnRow, aEnd.mnCol - aStart.mnCol + 1, aEnd.mnRow - aStart.mnRow + 1 );
-        mxTable->optimize();
         mxTable->setModified(true);
     }
     catch( Exception& )
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 6649ba4df9b4..2135362e429c 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1807,6 +1807,7 @@ void SvxTableController::MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, s
             }
 
             xRange->merge();
+            mxTable->optimize();
 
             if( bUndo )
                 mpModel->EndUndo();


More information about the Libreoffice-commits mailing list