summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-11-25 21:59:57 +0100
committerAron Budea <aron.budea@collabora.com>2021-12-03 06:02:48 +0100
commit8065f24a2a480aaafc8f7bb8441ff61607789f31 (patch)
treec994f338ae3e025d42eb7940592aa4497b62d106
parente60ec9fd734f3920e871474221453687cd622786 (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> (cherry picked from commit 788859c02f11d264ab04cec4a29a1bcaafc05c18) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126267 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Aron Budea <aron.budea@collabora.com>
-rw-r--r--sc/source/core/data/drwlayer.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 15440fa3f94b..3aa4649022ab 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -559,10 +559,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 ) );