diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-06-21 14:47:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-06 09:54:59 +0000 |
commit | aca8a92b6b78b9d6dbefbcf9784b09675ee8f187 (patch) | |
tree | 7f651f56574b9eea77ae5b4a22ed96e66b8600f6 | |
parent | 901bb8527350a81b1631338abedbfd3f77ffbf35 (diff) |
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@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 2511e272481172b439d167fd8b09d14c755f223d)
Reviewed-on: https://gerrit.libreoffice.org/26958
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/inc/column.hxx | 4 | ||||
-rw-r--r-- | sc/inc/table.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/data/documen7.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/table5.cxx | 12 |
5 files changed, 21 insertions, 21 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 5b319d5177cd..c1720f7208a8 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -527,8 +527,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 9efd590469c2..ead8ba49dd3a 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1078,8 +1078,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 4d7476e4924c..fbaf4daba584 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -2988,29 +2988,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; @@ -3021,7 +3021,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 cfa3d2ffb087..174bf766435e 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -313,7 +313,7 @@ void ScDocument::StartListeningCell( if (!pTab) return; - pTab->StartListening(rCxt, rPos.Col(), rPos.Row(), rListener); + pTab->StartListening(rCxt, rPos, rListener); } void ScDocument::EndListeningCell( @@ -323,7 +323,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 c277812bc274..980d0d2493e2 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1103,20 +1103,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 ) |