summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-07 13:55:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-09 07:31:24 +0100
commit5ba447bdcd13ba3d7c27c8609f207910227e4ab6 (patch)
tree9a59e7058ef40be90867518590e35abb6c0615f5 /sw
parentea4a47d7d442d5d897cfa3a6e9f09ce3f1f233c5 (diff)
new loplugin simplifydynamiccast
simplify dynamic_cast followed by static_cast Change-Id: I965afcf05d1675094cfde53d3590a0fd00f26279 Reviewed-on: https://gerrit.libreoffice.org/44460 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/access/acccell.cxx3
-rw-r--r--sw/source/core/access/accframebase.cxx3
-rw-r--r--sw/source/core/access/accmap.cxx6
-rw-r--r--sw/source/core/doc/docdraw.cxx4
-rw-r--r--sw/source/core/docnode/node.cxx8
-rw-r--r--sw/source/core/draw/dcontact.cxx4
-rw-r--r--sw/source/core/draw/dview.cxx4
-rw-r--r--sw/source/core/frmedt/feshview.cxx13
-rw-r--r--sw/source/core/layout/atrfrm.cxx8
-rw-r--r--sw/source/core/layout/flowfrm.cxx3
-rw-r--r--sw/source/core/layout/flylay.cxx4
-rw-r--r--sw/source/core/layout/frmtool.cxx4
-rw-r--r--sw/source/core/layout/layact.cxx13
-rw-r--r--sw/source/core/layout/paintfrm.cxx6
-rw-r--r--sw/source/core/layout/tabfrm.cxx4
-rw-r--r--sw/source/core/text/txtfly.cxx4
-rw-r--r--sw/source/core/unocore/unoframe.cxx11
-rw-r--r--sw/source/uibase/app/apphdl.cxx4
-rw-r--r--sw/source/uibase/app/docsh.cxx4
19 files changed, 46 insertions, 64 deletions
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index 7e344f78ef14..be8f61a891d3 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -59,9 +59,8 @@ bool SwAccessibleCell::IsSelected()
assert(GetMap());
const SwViewShell *pVSh = GetMap()->GetShell();
assert(pVSh);
- if( dynamic_cast<const SwCursorShell*>( pVSh) != nullptr )
+ if( auto pCSh = dynamic_cast<const SwCursorShell*>(pVSh) )
{
- const SwCursorShell *pCSh = static_cast< const SwCursorShell * >( pVSh );
if( pCSh->IsTableMode() )
{
const SwCellFrame *pCFrame =
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index 7ca7d96aa934..221304bc3857 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -50,9 +50,8 @@ bool SwAccessibleFrameBase::IsSelected()
assert(GetMap());
const SwViewShell *pVSh = GetMap()->GetShell();
assert(pVSh);
- if( dynamic_cast<const SwFEShell*>( pVSh) != nullptr )
+ if( auto pFESh = dynamic_cast<const SwFEShell*>(pVSh) )
{
- const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
const SwFrame *pFlyFrame = pFESh->GetSelectedFlyFrame();
if( pFlyFrame == GetFrame() )
bRet = true;
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index cb065f10577d..66a022d49356 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -2507,17 +2507,15 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrame *pFrame )
SwAccessibleChild aFrameOrObj( pFrame );
bool bShapeSelected = false;
const SwViewShell *pVSh = GetShell();
- if( dynamic_cast<const SwCursorShell*>( pVSh) != nullptr )
+ if( auto pCSh = dynamic_cast<const SwCursorShell*>(pVSh) )
{
- const SwCursorShell *pCSh = static_cast< const SwCursorShell * >( pVSh );
if( pCSh->IsTableMode() )
{
while( aFrameOrObj.GetSwFrame() && !aFrameOrObj.GetSwFrame()->IsCellFrame() )
aFrameOrObj = aFrameOrObj.GetSwFrame()->GetUpper();
}
- else if( dynamic_cast<const SwFEShell*>( pVSh) != nullptr )
+ else if( auto pFESh = dynamic_cast<const SwFEShell*>(pVSh) )
{
- const SwFEShell *pFESh = static_cast< const SwFEShell * >( pVSh );
const SwFrame *pFlyFrame = pFESh->GetSelectedFlyFrame();
if( pFlyFrame )
{
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index d57ce3cd6fa1..a7f68a62f30c 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -185,10 +185,8 @@ static void lcl_AdjustPositioningAttr( SwDrawFrameFormat* _pFrameFormat,
// to adjust the positioning attributes - see <SwDrawContact::Changed_(..)>.
{
const SwAnchoredObject* pAnchoredObj = pContact->GetAnchoredObj( &_rSdrObj );
- if ( dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) != nullptr )
+ if ( auto pAnchoredDrawObj = dynamic_cast<const SwAnchoredDrawObject*>( pAnchoredObj) )
{
- const SwAnchoredDrawObject* pAnchoredDrawObj =
- static_cast<const SwAnchoredDrawObject*>(pAnchoredObj);
const SwRect aObjRect = _rSdrObj.GetSnapRect();
const_cast<SwAnchoredDrawObject*>(pAnchoredDrawObj)
->SetLastObjRect( aObjRect.SVRect() );
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 85052d36338e..5e242f388a83 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -674,10 +674,10 @@ const SwPageDesc* SwNode::FindPageDesc( size_t* pPgDescNdIdx ) const
static_cast<const SwFormatPageDesc*>(pItem)->GetDefinedIn() )
{
const SwModify* pMod = static_cast<const SwFormatPageDesc*>(pItem)->GetDefinedIn();
- if( dynamic_cast<const SwContentNode*>( pMod) != nullptr )
- aInfo.CheckNode( *static_cast<const SwContentNode*>(pMod) );
- else if( dynamic_cast<const SwFormat*>( pMod) != nullptr)
- static_cast<const SwFormat*>(pMod)->GetInfo( aInfo );
+ if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
+ aInfo.CheckNode( *pContentNode );
+ else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
+ pFormat->GetInfo( aInfo );
}
}
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index b0ef8d2a0600..2cc3235b8846 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -754,9 +754,9 @@ const SwAnchoredObject* SwDrawContact::GetAnchoredObj(const SdrObject* pSdrObj )
const SwAnchoredObject* pRetAnchoredObj = nullptr;
- if (dynamic_cast<const SwDrawVirtObj*>(pSdrObj) != nullptr)
+ if (auto pVirtObj = dynamic_cast<const SwDrawVirtObj*>(pSdrObj))
{
- pRetAnchoredObj = &(static_cast<const SwDrawVirtObj*>(pSdrObj)->GetAnchoredObj());
+ pRetAnchoredObj = &(pVirtObj->GetAnchoredObj());
}
else
{
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index a728ba56d4b7..e34e167822e9 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -821,9 +821,9 @@ void SwDrawView::CheckPossibilities()
{
const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
const SwFrame *pFrame = nullptr;
- if ( dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr )
+ if ( auto pVirtFlyDrawObj = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) )
{
- const SwFlyFrame *pFly = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrame();
+ const SwFlyFrame *pFly = pVirtFlyDrawObj->GetFlyFrame();
if ( pFly )
{
pFrame = pFly->GetAnchorFrame();
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 72dbf52493da..9308d78c5afe 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1426,10 +1426,10 @@ static bool lcl_IsControlGroup( const SdrObject *pObj )
bool bRet = false;
if(dynamic_cast<const SdrUnoObj*>( pObj) != nullptr)
bRet = true;
- else if( dynamic_cast<const SdrObjGroup*>( pObj) != nullptr )
+ else if( auto pObjGroup = dynamic_cast<const SdrObjGroup*>( pObj) )
{
bRet = true;
- const SdrObjList *pLst = static_cast<const SdrObjGroup*>(pObj)->GetSubList();
+ const SdrObjList *pLst = pObjGroup->GetSubList();
for ( size_t i = 0; i < pLst->GetObjCount(); ++i )
if( !::lcl_IsControlGroup( pLst->GetObj( i ) ) )
return false;
@@ -1493,8 +1493,8 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool
if ( rMrkList.GetMarkCount() )
{
const SdrObject* pStartObj = rMrkList.GetMark(0)->GetMarkedSdrObj();
- if( dynamic_cast<const SwVirtFlyDrawObj*>( pStartObj) != nullptr )
- aPos = static_cast<const SwVirtFlyDrawObj*>(pStartObj)->GetFlyFrame()->getFrameArea().Pos();
+ if( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pStartObj) )
+ aPos = pVirtFlyDrawObj->GetFlyFrame()->getFrameArea().Pos();
else
aPos = pStartObj->GetSnapRect().TopLeft();
@@ -2378,10 +2378,9 @@ bool SwFEShell::IsGroupAllowed() const
if ( bIsGroupAllowed )
{
const SwFrame* pAnchorFrame = nullptr;
- if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+ if ( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
{
- const SwFlyFrame* pFlyFrame =
- static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrame();
+ const SwFlyFrame* pFlyFrame = pVirtFlyDrawObj->GetFlyFrame();
if ( pFlyFrame )
{
pAnchorFrame = pFlyFrame->GetAnchorFrame();
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 76bc2b14a944..dcf2458da246 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -632,10 +632,10 @@ void SwFormatPageDesc::SwClientNotify( const SwModify& rModify, const SfxHint& r
const SwModify* pMod = GetDefinedIn();
if ( pMod )
{
- if( dynamic_cast<const SwContentNode*>( pMod) != nullptr )
- const_cast<SwContentNode*>(static_cast<const SwContentNode*>(pMod))->SetAttr( aDfltDesc );
- else if( dynamic_cast<const SwFormat*>( pMod) != nullptr)
- const_cast<SwFormat*>(static_cast<const SwFormat*>(pMod))->SetFormatAttr( aDfltDesc );
+ if( auto pContentNode = dynamic_cast<const SwContentNode*>( pMod) )
+ const_cast<SwContentNode*>(pContentNode)->SetAttr( aDfltDesc );
+ else if( auto pFormat = dynamic_cast<const SwFormat*>( pMod) )
+ const_cast<SwFormat*>(pFormat)->SetFormatAttr( aDfltDesc );
else
{
OSL_FAIL( "What kind of SwModify is this?" );
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index b12bf063cd08..bf4f102b1409 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -309,9 +309,8 @@ sal_uInt8 SwFlowFrame::BwdMoveNecessary( const SwPageFrame *pPage, const SwRect
if( m_rThis.IsLayoutFrame() && //Fly Lower of This?
Is_Lower_Of( &m_rThis, pObj->GetDrawObj() ) )
continue;
- if( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
+ if( auto pFly = dynamic_cast<const SwFlyFrame*>(pObj) )
{
- const SwFlyFrame *pFly = static_cast<const SwFlyFrame*>(pObj);
if ( pFly->IsAnLower( &m_rThis ) )//This Lower of Fly?
continue;
}
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 0f47449e468a..f0ef660adb88 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -945,9 +945,9 @@ void SwPageFrame::PlaceFly( SwFlyFrame* pFly, SwFlyFrameFormat* pFormat )
bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove )
{
bool bRet = true;
- if ( dynamic_cast<const SwVirtFlyDrawObj*>( pSdrObj) != nullptr )
+ if ( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) )
{
- const SwFlyFrame* pFly = static_cast<const SwVirtFlyDrawObj*>(pSdrObj)->GetFlyFrame();
+ const SwFlyFrame* pFly = pVirtFlyDrawObj->GetFlyFrame();
const bool bFollowTextFlow = pFly->GetFormat()->GetFollowTextFlow().GetValue();
// #i28701#
const bool bConsiderWrapOnObjPos =
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 2da161f7b5ba..1c536f45aacd 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2823,9 +2823,9 @@ void Notify_Background( const SdrObject* pObj,
SwLayoutFrame* pArea;
SwFlyFrame *pFlyFrame = nullptr;
SwFrame* pAnchor;
- if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+ if( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
{
- pFlyFrame = const_cast<SwVirtFlyDrawObj*>(static_cast<const SwVirtFlyDrawObj*>(pObj))->GetFlyFrame();
+ pFlyFrame = const_cast<SwVirtFlyDrawObj*>(pVirtFlyDrawObj)->GetFlyFrame();
pAnchor = pFlyFrame->AnchorFrame();
}
else
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 6efbee92bc89..7b23377bb48d 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -893,9 +893,8 @@ static const SwFrame *lcl_FindFirstInvaContent( const SwLayoutFrame *pLay, long
const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
for (SwAnchoredObject* pObj : rObjs)
{
- if ( dynamic_cast< const SwFlyFrame *>( pObj ) != nullptr )
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pObj ) )
{
- const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pObj);
if ( pFly->IsFlyInContentFrame() )
{
if ( static_cast<const SwFlyInContentFrame*>(pFly)->IsInvalid() ||
@@ -928,9 +927,8 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrame* _pPage,
for (SwAnchoredObject* pObj : *_pPage->GetSortedObjs())
{
- if ( dynamic_cast< const SwFlyFrame *>( pObj ) != nullptr )
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pObj ) )
{
- const SwFlyFrame* pFly = static_cast<const SwFlyFrame*>(pObj);
if ( pFly->getFrameArea().Top() <= _nBottom )
{
if ( pFly->IsInvalid() || pFly->IsCompletePaint() )
@@ -942,9 +940,9 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( const SwPageFrame* _pPage,
return pFly;
}
}
- else if ( dynamic_cast< const SwAnchoredDrawObject *>( pObj ) != nullptr )
+ else if ( auto pDrawObject = dynamic_cast< const SwAnchoredDrawObject *>( pObj ) )
{
- if ( !static_cast<const SwAnchoredDrawObject*>(pObj)->IsValidPos() )
+ if ( !pDrawObject->IsValidPos() )
{
return pObj;
}
@@ -2018,9 +2016,8 @@ bool SwLayIdle::DoIdleJob( IdleJobType eJob, bool bVisAreaOnly )
i < pPage->GetSortedObjs()->size(); ++i )
{
const SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
- if ( dynamic_cast< const SwFlyFrame *>( pObj ) != nullptr )
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pObj ) )
{
- const SwFlyFrame *pFly = static_cast<const SwFlyFrame*>(pObj);
const SwContentFrame *pC = pFly->ContainsContent();
while( pC )
{
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 0f88770afa8c..99cd4b342f1b 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7051,9 +7051,8 @@ void SwPageFrame::RefreshExtraData( const SwRect &rRect ) const
if ( bLineInFly && GetSortedObjs() )
for (SwAnchoredObject* pAnchoredObj : *GetSortedObjs())
{
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) )
{
- const SwFlyFrame *pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
if ( pFly->getFrameArea().Top() <= aRect.Bottom() &&
pFly->getFrameArea().Bottom() >= aRect.Top() )
pFly->RefreshExtraData( aRect );
@@ -7085,9 +7084,8 @@ void SwLayoutFrame::RefreshExtraData( const SwRect &rRect ) const
if ( bLineInFly && pCnt->GetDrawObjs() )
for (SwAnchoredObject* pAnchoredObj : *pCnt->GetDrawObjs())
{
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) )
{
- const SwFlyFrame *pFly = static_cast<const SwFlyFrame*>(pAnchoredObj);
if ( pFly->IsFlyInContentFrame() &&
pFly->getFrameArea().Top() <= rRect.Bottom() &&
pFly->getFrameArea().Bottom() >= rRect.Top() )
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index cc3a2f8d0058..245d636b4552 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5081,10 +5081,8 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
if ( bConsiderWrapOnObjPos || css::text::WrapTextMode_THROUGH != rSur.GetSurround() )
{
// frames, which the cell is a lower of, aren't relevant
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ if ( auto pFly = dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) )
{
- const SwFlyFrame *pFly =
- static_cast<const SwFlyFrame*>(pAnchoredObj);
if ( pFly->IsAnLower( this ) )
continue;
}
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 7404f101e47a..fff55186d725 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -220,12 +220,12 @@ const SwRect SwContourCache::ContourRect( const SwFormat* pFormat,
::basegfx::B2DPolyPolygon aPolyPolygon;
::basegfx::B2DPolyPolygon* pPolyPolygon = nullptr;
- if ( dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr )
+ if ( auto pVirtFlyDrawObj = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) )
{
// GetContour() causes the graphic to be loaded, which may cause
// the graphic to change its size, call ClrObject()
tools::PolyPolygon aPoly;
- if( !static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrame()->GetContour( aPoly ) )
+ if( !pVirtFlyDrawObj->GetFlyFrame()->GetContour( aPoly ) )
aPoly = tools::PolyPolygon( static_cast<const SwVirtFlyDrawObj*>(pObj)->
GetFlyFrame()->getFrameArea().SVRect() );
aPolyPolygon.clear();
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 7d81aa8a3b40..d907daa6ce6a 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1548,11 +1548,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
{
// see SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Point* pDocPos )
SwFlyFrame *pFly = nullptr;
- {
- const SwFrameFormat* pFormatXX = pFormat;
- if (dynamic_cast<const SwFlyFrameFormat*>( pFormatXX) )
- pFly = static_cast<const SwFlyFrameFormat*>(pFormatXX)->GetFrame();
- }
+ if (auto pFlyFrameFormat = dynamic_cast<const SwFlyFrameFormat*>(pFormat) )
+ pFly = pFlyFrameFormat->GetFrame();
if ( pFly )
{
const ::SfxPoolItem* pItem;
@@ -1933,8 +1930,8 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
{
// see SwFEShell::SetFlyFrameAttr( SfxItemSet& rSet )
SwFlyFrame *pFly = nullptr;
- if (dynamic_cast<SwFlyFrameFormat*>( pFormat) )
- pFly = static_cast<SwFlyFrameFormat*>(pFormat)->GetFrame();
+ if (auto pFrameFormat = dynamic_cast<SwFlyFrameFormat*>( pFormat) )
+ pFly = pFrameFormat->GetFrame();
if (pFly)
{
const ::SfxPoolItem* pItem;
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index e3fd77c077ff..467112e58956 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -974,9 +974,9 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, Con
const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
while( pObjSh )
{
- if( dynamic_cast<const SwDocShell*>(pObjSh) != nullptr )
+ if( auto pDocShell = dynamic_cast<const SwDocShell*>(pObjSh) )
{
- SwDoc* pDoc = const_cast<SwDocShell*>(static_cast<const SwDocShell*>(pObjSh))->GetDoc();
+ SwDoc* pDoc = const_cast<SwDocShell*>(pDocShell)->GetDoc();
SwViewShell* pVSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
if ( pVSh )
pVSh->ChgNumberDigits();
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 445a4404eb2c..8f50bc411834 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -1147,8 +1147,8 @@ void SwDocShell::LoadingFinished()
if(pVFrame)
{
SfxViewShell* pShell = pVFrame->GetViewShell();
- if(dynamic_cast<SwSrcView*>( pShell) )
- static_cast<SwSrcView*>(pShell)->Load(this);
+ if(auto pSrcView = dynamic_cast<SwSrcView*>( pShell) )
+ pSrcView->Load(this);
}
// #i38810#