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

Group formula cells if we can, to avoid cloning of token array instances.

Change-Id: I584e6d0c34f972c1ae5105a80d201f32dd8590d9
üst fbdd02dd
...@@ -189,7 +189,24 @@ void applyCellFormulas( ...@@ -189,7 +189,24 @@ void applyCellFormulas(
if (p) if (p)
{ {
// Use the cached version to avoid re-compilation. // Use the cached version to avoid re-compilation.
ScFormulaCell* pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, p->mpCell->GetCode()->Clone());
ScFormulaCell* pCell = NULL;
if (p->mnRow + 1 == aPos.Row())
{
// Put them in the same formula group.
ScFormulaCell& rPrev = *p->mpCell;
ScFormulaCellGroupRef xGroup = rPrev.GetCellGroup();
if (!xGroup)
// Last cell is not grouped yet. Start a new group.
xGroup = rPrev.CreateCellGroup(p->mnRow, 1, false);
++xGroup->mnLength;
pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, xGroup);
}
else
pCell = new ScFormulaCell(&rDoc.getDoc(), aPos, p->mpCell->GetCode()->Clone());
rDoc.setFormulaCell(aPos, pCell); rDoc.setFormulaCell(aPos, pCell);
// Update the cache. // Update the cache.
......
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