[Libreoffice-commits] core.git: Branch 'private/kohei/xlsx-import-speedup' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Nov 8 20:49:06 CET 2013


 sc/source/filter/oox/formulabuffer.cxx |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 1c9dd88f1c814af52d9b57b8352233ffd6d15242
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Nov 8 14:49:44 2013 -0500

    Group formula cells if we can, to avoid cloning of token array instances.
    
    Change-Id: I584e6d0c34f972c1ae5105a80d201f32dd8590d9

diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index eb1892b..4bdb6ae 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.


More information about the Libreoffice-commits mailing list