From 8c103b56b91a3b5037300036b57e3d9f96d7255a Mon Sep 17 00:00:00 2001 From: Armin Le Grand Date: Fri, 17 Nov 2017 18:47:07 +0100 Subject: RotateFlyFrame3: Corrected wrong static_cast Change-Id: Ia3e0748d0b4ba11ec84a85e823472cdac9bf987a --- sw/source/core/layout/fly.cxx | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 569a0ec86282..8f440743b736 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2447,8 +2447,6 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour, if(bIsCandidate) { - const SwFlyFreeFrame* pSwFlyFreeFrame(static_cast< const SwFlyFreeFrame* >(this)); - if(GetFormat()->GetSurround().IsContour()) { SwNoTextNode *pNd = const_cast(static_cast(static_cast(Lower())->GetNode())); @@ -2543,6 +2541,8 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour, } else { + const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(this)); + if(nullptr != pSwFlyFreeFrame && pSwFlyFreeFrame->supportsAutoContour() && // isTransformableSwFrame already used in supportsAutoContour(), but @@ -2558,27 +2558,29 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour, } } - if(bRet && - 0 != rContour.Count() && - nullptr != pSwFlyFreeFrame && - pSwFlyFreeFrame->isTransformableSwFrame()) + if(bRet && 0 != rContour.Count()) { - // Need to adapt contour to transformation - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - getFrameAreaTransformation().decompose(aScale, aTranslate, fRotate, fShearX); + const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(this)); - if(!basegfx::fTools::equalZero(fRotate)) + if(nullptr != pSwFlyFreeFrame && pSwFlyFreeFrame->isTransformableSwFrame()) { - basegfx::B2DPolyPolygon aSource(rContour.getB2DPolyPolygon()); - const basegfx::B2DPoint aCenter(getFrameAreaTransformation() * basegfx::B2DPoint(0.5, 0.5)); - const basegfx::B2DHomMatrix aRotateAroundCenter( - basegfx::utils::createRotateAroundPoint( - aCenter.getX(), - aCenter.getY(), - fRotate)); - aSource.transform(aRotateAroundCenter); - rContour = tools::PolyPolygon(aSource); + // Need to adapt contour to transformation + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; + getFrameAreaTransformation().decompose(aScale, aTranslate, fRotate, fShearX); + + if(!basegfx::fTools::equalZero(fRotate)) + { + basegfx::B2DPolyPolygon aSource(rContour.getB2DPolyPolygon()); + const basegfx::B2DPoint aCenter(getFrameAreaTransformation() * basegfx::B2DPoint(0.5, 0.5)); + const basegfx::B2DHomMatrix aRotateAroundCenter( + basegfx::utils::createRotateAroundPoint( + aCenter.getX(), + aCenter.getY(), + fRotate)); + aSource.transform(aRotateAroundCenter); + rContour = tools::PolyPolygon(aSource); + } } } } -- cgit