summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-11-28 19:28:29 +0100
committerRegina Henschel <rb.henschel@t-online.de>2019-12-11 23:42:39 +0100
commitf44140bebb9c493d97ba5aef26c9692c53a6b93f (patch)
tree6673c5852aed328a2d884f8615bb84a3a86a28c3 /sc/source
parent2ae964f88a4f1002a4fd8a804a079559c3d64196 (diff)
tdf#119191 Implement SdrObjCustomShape::AdjustToMaxRect
and use in ScDrawLayer::RecalcPos and in ScDrawView::FitToCellSize(). Error was, that it was assumed, that SdObjCustomShape::SetSnapRect() changes the shape so, that it fits into the passed rectangle. That is true for other type of shapes, but not for custom shapes. Change-Id: Ib00d52087509f459165000abf43c7f244980a01b Reviewed-on: https://gerrit.libreoffice.org/84216 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/drwlayer.cxx5
-rw-r--r--sc/source/ui/view/drawvie4.cxx6
2 files changed, 8 insertions, 3 deletions
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 4dd80df9a85a..515118d84c23 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1038,7 +1038,10 @@ void ScDrawLayer::RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegati
// order of these lines is important, modify rData.maLastRect carefully it is used as both
// a value and a flag for initialisation
rData.setShapeRect(GetDocument(), lcl_makeSafeRectangle(rData.getShapeRect()), pObj->IsVisible());
- pObj->SetSnapRect(rData.getShapeRect());
+ if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
+ pObj->AdjustToMaxRect(rData.getShapeRect());
+ else
+ pObj->SetSnapRect(rData.getShapeRect());
// update 'unrotated anchor' it's the anchor we persist, it must be kept in sync
// with the normal Anchor
ResizeLastRectFromAnchor( pObj, rNoRotatedAnchor, true, bNegativePage, bCanResize );
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index e1f0d04da7a4..25c64c2e5ef3 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -569,8 +569,10 @@ void ScDrawView::FitToCellSize()
}
pUndoGroup->AddAction( std::make_unique<SdrUndoGeoObj>( *pObj ) );
-
- pObj->SetSnapRect(aCellRect);
+ if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
+ pObj->AdjustToMaxRect(aCellRect);
+ else
+ pObj->SetSnapRect(aCellRect);
pUndoGroup->SetComment(ScResId( STR_UNDO_FITCELLSIZE ));
ScDocShell* pDocSh = pViewData->GetDocShell();