diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2021-01-15 17:40:10 +0100 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2021-01-16 15:27:04 +0100 |
commit | 6ce66560c59470a9eb76fbf80f439b452166d3e4 (patch) | |
tree | 5cc9d882fd18e4971ca58c7dc119b9f0024aba63 /sc/source/core | |
parent | 19e5606df73994bbf6ddd8089843be645bd4d8be (diff) |
tdf#139583 fix case rot 180deg for cell anchored shapes
Method adjustAnchoredPosition() in ScDrawView::Notify() needs to
distinguish whether an object really has a changed geometry or only
becomes visible. The previous solution used the snap rectangle for this.
But in the case of a 180deg rotation only the logic rectangle changes,
not the snap rectangle. The patch extends the test to consider logic
rectangle as well. SetCellAnchoredFromPosition is adjusted to create
maShapeRect, which is compared to the logic rectangle.
Change-Id: Iba8a173938da05178f1058ef98e9ef526cca490e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109386
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 5d8f50d14be1..067b2bc38b0f 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -888,7 +888,6 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat // rNoRotatedAnchor refers in its start and end addresses and its start and end offsets to // the logic rectangle of the object. The values are so, as if no hidden columns and rows // exists and if it is a LTR sheet. These values are directly used for XML in ODF file. - // ToDO: Check whether its maShapeRect member is actually used. ScDrawObjData& rNoRotatedAnchor = *GetNonRotatedObjData(pObj, true /*bCreate*/); // From XML import, rData contains temporarily the anchor information as they are given in @@ -960,8 +959,9 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat true /*bUseLogicRect*/); } - // Make sure maShapeRect of rNoRotatedAnchor is not empty. ToDo: Really used? - // Currently ScExportTest::testMoveCellAnchoredShapesODS checks it. + // Make sure maShapeRect of rNoRotatedAnchor is not empty. Method ScDrawView::Notify() + // needs it to detect a change in object geometry. For example a 180deg rotation effects only + // logic rect. rNoRotatedAnchor.setShapeRect(GetDocument(), pObj->GetLogicRect(), true); // Start and end addresses and offsets in rData refer to the actual snap rectangle of the @@ -1178,8 +1178,7 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati pObj->SetSnapRect(rData.getShapeRect()); // update 'unrotated anchor' it's the anchor we persist, it must be kept in sync - // with the normal Anchor - // ToDo: Is maShapeRect of rNoRotatedAnchor used at all? + // with the normal Anchor. ResizeLastRectFromAnchor(pObj, rNoRotatedAnchor, true, bNegativePage, bCanResize); } } @@ -2245,6 +2244,11 @@ void ScDrawLayer::SetCellAnchoredFromPosition( SdrObject &rObj, const ScDocument aVisAnchor.mbResizeWithCell = bResizeWithCell; SetVisualCellAnchored( rObj, aVisAnchor ); + // And update maShapeRect. It is used in adjustAnchoredPosition() in ScDrawView::Notify(). + if (ScDrawObjData* pAnchor = GetNonRotatedObjData(&rObj)) + { + pAnchor->setShapeRect(&rDoc, rObj.GetSnapRect()); + } } void ScDrawLayer::GetCellAnchorFromPosition( |