summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-04-24 13:08:21 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-04-30 13:10:39 -0400
commit8d820a45d97cf0539b46b01f6002856882183e24 (patch)
tree5635fd1dc55edbe263976403aa591963a2056d3d /sc
parent898e806e5eb447e58dd48196fee101c8e5f9a84d (diff)
Let's use std::for_each for this.
Change-Id: I74f59ad697eb5ff28b81cd883db58ba9f19c086c
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/column3.cxx24
1 files changed, 18 insertions, 6 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index cb82b3cd2cfd..9ad00612feab 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2051,6 +2051,23 @@ xub_StrLen ScColumn::GetMaxNumberStringLen(
return nStringLen;
}
+namespace {
+
+struct CellGroupSetter : std::unary_function<ColEntry, void>
+{
+ ScFormulaCellGroupRef mxGroup;
+public:
+ CellGroupSetter(const ScFormulaCellGroupRef& xGroup) : mxGroup(xGroup) {}
+
+ void operator() (ColEntry& rEntry)
+ {
+ if (rEntry.pCell && rEntry.pCell->GetCellType() == CELLTYPE_FORMULA)
+ static_cast<ScFormulaCell*>(rEntry.pCell)->SetCellGroup(mxGroup);
+ }
+};
+
+}
+
// Very[!] slow way to look for and merge contiguous runs
// of similar formulae into a formulagroup
void ScColumn::RebuildFormulaGroups()
@@ -2064,12 +2081,7 @@ void ScColumn::RebuildFormulaGroups()
// clear previous groups
ScFormulaCellGroupRef xNone;
- for (size_t i = 0; i < maItems.size(); i++)
- {
- ColEntry &rCur = maItems[ i ];
- if ( rCur.pCell && rCur.pCell->GetCellType() == CELLTYPE_FORMULA )
- static_cast<ScFormulaCell *>( rCur.pCell )->SetCellGroup( xNone );
- }
+ std::for_each(maItems.begin(), maItems.end(), CellGroupSetter(xNone));
maFnGroups.clear();
// re-build groups