diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-04-11 00:43:18 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-04-16 17:07:19 +0200 |
commit | a58be4463047c9931539b822400145cd2733f6bf (patch) | |
tree | d808f772b41a9446c7a6e446e0abc2201bc73cc5 | |
parent | 0fbbb60029bc77eb298bfb2fd9a3af3c288580e2 (diff) |
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@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/core/data/column4.cxx | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index e25de1654c3a..aca38b7e69ae 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(); + } } } }; |