sc/source/core/data/formulacell.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
New commits: commit 7dbd20530e95e77a3d7f850d832fed8be883220e Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Wed Jul 17 23:26:53 2013 -0400 Revert "old position == current position during cell insertion / deletion." This reverts commit 58df2af4afd82cb23e29de6623a58da3fb3f53f5. Conflicts: sc/source/core/data/formulacell.cxx Change-Id: I9bb1b3eef426e02dcbe83c850c34e520be381c71 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 1bafd7b..f74231a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2229,17 +2229,21 @@ bool ScFormulaCell::UpdateReferenceOnShift( // Just in case... return false; + bool bCellStateChanged = false; ScAddress aUndoPos( aPos ); // position for undo cell in pUndoDoc if ( pUndoCellPos ) aUndoPos = *pUndoCellPos; + ScAddress aOldPos( aPos ); if (rCxt.maRange.In(aPos)) { // This formula cell itself is being shifted during cell range // insertion or deletion. Update its position. aPos.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta); - if (xGroup && xGroup->mnStart == aPos.Row()) + if (xGroup && xGroup->mnStart == aOldPos.Row()) xGroup->mnStart += rCxt.mnRowDelta; + + bCellStateChanged = aPos != aOldPos; } // Check presence of any references or column row names. @@ -2257,9 +2261,8 @@ bool ScFormulaCell::UpdateReferenceOnShift( if (!bHasRefs && !bOnRefMove) // This formula cell contains no references, nor needs recalculating // on reference update. Bail out. - return false; + return bCellStateChanged; - bool bCellStateChanged = false; boost::scoped_ptr<ScTokenArray> pOldCode; if (pUndoDoc) pOldCode.reset(pCode->Clone()); @@ -2274,7 +2277,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( ScCompiler aComp(pDocument, aPos, *pCode); aComp.SetGrammar(pDocument->GetGrammar()); aComp.UpdateReference( - URM_INSDEL, aPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, + URM_INSDEL, aOldPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, bValChanged, bRefSizeChanged); bRangeModified = aComp.HasModifiedRange(); } @@ -2283,7 +2286,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( if (bOnRefMove) // Cell may reference itself, e.g. ocColumn, ocRow without parameter - bOnRefMove = bValChanged; + bOnRefMove = (bValChanged || (aPos != aOldPos)); bool bColRowNameCompile = false; bool bHasRelName = false; @@ -2295,7 +2298,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( // Upon Insert ColRowNames have to be recompiled in case the // insertion occurs right in front of the range. if (bHasColRowNames) - bColRowNameCompile = checkCompileColRowName(rCxt, *pDocument, *pCode, aPos, aPos, bValChanged); + bColRowNameCompile = checkCompileColRowName(rCxt, *pDocument, *pCode, aOldPos, aPos, bValChanged); ScChangeTrack* pChangeTrack = pDocument->GetChangeTrack(); bInDeleteUndo = (pChangeTrack && pChangeTrack->IsInDeleteUndo()); @@ -2308,7 +2311,7 @@ bool ScFormulaCell::UpdateReferenceOnShift( || (bValChanged && (bInDeleteUndo || bRefSizeChanged)) || bHasRelName); if ( bNewListening ) - EndListeningTo(pDocument, pOldCode.get(), aPos); + EndListeningTo(pDocument, pOldCode.get(), aOldPos); } bool bNeedDirty = false; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits