From 4b2f0915f9f3bff7d2476ec41a272e5263fbb312 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Sun, 12 Oct 2014 10:18:09 -0400 Subject: [PATCH] fdo#83901: ROW() and COLUMN() to be properly recalculated on cell move. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For cases where ROW or COLUMN references another cell that has shifted. Change-Id: Ic4bef8672dab811ceff6886d9af0388306a66485 (cherry picked from commit 0b29a16d1dcffd75e49bd7ad3da867b0d0ebfa38) Reviewed-on: https://gerrit.libreoffice.org/11934 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sc/source/core/data/column.cxx | 6 ++++++ sc/source/core/data/formulacell.cxx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 1676e1b..42da658 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -2096,6 +2096,12 @@ class UpdateRefOnNonCopy : std::unary_function if (pCode->IsRecalcModeOnRefMove()) aRes.mbValueChanged = true; } + else if (aRes.mbReferenceModified && pCode->IsRecalcModeOnRefMove()) + { + // The cell itself hasn't shifted. But it may have ROW or COLUMN + // referencing another cell that has. + aRes.mbValueChanged = true; + } if (aRes.mbNameModified) recompileTokenArray(*pTop); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 2059aee..96eb323 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2758,7 +2758,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( if (bOnRefMove) // Cell may reference itself, e.g. ocColumn, ocRow without parameter - bOnRefMove = (bValChanged || (aPos != aOldPos)); + bOnRefMove = (bValChanged || (aPos != aOldPos) || bRefModified); bool bNewListening = false; bool bInDeleteUndo = false; -- 1.9.3