diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-11-25 21:59:57 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-12-01 17:10:02 +0100 |
commit | b0aabb865e93c8a9888179d9c2d228f43a81f571 (patch) | |
tree | d10f9ae76537fe1fdbdc06a29242297ef73e8f47 | |
parent | 220095cfcb355a81f65472e73476099504e0e531 (diff) |
tdf#144244: fix crash when FILESAVE a calc file after delete some columns
see bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=176507
Regression from 3238606c8470f3eaeada3fc601e186ec5cfac925
tdf138138 Apply shape shift also to NoRotatedAnchor
The 'normal' anchor (as on screen) is connected to the snap rectangle,
the NoRotatedAnchor is connected to the logic rectangle. They differ,
if the shape is transformed, e.g. rotated. Error was, that values of
the 'normal' anchor were applied to NoRotatedAnchor instead of
calculating the shift of NoRotatedAnchor independently. The error
becomes only visible on save, because there the NoRotatedAnchor is
used. Effected shape types are legacy shapes, text boxes and
transformable OLEs.
I have not tested, whether this fix would work for LO 7.0 too.
Let's apply the same controls as we do with ScDrawObjData retrieved with GetObjDataTab
Change-Id: I73cb3dd3c47a7ec55667e498d4a62842ce63d861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125852
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 1d45f84bd08c8d196fcf3c9baaf2cad010884e5c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126139
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 8addc5060844..57cc1640f00b 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -544,10 +544,18 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SC ScDrawObjData* pNoRotatedAnchor = GetNonRotatedObjData( pObj ); if ( pNoRotatedAnchor ) { - pNoRotatedAnchor->maStart.IncCol(nDx); - pNoRotatedAnchor->maStart.IncRow(nDy); - pNoRotatedAnchor->maEnd.IncCol(nDx); - pNoRotatedAnchor->maEnd.IncRow(nDy); + const ScAddress aOldSttNoRotatedAnchor = pNoRotatedAnchor->maStart; + const ScAddress aOldEndNoRotatedAnchor = pNoRotatedAnchor->maEnd; + if ( aOldSttNoRotatedAnchor.IsValid() && IsInBlock( aOldSttNoRotatedAnchor, nCol1,nRow1, nCol2,nRow2 ) ) + { + pNoRotatedAnchor->maStart.IncCol(nDx); + pNoRotatedAnchor->maStart.IncRow(nDy); + } + if ( aOldEndNoRotatedAnchor.IsValid() && IsInBlock( aOldEndNoRotatedAnchor, nCol1,nRow1, nCol2,nRow2 ) ) + { + pNoRotatedAnchor->maEnd.IncCol(nDx); + pNoRotatedAnchor->maEnd.IncRow(nDy); + } } AddCalcUndo( std::make_unique<ScUndoObjData>( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd ) ); |