summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-04-25 00:54:47 -0400
committerEike Rathke <erack@redhat.com>2014-04-25 16:10:45 +0000
commit6b7f07e3dbd990fd63c707d9297b4715e6e3957d (patch)
tree5c752bca6e0cacacac001dc765aa2bd7f80a0e69
parent160bcf5357fb565b2f27f8b12e75d408f939e069 (diff)
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@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/data/column.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 9ff510ccb133..99d2626b38a9 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.