summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-03-24 05:09:53 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-03-24 05:14:18 +0100
commitda0a22fbdcfadf0df7bdde7ebacec85bae6344c9 (patch)
tree8c3c31497712d5a8f829769a5ed02b3d6533b674 /sc
parentd3d23f889a74ace0e4e71526df7aca18b1acaa03 (diff)
simplify the position update code in ScFormulaCell::UpdateReference
Change-Id: I2cf0fd0947df8e667f461aaf2c67095d2d42111d
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/cell2.cxx43
1 files changed, 2 insertions, 41 deletions
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 040890af935c..b4a78de9477c 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -861,49 +861,10 @@ bool ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
ScAddress aOldPos( aPos );
// bool bPosChanged = false; // if this cell was moved
bool bIsInsert = false;
- if (eUpdateRefMode == URM_INSDEL)
+ if (eUpdateRefMode == URM_INSDEL && r.In( aPos ))
{
bIsInsert = (nDx >= 0 && nDy >= 0 && nDz >= 0);
- if ( nDx && nRow >= nRow1 && nRow <= nRow2 &&
- nTab >= nTab1 && nTab <= nTab2 )
- {
- if (nCol >= nCol1)
- {
- nCol = sal::static_int_cast<SCCOL>( nCol + nDx );
- if ((SCsCOL) nCol < 0)
- nCol = 0;
- else if ( nCol > MAXCOL )
- nCol = MAXCOL;
- aPos.SetCol( nCol );
- }
- }
- if ( nDy && nCol >= nCol1 && nCol <= nCol2 &&
- nTab >= nTab1 && nTab <= nTab2 )
- {
- if (nRow >= nRow1)
- {
- nRow = sal::static_int_cast<SCROW>( nRow + nDy );
- if ((SCsROW) nRow < 0)
- nRow = 0;
- else if ( nRow > MAXROW )
- nRow = MAXROW;
- aPos.SetRow( nRow );
- }
- }
- if ( nDz && nCol >= nCol1 && nCol <= nCol2 &&
- nRow >= nRow1 && nRow <= nRow2 )
- {
- if (nTab >= nTab1)
- {
- SCTAB nMaxTab = pDocument->GetTableCount() - 1;
- nTab = sal::static_int_cast<SCTAB>( nTab + nDz );
- if ((SCsTAB) nTab < 0)
- nTab = 0;
- else if ( nTab > nMaxTab )
- nTab = nMaxTab;
- aPos.SetTab( nTab );
- }
- }
+ aPos.Move(nDx, nDy, nDz);
bCellStateChanged = aPos != aOldPos;
}
else if ( r.In( aPos ) )