sc/qa/unit/ucalc_formula.cxx | 5 +- sc/source/core/data/formulacell.cxx | 65 +++--------------------------------- 2 files changed, 9 insertions(+), 61 deletions(-)
New commits: commit e8b93b07408d437e04d00a4ff927b09184add57c Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Wed Jul 24 00:00:16 2013 -0400 I'm supposed to move it, not shift it. Change-Id: I3fe1f05a57089b42296e5758542772d69119c17a diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index ec6a6da..af5f96c 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -907,9 +907,10 @@ void Test::testFormulaRefUpdateMove() if (!checkFormula(*m_pDoc, ScAddress(1,12,0), "$D$6")) CPPUNIT_FAIL("Wrong formula."); - // The value cells are in D4:D6. Push D4:D5 to the right but leave D6 + // The value cells are in D4:D6. Move D4:D5 to the right but leave D6 // where it is. - m_pDoc->InsertCol(ScRange(3,0,0,3,4,0)); + bMoved = rFunc.MoveBlock(ScRange(3,3,0,3,4,0), ScAddress(4,3,0), true, false, false, false); + CPPUNIT_ASSERT_MESSAGE("Failed to move D4:D5 to E4:E5", bMoved); // Only the values of B10 and B11 should be updated. CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(1,9,0)); commit 641280e198cdd416a365adef12be30e0ef7d0977 Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Tue Jul 23 23:58:11 2013 -0400 There isn't much we have to do for copy. Change-Id: I4d297f15e8030fdf068c7e3102f9d03aff401cf9 diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 725c5d9..158dc85 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -2504,85 +2504,32 @@ bool ScFormulaCell::UpdateReferenceOnCopy( // on reference update. Bail out. return false; - bool bCellStateChanged = false; boost::scoped_ptr<ScTokenArray> pOldCode; if (pUndoDoc) pOldCode.reset(pCode->Clone()); - bool bValChanged = false; - bool bRangeModified = false; // any range, not only shared formula - bool bRefSizeChanged = false; - - if (bHasRefs) - { - // Update cell or range references. - ScCompiler aComp(pDocument, aPos, *pCode); - aComp.SetGrammar(pDocument->GetGrammar()); - aComp.UpdateReference( - URM_COPY, aOldPos, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, - bValChanged, bRefSizeChanged); - bRangeModified = aComp.HasModifiedRange(); - } - - bCellStateChanged |= bValChanged; - if (bOnRefMove) // Cell may reference itself, e.g. ocColumn, ocRow without parameter - bOnRefMove = (bValChanged || (aPos != aOldPos)); - - bool bColRowNameCompile = false; - bool bNewListening = false; - bool bInDeleteUndo = false; - - if (bHasRefs) - { - // 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, aOldPos, aPos, bValChanged); - - ScChangeTrack* pChangeTrack = pDocument->GetChangeTrack(); - bInDeleteUndo = (pChangeTrack && pChangeTrack->IsInDeleteUndo()); + bOnRefMove = (aPos != aOldPos); - // Reference changed and new listening needed? - // Except in Insert/Delete without specialties. - bNewListening = - (bRangeModified || bColRowNameCompile || (bValChanged && (bInDeleteUndo || bRefSizeChanged))); + bool bNeedDirty = bOnRefMove; - if ( bNewListening ) - EndListeningTo(pDocument, pOldCode.get(), aOldPos); - } - - bool bNeedDirty = false; - // NeedDirty for changes except for Copy and Move/Insert without RelNames - if ( bRangeModified || bColRowNameCompile || bOnRefMove) - bNeedDirty = true; - - if (pUndoDoc && (bValChanged || bOnRefMove)) + if (pUndoDoc && bOnRefMove) setOldCodeToUndo(pUndoDoc, aUndoPos, pOldCode.get(), eTempGrammar, cMatrixFlag); - bValChanged = false; - - if ( ( bCompile = (bCompile || bValChanged || bRangeModified || bColRowNameCompile) ) != 0 ) + if (bCompile) { - CompileTokenArray( bNewListening ); // no Listening + CompileTokenArray(false); // no Listening bNeedDirty = true; } - if ( !bInDeleteUndo ) - { // In ChangeTrack Delete-Reject listeners are established in - // InsertCol/InsertRow - if ( bNewListening ) - StartListeningTo( pDocument ); - } - if (bNeedDirty) { // Cut off references, invalid or similar? sc::AutoCalcSwitch(*pDocument, false); SetDirty(); } - return bCellStateChanged; + return false; } bool ScFormulaCell::UpdateReference( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits