summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-19 11:46:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-20 08:42:30 +0200
commit4819162e452ff96f2a2e652a48a7bc3bfa3bc400 (patch)
tree42aef824628348f88ea156b19055eec119aaeb8c /sc
parent8abc7ba9784f7898576fbdd7a48f0ff9e4445a68 (diff)
simplify calling listeners
Change-Id: I4bf0d378003d1f54685f6c55c0314c117b243526
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/table3.cxx44
1 files changed, 12 insertions, 32 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 3b1a1c393a9b..64234dbd9781 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -665,30 +665,6 @@ public:
}
};
-class StartListeningNotifier
-{
- sc::RefStartListeningHint maHint;
-public:
- StartListeningNotifier() {}
-
- void operator() ( SvtListener* p )
- {
- p->Notify(maHint);
- }
-};
-
-class StopListeningNotifier
-{
- sc::RefStopListeningHint maHint;
-public:
- StopListeningNotifier() {}
-
- void operator() ( SvtListener* p )
- {
- p->Notify(maHint);
- }
-};
-
class FormulaGroupPosCollector
{
sc::RefQueryFormulaGroup& mrQuery;
@@ -933,8 +909,9 @@ void ScTable::SortReorderByColumn(
/* 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);
+ sc::RefStopListeningHint aHint;
+ for (auto const & l : aCellListeners)
+ l->Notify(aHint);
}
// table to keep track of column index to position in the index table.
@@ -1024,8 +1001,9 @@ void ScTable::SortReorderByColumn(
else // !(pArray->IsUpdateRefs())
{
// Notify the cells' listeners to (re-)start listening.
- StartListeningNotifier aFunc;
- std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+ sc::RefStartListeningHint aHint;
+ for (auto const & l : aCellListeners)
+ l->Notify(aHint);
}
// Re-join formulas at row boundaries now that all the references have
@@ -1079,8 +1057,9 @@ void ScTable::SortReorderByRow(
* 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);
+ sc::RefStopListeningHint aHint;
+ for (auto const & l : aCellListeners)
+ l->Notify(aHint);
}
// Split formula groups at the sort range boundaries (if applicable).
@@ -1172,8 +1151,9 @@ void ScTable::SortReorderByRow(
// Notify the cells' listeners to (re-)start listening.
{
- StartListeningNotifier aFunc;
- std::for_each(aCellListeners.begin(), aCellListeners.end(), aFunc);
+ sc::RefStartListeningHint aHint;
+ for (auto const & l : aCellListeners)
+ l->Notify(aHint);
}
// Re-group columns in the sorted range too.