summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-04-25 00:54:47 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-04-25 00:58:14 -0400
commitdafce0665c852297d39cddf76f46c77c14a8f12a (patch)
treea93ea8d024250de06087d6c541ad80cbb5506cb8
parent7608bf4660d11ccda56cb7c3edad4d78d3610139 (diff)
fdo#77728: Re-compile tokens when named range is updated.
Change-Id: Icd9f8c60d9e105478abb5b5ad64e969623830a4c
-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 2670dbb479f3..a2435989dd3a 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2113,6 +2113,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)
@@ -2146,7 +2156,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());
@@ -2218,14 +2231,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.