[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Fri Apr 11 04:09:31 PDT 2014


 sc/source/core/data/column4.cxx |   54 ++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 24 deletions(-)

New commits:
commit bb14c069cc58a9a4359299b4ad865f49eb495799
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Apr 11 00:43:18 2014 -0400

    fdo#77300: Don't re-compile formulas when the hybrid formula is not there.
    
    Change-Id: I9b0f8d031fec08bb8d92333ff67074fdc739e034
    (cherry picked from commit 66c6a3bfc9cd89c562107d3d369b3d82bae94d68)
    (cherry picked from commit 0e63ca4fde4e446f346e35849c756a30ca294aab)
    Reviewed-on: https://gerrit.libreoffice.org/8928
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index e25de16..aca38b7 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -213,23 +213,26 @@ public:
             ScFormulaCell* pTop = *rEntry.mpCells;
             OUString aFormula = pTop->GetHybridFormula();
 
-            // Create a new token array from the hybrid formula string, and
-            // set it to the group.
-            ScCompiler aComp(mrCompileFormulaCxt, pTop->aPos);
-            ScTokenArray* pNewCode = aComp.CompileString(aFormula);
-            ScFormulaCellGroupRef xGroup = pTop->GetCellGroup();
-            assert(xGroup);
-            xGroup->setCode(pNewCode);
-            xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar());
-
-            // Propagate the new token array to all formula cells in the group.
-            ScFormulaCell** pp = rEntry.mpCells;
-            ScFormulaCell** ppEnd = pp + rEntry.mnLength;
-            for (; pp != ppEnd; ++pp)
+            if (!aFormula.isEmpty())
             {
-                ScFormulaCell* p = *pp;
-                p->SyncSharedCode();
-                p->SetDirty();
+                // Create a new token array from the hybrid formula string, and
+                // set it to the group.
+                ScCompiler aComp(mrCompileFormulaCxt, pTop->aPos);
+                ScTokenArray* pNewCode = aComp.CompileString(aFormula);
+                ScFormulaCellGroupRef xGroup = pTop->GetCellGroup();
+                assert(xGroup);
+                xGroup->setCode(pNewCode);
+                xGroup->compileCode(*mpDoc, pTop->aPos, mpDoc->GetGrammar());
+
+                // Propagate the new token array to all formula cells in the group.
+                ScFormulaCell** pp = rEntry.mpCells;
+                ScFormulaCell** ppEnd = pp + rEntry.mnLength;
+                for (; pp != ppEnd; ++pp)
+                {
+                    ScFormulaCell* p = *pp;
+                    p->SyncSharedCode();
+                    p->SetDirty();
+                }
             }
         }
         else
@@ -237,16 +240,19 @@ public:
             ScFormulaCell* pCell = rEntry.mpCell;
             OUString aFormula = pCell->GetHybridFormula();
 
-            // Create token array from formula string.
-            ScCompiler aComp(mrCompileFormulaCxt, pCell->aPos);
-            ScTokenArray* pNewCode = aComp.CompileString(aFormula);
+            if (!aFormula.isEmpty())
+            {
+                // Create token array from formula string.
+                ScCompiler aComp(mrCompileFormulaCxt, pCell->aPos);
+                ScTokenArray* pNewCode = aComp.CompileString(aFormula);
 
-            // Generate RPN tokens.
-            ScCompiler aComp2(mpDoc, pCell->aPos, *pNewCode);
-            aComp2.CompileTokenArray();
+                // Generate RPN tokens.
+                ScCompiler aComp2(mpDoc, pCell->aPos, *pNewCode);
+                aComp2.CompileTokenArray();
 
-            pCell->SetCode(pNewCode);
-            pCell->SetDirty();
+                pCell->SetCode(pNewCode);
+                pCell->SetDirty();
+            }
         }
     }
 };


More information about the Libreoffice-commits mailing list