Kaydet (Commit) 478917a2 authored tarafından Eike Rathke's avatar Eike Rathke

separate ScRange::Move() and MoveSticky(), tdf#92779

To selectively use the sticky mechanism, i.e. not in an actual move of a
range during cut&paste or drag&drop. Actually currently only in
ScTokenArray::AdjustReferenceOnShift()

Change-Id: I223e5013e4b820efb4ecb9e8ce8aa04a8bc01e27
(cherry picked from commit 21dfe37a)
üst 208c247e
......@@ -551,6 +551,11 @@ public:
*/
SC_DLLPUBLIC SAL_WARN_UNUSED_RESULT bool Move( SCsCOL aDeltaX, SCsROW aDeltaY, SCsTAB aDeltaZ,
ScRange& rErrorRange, ScDocument* pDocument = nullptr );
/** Same as Move() but with sticky end col/row anchors. */
SC_DLLPUBLIC SAL_WARN_UNUSED_RESULT bool MoveSticky( SCsCOL aDeltaX, SCsROW aDeltaY, SCsTAB aDeltaZ,
ScRange& rErrorRange, ScDocument* pDocument = nullptr );
SC_DLLPUBLIC void ExtendTo( const ScRange& rRange );
SC_DLLPUBLIC bool Intersects( const ScRange& rRange ) const; // do two ranges intersect?
......
......@@ -2147,6 +2147,17 @@ bool ScAddress::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScAddress& rErrorPos, ScD
}
bool ScRange::Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScRange& rErrorRange, ScDocument* pDoc )
{
if (dy && aStart.Row() == 0 && aEnd.Row() == MAXROW)
dy = 0; // Entire column not to be moved.
if (dx && aStart.Col() == 0 && aEnd.Col() == MAXCOL)
dx = 0; // Entire row not to be moved.
bool b = aStart.Move( dx, dy, dz, rErrorRange.aStart, pDoc );
b &= aEnd.Move( dx, dy, dz, rErrorRange.aEnd, pDoc );
return b;
}
bool ScRange::MoveSticky( SCsCOL dx, SCsROW dy, SCsTAB dz, ScRange& rErrorRange, ScDocument* pDoc )
{
bool bColRange = (aStart.Col() < aEnd.Col());
bool bRowRange = (aStart.Row() < aEnd.Row());
......
......@@ -2969,7 +2969,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
if (rCxt.maRange.In(aAbs))
{
ScRange aErrorRange( ScAddress::UNINITIALIZED );
if (!aAbs.Move(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, aErrorRange))
if (!aAbs.MoveSticky(rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta, aErrorRange))
aAbs = aErrorRange;
aRes.mbReferenceModified = true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment