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

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


 sc/source/core/data/column.cxx |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 6b7f07e3dbd990fd63c707d9297b4715e6e3957d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Apr 25 00:54:47 2014 -0400

    fdo#77728: Re-compile tokens when named range is updated.
    
    Change-Id: Icd9f8c60d9e105478abb5b5ad64e969623830a4c
    (cherry picked from commit dafce0665c852297d39cddf76f46c77c14a8f12a)
    Reviewed-on: https://gerrit.libreoffice.org/9157
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 9ff510c..99d2626 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2116,6 +2116,16 @@ class UpdateRefOnNonCopy : std::unary_function<sc::FormulaGroupEntry, void>
     ScDocument* mpUndoDoc;
     bool mbUpdated;
 
+    void recompileTokenArray( ScFormulaCell& rTopCell )
+    {
+        // We need to re-compile the token array when a range name is
+        // modified, to correctly reflect the new references in the
+        // name.
+        ScCompiler aComp(&mpCxt->mrDoc, rTopCell.aPos, *rTopCell.GetCode());
+        aComp.SetGrammar(mpCxt->mrDoc.GetGrammar());
+        aComp.CompileTokenArray();
+    }
+
     void updateRefOnShift( sc::FormulaGroupEntry& rGroup )
     {
         if (!rGroup.mbShared)
@@ -2149,7 +2159,10 @@ class UpdateRefOnNonCopy : std::unary_function<sc::FormulaGroupEntry, void>
                 aRes.mbValueChanged = true;
         }
 
-        if (aRes.mbReferenceModified)
+        if (aRes.mbNameModified)
+            recompileTokenArray(*pTop);
+
+        if (aRes.mbReferenceModified || aRes.mbNameModified)
         {
             sc::StartListeningContext aStartCxt(mpCxt->mrDoc);
             sc::EndListeningContext aEndCxt(mpCxt->mrDoc, pOldCode.get());
@@ -2221,14 +2234,7 @@ class UpdateRefOnNonCopy : std::unary_function<sc::FormulaGroupEntry, void>
             sc::AutoCalcSwitch(mpCxt->mrDoc, false);
 
             if (aRes.mbNameModified)
-            {
-                // We need to re-compile the token array when a range name is
-                // modified, to correctly reflect the new references in the
-                // name.
-                ScCompiler aComp(&mpCxt->mrDoc, aPos, *pCode);
-                aComp.SetGrammar(mpCxt->mrDoc.GetGrammar());
-                aComp.CompileTokenArray();
-            }
+                recompileTokenArray(*pTop);
 
             // Perform end-listening, start-listening, and dirtying on all
             // formula cells in the group.


More information about the Libreoffice-commits mailing list