From 36423d18267e2ef3373bfb162e9b2e8062d01dd4 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 30 Nov 2017 10:37:21 +0200 Subject: Don't do dynamic_cast twice Change-Id: I1f1f7c13937af3b84cc1a1eaf2f5036bab774579 Reviewed-on: https://gerrit.libreoffice.org/45556 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/source/core/layout/tabfrm.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sw') diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 2e39abf3c40e..6a4654d7e5e8 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -259,6 +259,8 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrame& _rLayoutFrame, pAnchoredObj->UnlockPosition(); pAnchoredObj->InvalidateObjPos(); + SwFlyFrame *pFly = dynamic_cast(pAnchoredObj); + // move anchored object 'out of range' if ( _bMoveObjsOutOfRange ) { @@ -279,18 +281,16 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrame& _rLayoutFrame, ->Prepare( PREP_FLY_ATTR_CHG, &(pAnchoredObj->GetFrameFormat()) ); } - if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) + if ( pFly != nullptr ) { - SwFlyFrame *pFly = static_cast(pAnchoredObj); pFly->GetVirtDrawObj()->SetRectsDirty(); pFly->GetVirtDrawObj()->SetChanged(); } } // If anchored object is a fly frame, invalidate its lower objects - if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr ) + if ( pFly != nullptr ) { - SwFlyFrame *pFly = static_cast(pAnchoredObj); ::lcl_InvalidateLowerObjs( *pFly, _bMoveObjsOutOfRange, _pPageFrame ); } } -- cgit