summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-12-01 23:56:44 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2014-12-10 15:04:30 +0000
commit91e9b38bee769ab41332b1cae6d2bbbd83a27eff (patch)
tree44724d4115a0dd351ccce1cfbf4a94e695b55f98
parent906fdfa21fc8741b27657ec0c497485b0cb5ff1f (diff)
fdo#86762 re-establish listeners to move cell broadcasters
... for UpdateReferenceOnSort=false (cherry picked from commit 6c2111f17089eb667bf526561d7667d17825e822) Conflicts: sc/source/core/data/table3.cxx fdo#86762 broadcast also empty cells after sort (cherry picked from commit 08793e08c7e9cefe594c49130f782725e386c463) Conflicts: sc/inc/column.hxx sc/source/core/data/column.cxx sc/source/core/data/document.cxx sc/source/core/data/table2.cxx sc/source/ui/docshell/dbdocfun.cxx fdo#86762 re-establish listeners on moved broadcasters ... also in SortReorderByColumn() similar to SortReorderByRow() (cherry picked from commit e119f3883513aeaa49f332362620e955dc8b453f) Conflicts: sc/source/core/data/table3.cxx e275a754c530d6039ed14304900dd71416f36e46 7665dcc90d70fcf3b08bef0adb9ab6aaff1cdcdf Change-Id: Id90288660e317d6e47ee01ee3b5ff9058cfa18df Reviewed-on: https://gerrit.libreoffice.org/13274 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/inc/column.hxx2
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/refhint.hxx18
-rw-r--r--sc/inc/table.hxx2
-rw-r--r--sc/source/core/data/column.cxx17
-rw-r--r--sc/source/core/data/document.cxx5
-rw-r--r--sc/source/core/data/formulacell.cxx10
-rw-r--r--sc/source/core/data/table2.cxx4
-rw-r--r--sc/source/core/data/table3.cxx245
-rw-r--r--sc/source/core/tool/refhint.cxx6
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx2
11 files changed, 219 insertions, 94 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 097c3774e9d8..6911ca0e34ff 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -343,7 +343,7 @@ public:
bool IsFormulaDirty( SCROW nRow ) const;
void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
- void SetDirty( SCROW nRow1, SCROW nRow2 );
+ void SetDirty( SCROW nRow1, SCROW nRow2, bool bIncludeEmptyCells = false );
void SetDirtyVar();
void SetDirtyAfterLoad();
void SetTableOpDirty( const ScRange& );
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 1052e6c372b7..f37bfa2e0961 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1011,7 +1011,7 @@ public:
void ResetChanged( const ScRange& rRange );
void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
- void SetDirty( const ScRange& );
+ void SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp
void InterpretDirtyCells( const ScRangeList& rRanges );
SC_DLLPUBLIC void CalcAll();
diff --git a/sc/inc/refhint.hxx b/sc/inc/refhint.hxx
index 1eff90631de6..a61e4b689c9f 100644
--- a/sc/inc/refhint.hxx
+++ b/sc/inc/refhint.hxx
@@ -21,7 +21,9 @@ public:
enum Type {
Moved,
ColumnReordered,
- RowReordered
+ RowReordered,
+ StartListening,
+ StopListening
};
private:
@@ -95,6 +97,20 @@ public:
SCCOL getEndColumn() const;
};
+class RefStartListeningHint : public RefHint
+{
+public:
+ RefStartListeningHint();
+ virtual ~RefStartListeningHint();
+};
+
+class RefStopListeningHint : public RefHint
+{
+public:
+ RefStopListeningHint();
+ virtual ~RefStopListeningHint();
+};
+
}
#endif
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index fe36dac65f59..49b8571c7e8c 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -522,7 +522,7 @@ public:
void ResetChanged( const ScRange& rRange );
void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
- void SetDirty( const ScRange& );
+ void SetDirty( const ScRange&, bool bIncludeEmptyCells = false );
void SetDirtyAfterLoad();
void SetDirtyVar();
void SetTableOpDirty( const ScRange& );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 42da658ebf66..64174ab353ef 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -3050,14 +3050,27 @@ void ScColumn::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
sc::ProcessFormula(maCells, aFunc);
}
-void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2 )
+void ScColumn::SetDirty( SCROW nRow1, SCROW nRow2, bool bIncludeEmptyCells )
{
// broadcasts everything within the range, with FormulaTracking
sc::AutoCalcSwitch aSwitch(*pDocument, false);
SetDirtyOnRangeHandler aHdl(*this);
sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aHdl, aHdl);
- aHdl.broadcast();
+ if (bIncludeEmptyCells)
+ {
+ // Broadcast the changes.
+ ScHint aHint( SC_HINT_DATACHANGED, ScAddress( nCol, 0, nTab));
+ for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
+ {
+ aHint.GetAddress().SetRow(nRow);
+ pDocument->Broadcast(aHint);
+ }
+ }
+ else
+ {
+ aHdl.broadcast();
+ }
}
void ScColumn::SetTableOpDirty( const ScRange& rRange )
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 8f01973dd7eb..56e751b279cc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3605,8 +3605,7 @@ void ScDocument::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
SetAutoCalc( bOldAutoCalc );
}
-
-void ScDocument::SetDirty( const ScRange& rRange )
+void ScDocument::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
{
bool bOldAutoCalc = GetAutoCalc();
bAutoCalc = false; // keine Mehrfachberechnung
@@ -3614,7 +3613,7 @@ void ScDocument::SetDirty( const ScRange& rRange )
ScBulkBroadcast aBulkBroadcast( GetBASM());
SCTAB nTab2 = rRange.aEnd.Tab();
for (SCTAB i=rRange.aStart.Tab(); i<=nTab2 && i < static_cast<SCTAB>(maTabs.size()); i++)
- if (maTabs[i]) maTabs[i]->SetDirty( rRange );
+ if (maTabs[i]) maTabs[i]->SetDirty( rRange, bIncludeEmptyCells );
}
SetAutoCalc( bOldAutoCalc );
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 96eb32362ce6..88ad904de641 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1946,6 +1946,16 @@ void ScFormulaCell::Notify( const SfxHint& rHint )
rRefRowReorder.getRowMap());
}
break;
+ case sc::RefHint::StartListening:
+ {
+ StartListeningTo( pDocument);
+ }
+ break;
+ case sc::RefHint::StopListening:
+ {
+ EndListeningTo( pDocument);
+ }
+ break;
default:
;
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 8f8166023a45..555272fee433 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1690,13 +1690,13 @@ void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
}
-void ScTable::SetDirty( const ScRange& rRange )
+void ScTable::SetDirty( const ScRange& rRange, bool bIncludeEmptyCells )
{
bool bOldAutoCalc = pDocument->GetAutoCalc();
pDocument->SetAutoCalc( false ); // Mehrfachberechnungen vermeiden
SCCOL nCol2 = rRange.aEnd.Col();
for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
- aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row());
+ aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), bIncludeEmptyCells);
pDocument->SetAutoCalc( bOldAutoCalc );
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index db6125f93169..b226c62b123d 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -665,6 +665,30 @@ public:
typedef ReorderNotifier<sc::RefColReorderHint, sc::ColRowReorderMapType, SCCOL> ColReorderNotifier;
typedef ReorderNotifier<sc::RefRowReorderHint, sc::ColRowReorderMapType, SCROW> RowReorderNotifier;
+class StartListeningNotifier : std::unary_function<SvtListener*, void>
+{
+ sc::RefStartListeningHint maHint;
+public:
+ StartListeningNotifier() {}
+
+ void operator() ( SvtListener* p )
+ {
+ p->Notify(maHint);
+ }
+};
+
+class StopListeningNotifier : std::unary_function<SvtListener*, void>
+{
+ sc::RefStopListeningHint maHint;
+public:
+ StopListeningNotifier() {}
+
+ void operator() ( SvtListener* p )
+ {
+ p->Notify(maHint);
+ }
+};
+
class FormulaGroupPosCollector : std::unary_function<SvtListener*, void>
{
sc::RefQueryFormulaGroup& mrQuery;
@@ -694,6 +718,28 @@ void ScTable::SortReorderByColumn(
for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
aCol[nCol].SplitFormulaGroupByRelativeRef(aSortRange);
+ // Collect all listeners of cell broadcasters of sorted range.
+ std::vector<SvtListener*> aCellListeners;
+
+ if (!pArray->IsUpdateRefs())
+ {
+ // Collect listeners of cell broadcasters.
+ for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
+ aCol[nCol].CollectListeners(aCellListeners, nRow1, nRow2);
+
+ // Remove any duplicate listener entries. We must ensure that we
+ // notify each unique listener only once.
+ std::sort(aCellListeners.begin(), aCellListeners.end());
+ aCellListeners.erase(std::unique(aCellListeners.begin(), aCellListeners.end()), aCellListeners.end());
+
+ // Notify the cells' listeners to stop listening.
+ /* TODO: for performance this could be enhanced to stop and later
+ * restart only listening to within the reordered range and keep
+ * listening to everything outside untouched. */
+ StopListeningNotifier aFunc;
+ std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+ }
+
// table to keep track of column index to position in the index table.
std::vector<SCCOLROW> aPosTable(nCount);
for (size_t i = 0; i < nCount; ++i)
@@ -722,38 +768,38 @@ void ScTable::SortReorderByColumn(
for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
aCol[nCol].ResetFormulaCellPositions(nRow1, nRow2, bUpdateRefs);
- // Set up column reorder map (for later broadcasting of reference updates).
- sc::ColRowReorderMapType aColMap;
- const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
- for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
- {
- SCCOL nNew = i + nStart;
- SCCOL nOld = rOldIndices[i];
- aColMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
- }
-
- // Collect all listeners within sorted range ahead of time.
- std::vector<SvtListener*> aListeners;
-
- // Get all area listeners that listen on one column within the range and
- // end their listening.
- ScRange aMoveRange( nStart, nRow1, nTab, nLast, nRow2, nTab);
- std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
- aMoveRange, sc::OneColumnInsideArea);
+ if (pArray->IsUpdateRefs())
{
- std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
- for (; it != itEnd; ++it)
+ // Set up column reorder map (for later broadcasting of reference updates).
+ sc::ColRowReorderMapType aColMap;
+ const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
+ for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
{
- pDocument->EndListeningArea(it->maArea, it->mpListener);
- aListeners.push_back( it->mpListener);
+ SCCOL nNew = i + nStart;
+ SCCOL nOld = rOldIndices[i];
+ aColMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
}
- }
- if (pArray->IsUpdateRefs())
- {
+ // Collect all listeners within sorted range ahead of time.
+ std::vector<SvtListener*> aListeners;
+
for (SCCOL nCol = nStart; nCol <= nLast; ++nCol)
aCol[nCol].CollectListeners(aListeners, nRow1, nRow2);
+ // Get all area listeners that listen on one column within the range
+ // and end their listening.
+ ScRange aMoveRange( nStart, nRow1, nTab, nLast, nRow2, nTab);
+ std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
+ aMoveRange, sc::OneColumnInsideArea);
+ {
+ std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+ for (; it != itEnd; ++it)
+ {
+ pDocument->EndListeningArea(it->maArea, it->mpListener);
+ aListeners.push_back( it->mpListener);
+ }
+ }
+
// Remove any duplicate listener entries and notify all listeners
// afterward. We must ensure that we notify each unique listener only
// once.
@@ -761,23 +807,29 @@ void ScTable::SortReorderByColumn(
aListeners.erase(std::unique(aListeners.begin(), aListeners.end()), aListeners.end());
ColReorderNotifier aFunc(aColMap, nTab, nRow1, nRow2);
std::for_each(aListeners.begin(), aListeners.end(), aFunc);
- }
- // Re-start area listeners on the reordered columns.
- {
- std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
- for (; it != itEnd; ++it)
+ // Re-start area listeners on the reordered columns.
{
- ScRange aNewRange = it->maArea;
- sc::ColRowReorderMapType::const_iterator itCol = aColMap.find( aNewRange.aStart.Col());
- if (itCol != aColMap.end())
+ std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+ for (; it != itEnd; ++it)
{
- aNewRange.aStart.SetCol( itCol->second);
- aNewRange.aEnd.SetCol( itCol->second);
+ ScRange aNewRange = it->maArea;
+ sc::ColRowReorderMapType::const_iterator itCol = aColMap.find( aNewRange.aStart.Col());
+ if (itCol != aColMap.end())
+ {
+ aNewRange.aStart.SetCol( itCol->second);
+ aNewRange.aEnd.SetCol( itCol->second);
+ }
+ pDocument->StartListeningArea(aNewRange, it->mpListener);
}
- pDocument->StartListeningArea(aNewRange, it->mpListener);
}
}
+ else // !(pArray->IsUpdateRefs())
+ {
+ // Notify the cells' listeners to (re-)start listening.
+ StartListeningNotifier aFunc;
+ std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+ }
// Re-join formulas at row boundaries now that all the references have
// been adjusted for column reordering.
@@ -805,6 +857,9 @@ void ScTable::SortReorderByRow(
ScSortInfoArray::RowsType* pRows = pArray->GetDataRows();
assert(pRows); // In sort-by-row mode we must have data rows already populated.
+ // Collect all listeners of cell broadcasters of sorted range.
+ std::vector<SvtListener*> aCellListeners;
+
if (!pArray->IsUpdateRefs())
{
// When the update ref mode is disabled, we need to detach all formula
@@ -812,6 +867,22 @@ void ScTable::SortReorderByRow(
// afterward.
sc::EndListeningContext aCxt(*pDocument);
DetachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2);
+
+ // Collect listeners of cell broadcasters.
+ for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+ aCol[nCol].CollectListeners(aCellListeners, nRow1, nRow2);
+
+ // Remove any duplicate listener entries. We must ensure that we notify
+ // each unique listener only once.
+ std::sort(aCellListeners.begin(), aCellListeners.end());
+ aCellListeners.erase(std::unique(aCellListeners.begin(), aCellListeners.end()), aCellListeners.end());
+
+ // Notify the cells' listeners to stop listening.
+ /* TODO: for performance this could be enhanced to stop and later
+ * restart only listening to within the reordered range and keep
+ * listening to everything outside untouched. */
+ StopListeningNotifier aFunc;
+ std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
}
// Split formula groups at the sort range boundaries (if applicable).
@@ -891,15 +962,18 @@ void ScTable::SortReorderByRow(
else
rAttrStore.push_back_empty();
- // At this point each broadcaster instance is managed by 2
- // containers. We will release those in the original storage
- // below before transferring them to the document.
- sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).maBroadcasters;
- if (rCell.mpBroadcaster)
- // A const pointer would be implicitly converted to a bool type.
- rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster));
- else
- rBCStore.push_back_empty();
+ if (pArray->IsUpdateRefs())
+ {
+ // At this point each broadcaster instance is managed by 2
+ // containers. We will release those in the original storage
+ // below before transferring them to the document.
+ sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).maBroadcasters;
+ if (rCell.mpBroadcaster)
+ // A const pointer would be implicitly converted to a bool type.
+ rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster));
+ else
+ rBCStore.push_back_empty();
+ }
// The same with cell note instances ...
sc::CellNoteStoreType& rNoteStore = aSortedCols.at(j).maCellNotes;
@@ -940,6 +1014,7 @@ void ScTable::SortReorderByRow(
rSrc.transfer(nRow1, nRow2, rDest, nRow1);
}
+ if (pArray->IsUpdateRefs())
{
sc::BroadcasterStoreType& rSrc = aSortedCols[i].maBroadcasters;
sc::BroadcasterStoreType& rDest = aCol[nThisCol].maBroadcasters;
@@ -1005,39 +1080,39 @@ void ScTable::SortReorderByRow(
SetRowFiltered(it->mnRow1, it->mnRow2, true);
}
- // Set up row reorder map (for later broadcasting of reference updates).
- sc::ColRowReorderMapType aRowMap;
- const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
- for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
- {
- SCROW nNew = i + nRow1;
- SCROW nOld = rOldIndices[i];
- aRowMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
- }
-
- // Collect all listeners within sorted range ahead of time.
- std::vector<SvtListener*> aListeners;
-
- // Get all area listeners that listen on one row within the range and end
- // their listening.
- ScRange aMoveRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab);
- std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
- aMoveRange, sc::OneRowInsideArea);
+ if (pArray->IsUpdateRefs())
{
- std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
- for (; it != itEnd; ++it)
+ // Set up row reorder map (for later broadcasting of reference updates).
+ sc::ColRowReorderMapType aRowMap;
+ const std::vector<SCCOLROW>& rOldIndices = pArray->GetOrderIndices();
+ for (size_t i = 0, n = rOldIndices.size(); i < n; ++i)
{
- pDocument->EndListeningArea(it->maArea, it->mpListener);
- aListeners.push_back( it->mpListener);
+ SCROW nNew = i + nRow1;
+ SCROW nOld = rOldIndices[i];
+ aRowMap.insert(sc::ColRowReorderMapType::value_type(nOld, nNew));
}
- }
- if (pArray->IsUpdateRefs())
- {
+ // Collect all listeners within sorted range ahead of time.
+ std::vector<SvtListener*> aListeners;
+
// Collect listeners of cell broadcasters.
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
aCol[nCol].CollectListeners(aListeners, nRow1, nRow2);
+ // Get all area listeners that listen on one row within the range and end
+ // their listening.
+ ScRange aMoveRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab);
+ std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
+ aMoveRange, sc::OneRowInsideArea);
+ {
+ std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+ for (; it != itEnd; ++it)
+ {
+ pDocument->EndListeningArea(it->maArea, it->mpListener);
+ aListeners.push_back( it->mpListener);
+ }
+ }
+
// Remove any duplicate listener entries. We must ensure that we notify
// each unique listener only once.
std::sort(aListeners.begin(), aListeners.end());
@@ -1063,7 +1138,7 @@ void ScTable::SortReorderByRow(
}
}
- // Notify the listeners.
+ // Notify the listeners to update their references.
RowReorderNotifier aFunc(aRowMap, nTab, nCol1, nCol2);
std::for_each(aListeners.begin(), aListeners.end(), aFunc);
@@ -1075,23 +1150,29 @@ void ScTable::SortReorderByRow(
for (; itCol != itColEnd; ++itCol)
pDocument->RegroupFormulaCells(itGroupTab->first, itCol->first);
}
- }
- // Re-start area listeners on the reordered rows.
- {
- std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
- for (; it != itEnd; ++it)
+ // Re-start area listeners on the reordered rows.
{
- ScRange aNewRange = it->maArea;
- sc::ColRowReorderMapType::const_iterator itRow = aRowMap.find( aNewRange.aStart.Row());
- if (itRow != aRowMap.end())
+ std::vector<sc::AreaListener>::iterator it = aAreaListeners.begin(), itEnd = aAreaListeners.end();
+ for (; it != itEnd; ++it)
{
- aNewRange.aStart.SetRow( itRow->second);
- aNewRange.aEnd.SetRow( itRow->second);
+ ScRange aNewRange = it->maArea;
+ sc::ColRowReorderMapType::const_iterator itRow = aRowMap.find( aNewRange.aStart.Row());
+ if (itRow != aRowMap.end())
+ {
+ aNewRange.aStart.SetRow( itRow->second);
+ aNewRange.aEnd.SetRow( itRow->second);
+ }
+ pDocument->StartListeningArea(aNewRange, it->mpListener);
}
- pDocument->StartListeningArea(aNewRange, it->mpListener);
}
}
+ else // !(pArray->IsUpdateRefs())
+ {
+ // Notify the cells' listeners to (re-)start listening.
+ StartListeningNotifier aFunc;
+ std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+ }
// Re-group columns in the sorted range too.
for (SCCOL i = nCol1; i <= nCol2; ++i)
diff --git a/sc/source/core/tool/refhint.cxx b/sc/source/core/tool/refhint.cxx
index 29a91665c537..33b510dc8ca0 100644
--- a/sc/source/core/tool/refhint.cxx
+++ b/sc/source/core/tool/refhint.cxx
@@ -81,6 +81,12 @@ SCCOL RefRowReorderHint::getEndColumn() const
return mnCol2;
}
+RefStartListeningHint::RefStartListeningHint() : RefHint(StartListening) {}
+RefStartListeningHint::~RefStartListeningHint() {}
+
+RefStopListeningHint::RefStopListeningHint() : RefHint(StopListening) {}
+RefStopListeningHint::~RefStopListeningHint() {}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 2ca4808f7784..a1920eb70170 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -533,7 +533,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
ScRange aDirtyRange(
aLocalParam.nCol1, nStartRow, nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab);
- pDoc->SetDirty( aDirtyRange );
+ pDoc->SetDirty( aDirtyRange, true );
if (bPaint)
{