diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-05 08:37:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-06 13:08:26 +0100 |
commit | bd37588605f7773d41b5388b18952e5c90f12214 (patch) | |
tree | 498116ae9376e7671bf0441e476dad16f2bd197e /sw | |
parent | 4474d167e1b69ab9ca8a97c636f0400a5084641a (diff) |
loplugin:staticdynamic look for static after dynamic
Change-Id: Ic3066d9a9441e369370cc6aa0fbffb9a321bc928
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111985
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/accmap.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/draw/dview.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/frmedt/fews.cxx | 5 |
4 files changed, 14 insertions, 16 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index cfb598f6cd32..95c1891057f6 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1164,8 +1164,7 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() size_t nShapes = 0; const SwViewShell *pVSh = GetShell(); - const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pVSh) != nullptr ? - static_cast< const SwFEShell * >( pVSh ) : nullptr; + const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>(pVSh); SwPaM* pCursor = pFESh ? pFESh->GetCursor( false /* ??? */ ) : nullptr; //const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; @@ -1501,8 +1500,7 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa size_t nShapes = 0; const SwViewShell *pVSh = GetShell(); - const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pVSh) != nullptr ? - static_cast< const SwFEShell * >( pVSh ) : nullptr; + const SwFEShell *pFESh = dynamic_cast<const SwFEShell*>(pVSh); const size_t nSelShapes = pFESh ? pFESh->IsObjSelected() : 0; //when InvalidateFocus Call this function ,and the current selected shape count is not 1 , diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index b586536403c1..bd0b40063a8e 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -714,12 +714,12 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, // #i115719# // <title> and <description> attributes are lost when calling <DelFrames()>. // Thus, keep them and restore them after the calling <MakeFrames()> - const bool bIsSwFlyFrameFormatInstance( dynamic_cast<SwFlyFrameFormat*>(pOldFormat) != nullptr ); - const OUString sTitle( bIsSwFlyFrameFormatInstance - ? static_cast<SwFlyFrameFormat*>(pOldFormat)->GetObjTitle() + auto pOldFlyFrameFormat = dynamic_cast<SwFlyFrameFormat*>(pOldFormat); + const OUString sTitle( pOldFlyFrameFormat + ? pOldFlyFrameFormat->GetObjTitle() : OUString() ); - const OUString sDescription( bIsSwFlyFrameFormatInstance - ? static_cast<SwFlyFrameFormat*>(pOldFormat)->GetObjDescription() + const OUString sDescription( pOldFlyFrameFormat + ? pOldFlyFrameFormat->GetObjDescription() : OUString() ); pOldFormat->DelFrames(); @@ -867,10 +867,10 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, // We leave this to established methods (especially for InCntFlys). pNewFormat->MakeFrames(); // #i115719# - if ( bIsSwFlyFrameFormatInstance ) + if ( pOldFlyFrameFormat ) { - static_cast<SwFlyFrameFormat*>(pOldFormat)->SetObjTitle( sTitle ); - static_cast<SwFlyFrameFormat*>(pOldFormat)->SetObjDescription( sDescription ); + pOldFlyFrameFormat->SetObjTitle( sTitle ); + pOldFlyFrameFormat->SetObjDescription( sDescription ); } } break; diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 4512543cadfb..5ae8d93b0778 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -79,8 +79,7 @@ bool SwSdrHdl::IsFocusHdl() const static const SwFrame *lcl_FindAnchor( const SdrObject *pObj, bool bAll ) { - const SwVirtFlyDrawObj *pVirt = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr ? - static_cast<const SwVirtFlyDrawObj*>(pObj) : nullptr; + const SwVirtFlyDrawObj *pVirt = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ); if ( pVirt ) { if ( bAll || !pVirt->GetFlyFrame()->IsFlyInContentFrame() ) diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index fd1d137b15f4..0d6519dba776 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -1299,8 +1299,9 @@ bool SwFEShell::IsFrameVertical(const bool bEnvironment, bool& bRTL, bool& bVert return bVert; } - if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr && !bEnvironment ) - pRef = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrame(); + if ( !bEnvironment ) + if ( auto pVirtFly = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) ) + pRef = pVirtFly->GetFlyFrame(); bVert = pRef->IsVertical(); bRTL = pRef->IsRightToLeft(); |