[Libreoffice-commits] core.git: sw/source

Mike Kaganski mike.kaganski at collabora.com
Thu Nov 30 12:49:33 UTC 2017


 sw/source/core/layout/tabfrm.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 36423d18267e2ef3373bfb162e9b2e8062d01dd4
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Thu Nov 30 10:37:21 2017 +0200

    Don't do dynamic_cast twice
    
    Change-Id: I1f1f7c13937af3b84cc1a1eaf2f5036bab774579
    Reviewed-on: https://gerrit.libreoffice.org/45556
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

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<SwFlyFrame*>(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<SwFlyFrame*>(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<SwFlyFrame*>(pAnchoredObj);
                     ::lcl_InvalidateLowerObjs( *pFly, _bMoveObjsOutOfRange, _pPageFrame );
                 }
             }


More information about the Libreoffice-commits mailing list