[Libreoffice-commits] core.git: sc/inc sc/source

Caolán McNamara caolanm at redhat.com
Mon Jul 4 19:32:18 UTC 2016


 sc/inc/column.hxx                |    4 ++--
 sc/inc/table.hxx                 |    4 ++--
 sc/source/core/data/column2.cxx  |   18 +++++++++---------
 sc/source/core/data/documen7.cxx |    4 ++--
 sc/source/core/data/table5.cxx   |   12 ++++++------
 5 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 2511e272481172b439d167fd8b09d14c755f223d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 21 14:47:22 2016 +0100

    Resolves: tdf#90285 during sheet copying the old sheets retain their old index
    
    at the point that ScDocument::CopyTab calls StartListeners so when
    
    void ScColumn::StartListening(sc::StartListeningContext& rCxt...
    
    calls rCxt.getBlockPosition(nTab) it calls it with the old nTab index
    in ScDocument::maTabs, so the return block position is not correct.
    
    Here I bubble down the requested ScAddress and use its Tab/Col/Row
    members rather than trust the members of the indexed-into elements
    
    Change-Id: I291e8c1146c2caa4d0976780b1ee6bcc41994e3c
    Reviewed-on: https://gerrit.libreoffice.org/26552
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 68fb09c..6114968 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -528,8 +528,8 @@ public:
 
     void        StartListening( SvtListener& rLst, SCROW nRow );
     void        EndListening( SvtListener& rLst, SCROW nRow );
-    void StartListening( sc::StartListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
-    void EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
+    void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
+    void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
     void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
     void        SetDirtyIfPostponed();
     void BroadcastRecalcOnRefMove();
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 0f0887e..0450f6b 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -1084,8 +1084,8 @@ private:
 
     void        StartListening( const ScAddress& rAddress, SvtListener* pListener );
     void        EndListening( const ScAddress& rAddress, SvtListener* pListener );
-    void StartListening( sc::StartListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
-    void EndListening( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener );
+    void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
+    void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
 
     void AttachFormulaCells( sc::StartListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
     void DetachFormulaCells( sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 7565a1a..d3ed5e4 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2999,29 +2999,29 @@ void ScColumn::EndListening( SvtListener& rLst, SCROW nRow )
         maBroadcasters.set_empty(nRow, nRow);
 }
 
-void ScColumn::StartListening( sc::StartListeningContext& rCxt, SCROW nRow, SvtListener& rLst )
+void ScColumn::StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rLst )
 {
-    if (!ValidRow(nRow))
+    if (!ValidRow(rAddress.Row()))
         return;
 
-    sc::ColumnBlockPosition* p = rCxt.getBlockPosition(nTab, nCol);
+    sc::ColumnBlockPosition* p = rCxt.getBlockPosition(rAddress.Tab(), rAddress.Col());
     if (!p)
         return;
 
     sc::BroadcasterStoreType::iterator& it = p->miBroadcasterPos;
-    std::pair<sc::BroadcasterStoreType::iterator,size_t> aPos = maBroadcasters.position(it, nRow);
+    std::pair<sc::BroadcasterStoreType::iterator,size_t> aPos = maBroadcasters.position(it, rAddress.Row());
     it = aPos.first; // store the block position for next iteration.
-    startListening(maBroadcasters, it, aPos.second, nRow, rLst);
+    startListening(maBroadcasters, it, aPos.second, rAddress.Row(), rLst);
 }
 
-void ScColumn::EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListener& rListener )
+void ScColumn::EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener )
 {
-    sc::ColumnBlockPosition* p = rCxt.getBlockPosition(nTab, nCol);
+    sc::ColumnBlockPosition* p = rCxt.getBlockPosition(rAddress.Tab(), rAddress.Col());
     if (!p)
         return;
 
     sc::BroadcasterStoreType::iterator& it = p->miBroadcasterPos;
-    std::pair<sc::BroadcasterStoreType::iterator,size_t> aPos = maBroadcasters.position(it, nRow);
+    std::pair<sc::BroadcasterStoreType::iterator,size_t> aPos = maBroadcasters.position(it, rAddress.Row());
     it = aPos.first; // store the block position for next iteration.
     if (it->type != sc::element_type_broadcaster)
         return;
@@ -3032,7 +3032,7 @@ void ScColumn::EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListe
     rListener.EndListening(*pBC);
     if (!pBC->HasListeners())
         // There is no more listeners for this cell. Add it to the purge list for later purging.
-        rCxt.addEmptyBroadcasterPosition(nTab, nCol, nRow);
+        rCxt.addEmptyBroadcasterPosition(rAddress.Tab(), rAddress.Col(), rAddress.Row());
 }
 
 namespace {
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 7e86b37..d956ba4 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -263,7 +263,7 @@ void ScDocument::StartListeningCell(
     if (!pTab)
         return;
 
-    pTab->StartListening(rCxt, rPos.Col(), rPos.Row(), rListener);
+    pTab->StartListening(rCxt, rPos, rListener);
 }
 
 void ScDocument::EndListeningCell(
@@ -273,7 +273,7 @@ void ScDocument::EndListeningCell(
     if (!pTab)
         return;
 
-    pTab->EndListening(rCxt, rPos.Col(), rPos.Row(), rListener);
+    pTab->EndListening(rCxt, rPos, rListener);
 }
 
 void ScDocument::EndListeningFormulaCells( std::vector<ScFormulaCell*>& rCells )
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 6a2f060..2ae8872 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1099,20 +1099,20 @@ void ScTable::EndListening( const ScAddress& rAddress, SvtListener* pListener )
     aCol[rAddress.Col()].EndListening( *pListener, rAddress.Row() );
 }
 
-void ScTable::StartListening( sc::StartListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener )
+void ScTable::StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener )
 {
-    if (!ValidCol(nCol))
+    if (!ValidCol(rAddress.Col()))
         return;
 
-    aCol[nCol].StartListening(rCxt, nRow, rListener);
+    aCol[rAddress.Col()].StartListening(rCxt, rAddress, rListener);
 }
 
-void ScTable::EndListening( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, SvtListener& rListener )
+void ScTable::EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener )
 {
-    if (!ValidCol(nCol))
+    if (!ValidCol(rAddress.Col()))
         return;
 
-    aCol[nCol].EndListening(rCxt, nRow, rListener);
+    aCol[rAddress.Col()].EndListening(rCxt, rAddress, rListener);
 }
 
 void ScTable::SetPageStyle( const OUString& rName )


More information about the Libreoffice-commits mailing list