sc/inc/address.hxx | 5 +++++ sc/source/core/tool/address.cxx | 11 +++++++++++ sc/source/core/tool/token.cxx | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit 21dfe37aca134b22cdbdb73fc29d30a89cd85524 Author: Eike Rathke <[email protected]> Date: Fri Dec 11 19:59:06 2015 +0100 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 diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 34d49fb..8ac565c 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -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? diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index e060f0a..f3df923 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -2148,6 +2148,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()); if (dy && aStart.Row() == 0 && aEnd.Row() == MAXROW) diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 29274ae..05221e7 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -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; } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
