diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-11-25 21:59:57 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-12-01 18:11:26 +0100 |
commit | 788859c02f11d264ab04cec4a29a1bcaafc05c18 (patch) | |
tree | 9400105a5f113bc855639e55b121eb006f492180 /sc | |
parent | 7174f9ac911461e68badeac0e39ca3c2fd1abcef (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/+/126140
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-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 1ead0b8fe872..ab70efe5a7ce 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -547,10 +547,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 ) ); |