[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/qa sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Tue May 7 21:03:47 PDT 2013


 sc/qa/unit/ucalc.cxx            |    9 +++++++--
 sc/source/core/data/column3.cxx |    9 +++++----
 2 files changed, 12 insertions(+), 6 deletions(-)

New commits:
commit beb36701ee8dd218523caeb5510792e5efe93f80
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed May 8 00:06:08 2013 -0400

    The same thing applies in reverse direction.
    
    Change-Id: I3f5863d79ad948461d63dbc9addc8ca01e1b275e

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index ffb2c47..d123a6c 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1653,8 +1653,13 @@ void Test::testCellBroadcaster()
     // While column A is still empty, move column A down 2 cells. This should
     // move the broadcaster from A1 to A3.
     m_pDoc->InsertRow(0, 0, 0, 0, 0, 2);
-    pBC = m_pDoc->GetBroadcaster(ScAddress(0,2,0));
-    CPPUNIT_ASSERT_MESSAGE("Broadcaster should exist in A3.", pBC);
+    CPPUNIT_ASSERT_MESSAGE("Broadcaster relocation failed.",
+                           broadcasterShifted(*m_pDoc, ScAddress(0,0,0), ScAddress(0,2,0)));
+
+    // Move it back while column A is still empty.
+    m_pDoc->DeleteRow(0, 0, 0, 0, 0, 2);
+    CPPUNIT_ASSERT_MESSAGE("Broadcaster relocation failed.",
+                           broadcasterShifted(*m_pDoc, ScAddress(0,2,0), ScAddress(0,0,0)));
 
     m_pDoc->DeleteTab(0);
 }
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 1c36346..9290e3a 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -164,8 +164,13 @@ void ScColumn::FreeAll()
 
 void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
 {
+    SCROW nEndRow = nStartRow + nSize - 1;
+
     pAttrArray->DeleteRow( nStartRow, nSize );
 
+    maBroadcasters.erase(nStartRow, nEndRow);
+    maBroadcasters.resize(MAXROWCOUNT);
+
     if ( maItems.empty() )
         return ;
 
@@ -178,12 +183,10 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
     pDocument->SetAutoCalc( false ); // Avoid calculating it multiple times
 
     bool bFound = false;
-    SCROW nEndRow = nStartRow + nSize - 1;
     SCSIZE nStartIndex = 0;
     SCSIZE nEndIndex = 0;
     SCSIZE i;
 
-    maBroadcasters.set_empty(nStartRow, nEndRow);
 
     for ( i = nFirstIndex; i < maItems.size() && maItems[i].nRow <= nEndRow; i++ )
     {
@@ -215,8 +218,6 @@ void ScColumn::DeleteRow( SCROW nStartRow, SCSIZE nSize )
     maTextWidths.resize(MAXROWCOUNT);
     maScriptTypes.erase(nStartRow, nEndRow);
     maScriptTypes.resize(MAXROWCOUNT);
-    maBroadcasters.erase(nStartRow, nEndRow);
-    maBroadcasters.resize(MAXROWCOUNT);
 
     ScAddress aAdr( nCol, 0, nTab );
     ScHint aHint( SC_HINT_DATACHANGED, aAdr, NULL ); // only areas (ScBaseCell* == NULL)


More information about the Libreoffice-commits mailing list