[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-0' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Jan 21 02:53:49 PST 2014
sc/source/core/data/formulacell.cxx | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
New commits:
commit 41b9f71f6717e9e4a6395227406c73b73c2d3a35
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Jan 16 12:49:14 2014 -0500
fdo#73655: Don't adjust formula tokens on non-top shared formula cells.
Only adjust tokens for non-shared formula cells and shared formuls cells
that are the top of their respective shared groups.
Change-Id: I9cd57653602c97504a802001947a28c4d03368a5
(cherry picked from commit 982a03d4e2baf4ca7e78c79014389d9b23e200d1)
Reviewed-on: https://gerrit.libreoffice.org/7483
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 721f268..66ef732 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2799,6 +2799,8 @@ bool ScFormulaCell::UpdateReference(
void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
{
+ // Adjust tokens only when it's not grouped or grouped top cell.
+ bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this;
bool bPosChanged = (rCxt.mnInsertPos <= aPos.Tab());
pCode->Reset();
if (pDocument->IsClipOrUndo() || !pCode->GetNextReferenceRPN())
@@ -2815,6 +2817,9 @@ void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
if (bPosChanged)
aPos.IncTab(rCxt.mnSheets);
+ if (!bAdjustCode)
+ return;
+
sc::RefUpdateResult aRes = pCode->AdjustReferenceOnInsertedTab(rCxt, aOldPos);
if (aRes.mbNameModified)
// Re-compile after new sheet(s) have been inserted.
@@ -2825,6 +2830,8 @@ void ScFormulaCell::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
{
+ // Adjust tokens only when it's not grouped or grouped top cell.
+ bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this;
bool bPosChanged = (aPos.Tab() >= rCxt.mnDeletePos + rCxt.mnSheets);
pCode->Reset();
if (pDocument->IsClipOrUndo() || !pCode->GetNextReferenceRPN())
@@ -2840,6 +2847,9 @@ bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
if (bPosChanged)
aPos.IncTab(-1*rCxt.mnSheets);
+ if (!bAdjustCode)
+ return false;
+
sc::RefUpdateResult aRes = pCode->AdjustReferenceOnDeletedTab(rCxt, aOldPos);
if (aRes.mbNameModified)
// Re-compile after sheet(s) have been deleted.
@@ -2850,6 +2860,9 @@ bool ScFormulaCell::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo )
{
+ // Adjust tokens only when it's not grouped or grouped top cell.
+ bool bAdjustCode = !mxGroup || mxGroup->mpTopCell == this;
+
pCode->Reset();
if (!pCode->GetNextReferenceRPN() || pDocument->IsClipOrUndo())
{
@@ -2863,6 +2876,10 @@ void ScFormulaCell::UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTab
aPos.SetTab(nTabNo);
// no StartListeningTo because pTab[nTab] not yet correct!
+
+ if (!bAdjustCode)
+ return;
+
sc::RefUpdateResult aRes = pCode->AdjustReferenceOnMovedTab(rCxt, aOldPos);
if (aRes.mbNameModified)
// Re-compile after sheet(s) have been deleted.
More information about the Libreoffice-commits
mailing list