diff options
author | Eike Rathke <erack@redhat.com> | 2015-12-11 14:27:33 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-12-11 14:44:41 +0100 |
commit | 9c1ba0988f5db05bb796eaf7cf902a0b601c6736 (patch) | |
tree | 0dca46f5fe5ed8e710115ab0735c748e2373a3d5 /sc/inc | |
parent | edbe61b671bc4c384be914099ee8bcdfd8491f3a (diff) |
geez, how about actually checking the Move() error return? tdf#92779 related
Handle failure condition where we know how to treat it, i.e. when
updating references, assert in all other places that so far silently
ignored it and implicitly assumed the failing Move() truncating at
bounds would be alright. In case we'll encounter an assertion we'll have
to inspect those places and decide what to do about it.
Noticed this error with a reference like B1048575 and inserting two rows
above, it became B1048576 instead of B#REF!
Change-Id: I00757f3ed2e305b591178047933ed60f1533317e
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/address.hxx | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 4bf5ee5404e4..34d49fbb714b 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -305,9 +305,15 @@ public: const ScDocument* pDocument = nullptr, const Details& rDetails = detailsOOOa1) const; - // The document for the maximum defined sheet number - SC_DLLPUBLIC bool Move( SCsCOL nDeltaX, SCsROW nDeltaY, SCsTAB nDeltaZ, - ScDocument* pDocument = nullptr ); + /** + @param rErrorPos + If FALSE is returned, the positions contain <0 or >MAX... + values if shifted out of bounds. + @param pDocument + The document for the maximum defined sheet number. + */ + SC_DLLPUBLIC SAL_WARN_UNUSED_RESULT bool Move( SCsCOL nDeltaX, SCsROW nDeltaY, SCsTAB nDeltaZ, + ScAddress& rErrorPos, ScDocument* pDocument = nullptr ); inline bool operator==( const ScAddress& rAddress ) const; inline bool operator!=( const ScAddress& rAddress ) const; @@ -535,8 +541,16 @@ public: inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1, SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const; SC_DLLPUBLIC void PutInOrder(); - // The document for the maximum defined sheet number - SC_DLLPUBLIC bool Move( SCsCOL aDeltaX, SCsROW aDeltaY, SCsTAB aDeltaZ, ScDocument* pDocument = nullptr ); + + /** + @param rErrorRange + If FALSE is returned, the positions contain <0 or >MAX... + values if shifted out of bounds. + @param pDocument + The document for the maximum defined sheet number. + */ + SC_DLLPUBLIC SAL_WARN_UNUSED_RESULT bool Move( 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? |