summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-21 14:47:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-07-05 13:59:25 +0000
commitd89e803f621f6722d5f7dbe5ea4af4018b0b6851 (patch)
treea1d89e28dc857a19f44579fc1a815cbaeb6f47e5
parentc7345f4ac23d877a28f0d75f83b770c3835aa10d (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/26956 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/inc/column.hxx4
-rw-r--r--sc/inc/table.hxx4
-rw-r--r--sc/source/core/data/column2.cxx18
-rw-r--r--sc/source/core/data/documen7.cxx4
-rw-r--r--sc/source/core/data/table5.cxx12
5 files changed, 21 insertions, 21 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 9754e5acb109..939716443d20 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 b6e69c172e5b..be833da3cad3 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 c81594fd2d41..5ef660322856 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2998,29 +2998,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;
@@ -3031,7 +3031,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 98025ec8a36f..681601051ea3 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 6a2f060a5f14..2ae8872488ed 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 )