[Libreoffice-commits] core.git: sw/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 13 11:30:12 UTC 2020
sw/source/core/crsr/crsrsh.cxx | 3 +--
sw/source/core/crsr/trvltbl.cxx | 6 +++---
sw/source/core/doc/CntntIdxStore.cxx | 8 ++++----
sw/source/core/doc/doccorr.cxx | 12 ++++++------
sw/source/core/doc/docdesc.cxx | 4 ++--
sw/source/core/doc/docdraw.cxx | 11 +++++------
sw/source/core/docnode/nodes.cxx | 5 ++---
sw/source/core/draw/dcontact.cxx | 7 +++----
sw/source/core/draw/dview.cxx | 29 ++++++++++++-----------------
sw/source/core/edit/edundo.cxx | 4 ++--
sw/source/core/edit/edws.cxx | 4 ++--
sw/source/core/frmedt/fecopy.cxx | 4 ++--
sw/source/core/frmedt/feshview.cxx | 26 ++++++++++++--------------
sw/source/core/frmedt/fetab.cxx | 5 ++---
sw/source/core/layout/atrfrm.cxx | 4 ++--
15 files changed, 60 insertions(+), 72 deletions(-)
New commits:
commit 51f807841a9242eec85172c6503083294c0c0042
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Tue Oct 13 12:12:31 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Oct 13 13:29:26 2020 +0200
static_cast after dynamic_cast
Change-Id: I68c20dfbedb84660cf25df785e1e0b13a7592994
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104229
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index db3106707482..72269f071b84 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2881,9 +2881,8 @@ void SwCursorShell::ParkCursor( const SwNodeIndex &rIdx )
// take care of all shells
for(SwViewShell& rTmp : GetRingContainer())
{
- if( dynamic_cast<const SwCursorShell *>(&rTmp) != nullptr)
+ if( auto pSh = dynamic_cast<SwCursorShell *>(&rTmp))
{
- SwCursorShell* pSh = static_cast<SwCursorShell*>(&rTmp);
if (pSh->m_pStackCursor)
pSh->ParkPams(pNew.get(), &pSh->m_pStackCursor);
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 835304a9e6c9..fb093622b51a 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -917,9 +917,9 @@ bool SwCursorShell::EndAllTableBoxEdit()
bool bRet = false;
for(SwViewShell& rSh : GetRingContainer())
{
- if( dynamic_cast<const SwCursorShell *>(&rSh) != nullptr )
- bRet |= static_cast<SwCursorShell*>(&rSh)->CheckTableBoxContent(
- static_cast<SwCursorShell*>(&rSh)->m_pCurrentCursor->GetPoint() );
+ if( auto pCursorShell = dynamic_cast<SwCursorShell *>(&rSh) )
+ bRet |= pCursorShell->CheckTableBoxContent(
+ pCursorShell->m_pCurrentCursor->GetPoint() );
}
return bRet;
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 145126ea3633..0656d172b9de 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -438,9 +438,9 @@ void ContentIdxStoreImpl::SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int
return;
for(SwViewShell& rCurShell : pShell->GetRingContainer())
{
- if( dynamic_cast<const SwCursorShell *>(&rCurShell) != nullptr )
+ if( auto pCursorShell = dynamic_cast<SwCursorShell *>(&rCurShell) )
{
- SwPaM *_pStackCursor = static_cast<SwCursorShell*>(&rCurShell)->GetStackCursor();
+ SwPaM *_pStackCursor = pCursorShell->GetStackCursor();
if( _pStackCursor )
for (;;)
{
@@ -448,11 +448,11 @@ void ContentIdxStoreImpl::SaveShellCursors(SwDoc& rDoc, sal_uLong nNode, sal_Int
if (!_pStackCursor)
break;
_pStackCursor = _pStackCursor->GetNext();
- if (_pStackCursor == static_cast<SwCursorShell*>(&rCurShell)->GetStackCursor())
+ if (_pStackCursor == pCursorShell->GetStackCursor())
break;
}
- for(SwPaM& rPaM : static_cast<SwCursorShell*>(&rCurShell)->GetCursor_()->GetRingContainer())
+ for(SwPaM& rPaM : pCursorShell->GetCursor_()->GetRingContainer())
{
lcl_ChkPaMBoth( m_aShellCursorEntries, nNode, nContent, rPaM);
}
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index cdc0b5fe4145..9a31c6ad01e6 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -95,9 +95,9 @@ void PaMCorrAbs( const SwPaM& rRange,
{
for(const SwViewShell& rShell : pShell->GetRingContainer())
{
- if(dynamic_cast<const SwCursorShell *>(&rShell) == nullptr)
+ const SwCursorShell* pCursorShell = dynamic_cast<const SwCursorShell*>(&rShell);
+ if(!pCursorShell)
continue;
- const SwCursorShell* pCursorShell = static_cast<const SwCursorShell*>(&rShell);
SwPaM *_pStackCursor = pCursorShell->GetStackCursor();
if( _pStackCursor )
for (;;)
@@ -252,9 +252,9 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
{
for(const SwViewShell& rShell : pShell->GetRingContainer())
{
- if(dynamic_cast<const SwCursorShell *>(&rShell) == nullptr)
+ SwCursorShell* pCursorShell = const_cast<SwCursorShell*>(dynamic_cast<const SwCursorShell*>(&rShell));
+ if(!pCursorShell)
continue;
- SwCursorShell* pCursorShell = const_cast<SwCursorShell*>(static_cast<const SwCursorShell*>(&rShell));
SwPaM *_pStackCursor = pCursorShell->GetStackCursor();
if( _pStackCursor )
for (;;)
@@ -333,9 +333,9 @@ SwEditShell const * SwDoc::GetEditShell() const
for(const SwViewShell& rCurrentSh : pCurrentView->GetRingContainer())
{
// look for an EditShell (if it exists)
- if( dynamic_cast<const SwEditShell *>(&rCurrentSh) != nullptr )
+ if( auto pEditShell = dynamic_cast<const SwEditShell *>(&rCurrentSh) )
{
- return static_cast<const SwEditShell*>(&rCurrentSh);
+ return pEditShell;
}
}
}
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 9da9fb21ad9d..0ea944693996 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -695,9 +695,9 @@ void SwDoc::PrtOLENotify( bool bAll )
{
for(SwViewShell& rShell : pSh->GetRingContainer())
{
- if(dynamic_cast<const SwFEShell*>( &rShell) != nullptr)
+ if(auto pFEShell = dynamic_cast<SwFEShell*>( &rShell))
{
- pShell = static_cast<SwFEShell*>(&rShell);
+ pShell = pFEShell;
break;
}
}
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 98f3680ec134..c070519cfbf9 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -307,16 +307,16 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
for ( size_t i = 0; i < nMarkCount; ++i )
{
SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
- if ( dynamic_cast<const SdrObjGroup*>(pObj) != nullptr )
+ if ( auto pObjGroup = dynamic_cast<SdrObjGroup*>(pObj) )
{
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
SwFormatAnchor aAnch( pContact->GetFormat()->GetAnchor() );
- SdrObjList *pLst = static_cast<SdrObjGroup*>(pObj)->GetSubList();
+ SdrObjList *pLst = pObjGroup->GetSubList();
SwUndoDrawUnGroup* pUndo = nullptr;
if( bUndo )
{
- pUndo = new SwUndoDrawUnGroup( static_cast<SdrObjGroup*>(pObj), *this );
+ pUndo = new SwUndoDrawUnGroup( pObjGroup, *this );
GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo));
}
@@ -381,10 +381,9 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
if( 1 == rMrkList.GetMarkCount() )
{
SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+ if( auto pDrawObj = dynamic_cast<SwVirtFlyDrawObj*>( pObj) )
{
- SwFlyFrameFormat* pFrameFormat =
- static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame()->GetFormat();
+ SwFlyFrameFormat* pFrameFormat = pDrawObj->GetFlyFrame()->GetFormat();
if( pFrameFormat )
{
getIDocumentLayoutAccess().DelLayoutFormat( pFrameFormat );
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index c462bc7e6835..9d7561913550 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -558,10 +558,9 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
}
}
- if( dynamic_cast<const SwDDETable*>(&pTableNd->GetTable()) != nullptr )
+ if( auto pDDETable = dynamic_cast<SwDDETable*>(&pTableNd->GetTable()) )
{
- SwDDEFieldType* pTyp = static_cast<SwDDETable&>(pTableNd->
- GetTable()).GetDDEFieldType();
+ SwDDEFieldType* pTyp = pDDETable->GetDDEFieldType();
if( pTyp )
{
if( rNodes.IsDocNodes() )
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index c4f890aba37e..5481b4d9e4c3 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1666,11 +1666,10 @@ void SwDrawContact::RemoveMasterFromDrawPage()
// also working.
void SwDrawContact::DisconnectObjFromLayout( SdrObject* _pDrawObj )
{
- if ( dynamic_cast<const SwDrawVirtObj*>( _pDrawObj) != nullptr )
+ if ( auto pSwDrawVirtObj = dynamic_cast<SwDrawVirtObj*>( _pDrawObj) )
{
- SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(_pDrawObj);
- pDrawVirtObj->RemoveFromWriterLayout();
- pDrawVirtObj->RemoveFromDrawingPage();
+ pSwDrawVirtObj->RemoveFromWriterLayout();
+ pSwDrawVirtObj->RemoveFromDrawingPage();
}
else
{
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 2dcda1dc1df3..1d4a4d448120 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -371,9 +371,8 @@ void SwDrawView::MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj,
nNewPos );
pDrawPage->RecalcObjOrdNums();
// adjustments for accessibility API
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ if ( auto pTmpFlyFrame = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
{
- const SwFlyFrame *pTmpFlyFrame = static_cast<SwFlyFrame*>(pAnchoredObj);
m_rImp.DisposeAccessibleFrame( pTmpFlyFrame );
m_rImp.AddAccessibleFrame( pTmpFlyFrame );
}
@@ -405,9 +404,8 @@ void SwDrawView::MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj,
nTmpNewPos );
pDrawPage->RecalcObjOrdNums();
// adjustments for accessibility API
- if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
+ if ( auto pTmpFlyFrame = dynamic_cast<SwFlyFrame *>( pAnchoredObj ) )
{
- const SwFlyFrame *pTmpFlyFrame = static_cast<SwFlyFrame*>(pAnchoredObj);
m_rImp.DisposeAccessibleFrame( pTmpFlyFrame );
m_rImp.AddAccessibleFrame( pTmpFlyFrame );
}
@@ -580,10 +578,8 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, size_t nOldPos,
std::vector< SdrObject* > aMovedChildObjs;
// move 'children' accordingly
- if ( dynamic_cast< const SwFlyFrame *>( pMovedAnchoredObj ) != nullptr )
+ if ( auto pFlyFrame = dynamic_cast< SwFlyFrame *>( pMovedAnchoredObj ) )
{
- const SwFlyFrame* pFlyFrame = static_cast<SwFlyFrame*>(pMovedAnchoredObj);
-
// adjustments for accessibility API
m_rImp.DisposeAccessibleFrame( pFlyFrame );
m_rImp.AddAccessibleFrame( pFlyFrame );
@@ -613,10 +609,9 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, size_t nOldPos,
// collect 'child' object
aMovedChildObjs.push_back( pTmpObj );
// adjustments for accessibility API
- if ( dynamic_cast< const SwVirtFlyDrawObj *>( pTmpObj ) != nullptr )
+ if ( auto pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj *>( pTmpObj ) )
{
- const SwFlyFrame *pTmpFlyFrame =
- static_cast<SwVirtFlyDrawObj*>(pTmpObj)->GetFlyFrame();
+ const SwFlyFrame *pTmpFlyFrame = pFlyDrawObj->GetFlyFrame();
m_rImp.DisposeAccessibleFrame( pTmpFlyFrame );
m_rImp.AddAccessibleFrame( pTmpFlyFrame );
}
@@ -678,11 +673,11 @@ const SwFrame* SwDrawView::CalcAnchor()
//current anchor. Search only if we currently drag.
const SwFrame* pAnch;
tools::Rectangle aMyRect;
- const bool bFly = dynamic_cast< const SwVirtFlyDrawObj *>( pObj ) != nullptr;
- if ( bFly )
+ auto pFlyDrawObj = dynamic_cast<SwVirtFlyDrawObj *>( pObj );
+ if ( pFlyDrawObj )
{
- pAnch = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame()->GetAnchorFrame();
- aMyRect = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrame()->getFrameArea().SVRect();
+ pAnch = pFlyDrawObj->GetFlyFrame()->GetAnchorFrame();
+ aMyRect = pFlyDrawObj->GetFlyFrame()->getFrameArea().SVRect();
}
else
{
@@ -726,7 +721,7 @@ const SwFrame* SwDrawView::CalcAnchor()
bool bBodyOnly = CheckControlLayer( pObj );
pAnch = ::FindAnchor( static_cast<const SwContentFrame*>(pAnch), aPt, bBodyOnly );
}
- else if ( !bFly )
+ else if ( !pFlyDrawObj )
{
const SwRect aRect( aPt.getX(), aPt.getY(), 1, 1 );
@@ -919,9 +914,9 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView )
while ( !aMarkedObjs.empty() )
{
SdrObject* pMarkObj = aMarkedObjs.back();
- if ( dynamic_cast< const SwDrawVirtObj *>( pMarkObj ) != nullptr )
+ if ( auto pVirtObj = dynamic_cast<SwDrawVirtObj *>( pMarkObj ) )
{
- SdrObject* pRefObj = &(static_cast<SwDrawVirtObj*>(pMarkObj)->ReferencedObj());
+ SdrObject* pRefObj = &(pVirtObj->ReferencedObj());
if ( !_rMarkView.IsObjMarked( pRefObj ) )
{
_rMarkView.MarkObj( pRefObj, pDrawPageView );
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index cfff6b8fa108..a55f45651fba 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -222,10 +222,10 @@ static void lcl_SelectSdrMarkList( SwEditShell* pShell,
OSL_ENSURE( pShell != nullptr, "need shell!" );
OSL_ENSURE( pSdrMarkList != nullptr, "need mark list" );
- if( dynamic_cast<const SwFEShell*>( pShell) == nullptr )
+ SwFEShell* pFEShell = dynamic_cast<SwFEShell*>( pShell );
+ if( !pFEShell )
return;
- SwFEShell* pFEShell = static_cast<SwFEShell*>( pShell );
bool bFirst = true;
for( size_t i = 0; i < pSdrMarkList->GetMarkCount(); ++i )
{
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 8c3a9798373b..d7876e31a4fb 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -98,8 +98,8 @@ void SwEditShell::EndAllAction()
{
for(SwViewShell& rCurrentShell : GetRingContainer())
{
- if( dynamic_cast<const SwEditShell *>(&rCurrentShell) != nullptr )
- static_cast<SwEditShell*>(&rCurrentShell)->EndAction();
+ if( auto pEditShell = dynamic_cast<SwEditShell *>(&rCurrentShell))
+ pEditShell->EndAction();
else
rCurrentShell.EndAction();
}
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 16a42d8a168b..ca20591a9a61 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1389,8 +1389,8 @@ void SwFEShell::Paste( SvStream& rStrm, SwPasteSdr nAction, const Point* pPt )
} while( pTmp->IsFollow() );
pAnchor = pTmp;
}
- if( dynamic_cast<const SdrCaptionObj*>( pOldObj) != nullptr)
- aNullPt = static_cast<SdrCaptionObj*>(pOldObj)->GetTailPos();
+ if( auto pCaptionObj = dynamic_cast<SdrCaptionObj*>( pOldObj))
+ aNullPt = pCaptionObj->GetTailPos();
else
aNullPt = aOldObjRect.TopLeft();
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index c8cb2ba2ad85..47760d2e0df6 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -486,9 +486,8 @@ bool SwFEShell::MoveAnchor( SwMove nDir )
Point aBest;
for(SwAnchoredObject* pAnchObj : *pPage->GetSortedObjs())
{
- if( dynamic_cast<const SwFlyFrame*>( pAnchObj) != nullptr )
+ if( auto pTmp = dynamic_cast<SwFlyFrame*>( pAnchObj) )
{
- SwFlyFrame* pTmp = static_cast<SwFlyFrame*>(pAnchObj);
if( pTmp == pOld )
bOld = true;
else
@@ -768,8 +767,8 @@ void SwFEShell::EndDrag()
for(SwViewShell& rSh : GetRingContainer())
{
rSh.EndAction();
- if( dynamic_cast<const SwCursorShell *>(&rSh) != nullptr )
- static_cast<SwCursorShell*>(&rSh)->CallChgLnk();
+ if( auto pCursorShell = dynamic_cast<SwCursorShell *>(&rSh) )
+ pCursorShell->CallChgLnk();
}
GetDoc()->getIDocumentState().SetModified();
@@ -873,10 +872,10 @@ static void lcl_NotifyNeighbours( const SdrMarkList *pLst )
for ( size_t i = 0; i < nCount; ++i )
{
SwAnchoredObject* pAnchoredObj = (*pPage->GetSortedObjs())[i];
- if ( dynamic_cast<const SwFlyFrame*>( pAnchoredObj) == nullptr )
+ SwFlyFrame* pAct = dynamic_cast<SwFlyFrame*>(pAnchoredObj);
+ if ( !pAct )
continue;
- SwFlyFrame* pAct = static_cast<SwFlyFrame*>(pAnchoredObj);
SwRect aTmpCalcPnt( pAct->getFramePrintArea() );
aTmpCalcPnt += pAct->getFrameArea().Pos();
if ( aRect.IsOver( aTmpCalcPnt ) )
@@ -3076,17 +3075,17 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const
static_cast<SdrPathObj*>(pObj)->SetPathPoly(aPoly);
}
- else if(dynamic_cast<const SdrMeasureObj*>( pObj) != nullptr)
+ else if(auto pMeasureObj = dynamic_cast<SdrMeasureObj*>( pObj))
{
sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2);
- static_cast<SdrMeasureObj*>(pObj)->SetPoint(Point(aStart.X(), nYMiddle), 0);
- static_cast<SdrMeasureObj*>(pObj)->SetPoint(Point(aEnd.X(), nYMiddle), 1);
+ pMeasureObj->SetPoint(Point(aStart.X(), nYMiddle), 0);
+ pMeasureObj->SetPoint(Point(aEnd.X(), nYMiddle), 1);
SfxItemSet aAttr(pObj->getSdrModelFromSdrObject().GetItemPool());
SetLineEnds(aAttr, *pObj, nSlotId);
pObj->SetMergedItemSet(aAttr);
}
- else if(dynamic_cast<const SdrCaptionObj*>( pObj) != nullptr)
+ else if(auto pCationObj = dynamic_cast<SdrCaptionObj*>( pObj))
{
bool bVerticalText = ( SID_DRAW_TEXT_VERTICAL == nSlotId ||
SID_DRAW_CAPTION_VERTICAL == nSlotId );
@@ -3099,13 +3098,12 @@ long SwFEShell::GetSectionWidth( SwFormat const & rFormat ) const
pObj->SetMergedItemSet(aSet);
}
- static_cast<SdrCaptionObj*>(pObj)->SetLogicRect(aRect);
- static_cast<SdrCaptionObj*>(pObj)->SetTailPos(
+ pCationObj->SetLogicRect(aRect);
+ pCationObj->SetTailPos(
aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2));
}
- else if(dynamic_cast<const SdrTextObj*>( pObj) != nullptr)
+ else if(auto pText = dynamic_cast<SdrTextObj*>( pObj))
{
- SdrTextObj* pText = static_cast<SdrTextObj*>(pObj);
pText->SetLogicRect(aRect);
bool bVertical = (SID_DRAW_TEXT_VERTICAL == nSlotId);
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 65512523eb15..ac99bd2777e4 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1630,10 +1630,9 @@ const SwFrame* SwFEShell::GetBox( const Point &rPt, bool* pbRow, bool* pbCol ) c
for ( size_t i = 0; !pFrame && i < pPage->GetSortedObjs()->size(); ++i )
{
SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
- if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
+ if ( auto pFlyFrame = dynamic_cast<SwFlyFrame*>( pObj) )
{
- pFrame = lcl_FindFrame( static_cast<SwFlyFrame*>(pObj),
- rPt, nFuzzy, pbRow, pbCol );
+ pFrame = lcl_FindFrame( pFlyFrame, rPt, nFuzzy, pbRow, pbCol );
}
}
}
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index b7dddc1a2466..eb08c396e885 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2687,10 +2687,10 @@ SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint )
{
SwRect aRet;
SwFrame *pFrame = nullptr;
- if( dynamic_cast<const SwSectionFormat*>( this ) != nullptr )
+ if( auto pSectionFormat = dynamic_cast<const SwSectionFormat*>( this ))
{
// get the Frame using Node2Layout
- const SwSectionNode* pSectNd = static_cast<const SwSectionFormat*>(this)->GetSectionNode();
+ const SwSectionNode* pSectNd = pSectionFormat->GetSectionNode();
if( pSectNd )
{
SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 );
More information about the Libreoffice-commits
mailing list