summaryrefslogtreecommitdiff
path: root/sc/source/filter
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-11-08 14:49:44 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-11-11 16:17:30 -0500
commita1ff0b3c1125d715e216efccf114efb46b31c587 (patch)
tree53ffaef8a6d7b7027f563bfabbb4fa39afe3a982 /sc/source/filter
parentfbdd02dd6655914930b60b175328324bb53dc650 (diff)
Group formula cells if we can, to avoid cloning of token array instances.
Change-Id: I584e6d0c34f972c1ae5105a80d201f32dd8590d9
Diffstat (limited to 'sc/source/filter')
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index eb1892ba98da..4bdb6ae7a5ca 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -189,7 +189,24 @@ void applyCellFormulas(
if (p)
{
// 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);
// Update the cache.