summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-21 13:33:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-21 15:21:59 +0200
commitefacb4bc357761f5d849a4905eff981aa14eb366 (patch)
treef48c150d2813c01d6e0c041c8ec3fc79093d77a9 /sw
parent2e6e87decdb87221a7b832958e03195b1d8fc133 (diff)
replace dynamic_cast<SwFlyFreeFrame> with cheaper check
Change-Id: Ia84984e47c60eb8407bbddaf9e3365d9f7f52311 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117581 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/notxtfrm.cxx5
-rw-r--r--sw/source/core/layout/fly.cxx9
-rw-r--r--sw/source/core/layout/frmtool.cxx10
3 files changed, 13 insertions, 11 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index e4f2e071afba..05bb89d103ee 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -279,9 +279,10 @@ void SwNoTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect cons
// size instead of scaling it
if ( pGrfNd && rNoTNd.getIDocumentSettingAccess()->get( DocumentSettingId::CLIPPED_PICTURES ) )
{
- const SwFlyFreeFrame *pFly = dynamic_cast< const SwFlyFreeFrame* >( FindFlyFrame() );
- if( pFly )
+ auto pFindFly = FindFlyFrame();
+ if (pFindFly && pFindFly->IsFlyFreeFrame())
{
+ const SwFlyFreeFrame *pFly = static_cast< const SwFlyFreeFrame* >( pFindFly );
bool bGetUnclippedFrame=true;
const SfxPoolItem* pItem;
if( pFly->GetFormat() && SfxItemState::SET == pFly->GetFormat()->GetItemState(RES_BOX, false, &pItem) )
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 8181bd623d39..da5bc1c31272 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2730,9 +2730,9 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour,
bRet = true;
}
}
- else
+ else if (IsFlyFreeFrame())
{
- const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(this));
+ const SwFlyFreeFrame* pSwFlyFreeFrame(static_cast< const SwFlyFreeFrame* >(this));
if(nullptr != pSwFlyFreeFrame &&
pSwFlyFreeFrame->supportsAutoContour() &&
@@ -2751,9 +2751,8 @@ bool SwFlyFrame::GetContour( tools::PolyPolygon& rContour,
if(bRet && 0 != rContour.Count())
{
- const SwFlyFreeFrame* pSwFlyFreeFrame(dynamic_cast< const SwFlyFreeFrame* >(this));
-
- if(nullptr != pSwFlyFreeFrame && pSwFlyFreeFrame->isTransformableSwFrame())
+ if (IsFlyFreeFrame() &&
+ static_cast< const SwFlyFreeFrame* >(this)->isTransformableSwFrame())
{
// Need to adapt contour to transformation
basegfx::B2DVector aScale, aTranslate;
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 13350fef27c3..03c1f1bbfe02 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -704,9 +704,11 @@ SwFlyNotify::~SwFlyNotify()
// further notifications/invalidations, if format is called by grow/shrink
if ( !pFly->ConsiderObjWrapInfluenceOnObjPos() )
return;
- auto pFlyFreeFrame = dynamic_cast<SwFlyFreeFrame*>(pFly);
- if (pFlyFreeFrame && pFlyFreeFrame->IsNoMoveOnCheckClip())
- return;
+ if (pFly->IsFlyFreeFrame())
+ {
+ if (static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip())
+ return;
+ }
// #i54138# - suppress restart of the layout process
// on changed frame height.
@@ -2911,7 +2913,7 @@ static void lcl_AddObjsToPage( SwFrame* _pFrame, SwPageFrame* _pPage )
// anchored Writer fly frames from page
if ( auto pFlyFrame = dynamic_cast<SwFlyFrame*>( pObj) )
{
- if ( dynamic_cast<const SwFlyFreeFrame*>( pObj) != nullptr )
+ if (pFlyFrame->IsFlyFreeFrame())
{
_pPage->AppendFlyToPage( pFlyFrame );
}