Kaydet (Commit) 8d820a45 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Let's use std::for_each for this.

Change-Id: I74f59ad697eb5ff28b81cd883db58ba9f19c086c
üst 898e806e
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment