diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-11-17 18:47:07 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-11-18 13:07:47 +0100 |
commit | 0557a9aace85b7d47f77de758bb4f9f97303d07c (patch) | |
tree | 4dba868140c5f86a720745e8400b734453eb2086 | |
parent | 487ac20ecd73cf3d98071ba30cf5597d957017f7 (diff) |
RotateFlyFrame3: Corrected wrong static_cast
Change-Id: Ia3e0748d0b4ba11ec84a85e823472cdac9bf987a
-rw-r--r-- | sw/source/core/layout/fly.cxx | 42 |
1 files 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<SwNoTextNode*>(static_cast<const SwNoTextNode*>(static_cast<const SwContentFrame*>(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); + } } } } |