From e7872589d53d85cecd34914125e08e9af4e3d50c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 5 Nov 2020 12:28:29 +0000 Subject: crashtesting: on import of ooo109115-1.ods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit since... commit 1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca Date: Sat Oct 10 17:55:31 2020 +0200 Improve 'resize with cell' handling pObj is (amazingly) actually an E3dScene not a SdrPathObj. E3dScene::GetObjIdentifier is... sal_uInt16 E3dScene::GetObjIdentifier() const { return E3D_SCENE_ID; } and E3D_SCENE_ID is.. const sal_uInt16 E3D_SCENE_ID = 2; but OBJ_LINE is also 2 ! so this E3dScene is cast to a SdrPathObj which it isn't. Seems you can only rely on the ObjIdentifier when you know the SdrInventor of the object, which seems unfortunate. just use a dynamic_cast for now Change-Id: Ic3d86e59c74d4f0436e294ce10d432681f312f96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105368 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sc/source/core/data/drwlayer.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 35a377813b4e..7790bf81f58e 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -910,13 +910,16 @@ void ScDrawLayer::InitializeCellAnchoredObj(SdrObject* pObj, ScDrawObjData& rDat const ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObj); if (aAnchorType == SCA_CELL_RESIZE) { + SdrPathObj* pLineObj = nullptr; if (pObj->GetObjIdentifier() == OBJ_LINE) + pLineObj = dynamic_cast(pObj); + if (pLineObj) { // Horizontal lines might have wrong start and end anchor because of erroneously applied // 180deg rotation (tdf#137446). Other lines have wrong end anchor. Coordinates in // object are correct. Use them for recreating the anchor. const basegfx::B2DPolygon aPoly( - reinterpret_cast(pObj)->GetPathPoly().getB2DPolygon(0)); + pLineObj->GetPathPoly().getB2DPolygon(0)); const basegfx::B2DPoint aB2DPoint0(aPoly.getB2DPoint(0)); const basegfx::B2DPoint aB2DPoint1(aPoly.getB2DPoint(1)); const Point aPointLT(FRound(std::min(aB2DPoint0.getX(), aB2DPoint1.getX())), -- cgit