sc/source/core/data/column4.cxx | 54 ++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 24 deletions(-)
New commits: commit bb14c069cc58a9a4359299b4ad865f49eb495799 Author: Kohei Yoshida <kohei.yosh...@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 <er...@redhat.com> Tested-by: Eike Rathke <er...@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(); + } } } }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits