summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-12 16:09:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-13 09:30:12 +0200
commitf9ac067da9e61f479e2433d500b9b940e5a45470 (patch)
tree1b057d3b97cc7dcf6d3de377da34cbf23af9c3ee /sw/source/uibase
parent3ee3ae85de3a29ebfb89e75960b65417bfd6ca55 (diff)
static_cast after dynamic_cast
Change-Id: I487b5dc148f5a3d0d45f198c00179002841242ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104213 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx4
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx4
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx16
3 files changed, 12 insertions, 12 deletions
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 58070eb13352..0ce6317b294e 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -632,9 +632,9 @@ SwWrtShell* SwSpellDialogChildWindow::GetWrtShell_Impl()
sal_uInt16 nShellIdx = 0;
SfxShell* pShell;
while(nullptr != (pShell = pDispatch->GetShell(nShellIdx++)))
- if(dynamic_cast< const SwView *>( pShell ) != nullptr)
+ if(auto pSwView = dynamic_cast< SwView *>( pShell ))
{
- pView = static_cast<SwView* >(pShell);
+ pView = pSwView;
break;
}
}
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index f2b7fe80669f..607d94c3e33f 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -288,9 +288,9 @@ SwSidebarItem* SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExisten
mbLayout = bFocus;
SwSidebarItem* pAnnotationItem = nullptr;
- if (dynamic_cast< const SwFormatField *>( pItem ) != nullptr)
+ if (auto pSwFormatField = dynamic_cast< SwFormatField *>( pItem ))
{
- mvPostItFields.push_back(std::make_unique<SwAnnotationItem>(static_cast<SwFormatField&>(*pItem), bFocus));
+ mvPostItFields.push_back(std::make_unique<SwAnnotationItem>(*pSwFormatField, bFocus));
pAnnotationItem = mvPostItFields.back().get();
}
OSL_ENSURE(dynamic_cast< const SwFormatField *>( pItem ) != nullptr,"Mgr::InsertItem: seems like new stuff was added");
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index ea103fa2bfac..08bc94f91ca1 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2348,8 +2348,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
if(pObj)
{
EnterDrawTextMode(pObj->GetLogicRect().Center());
- if ( dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr )
- static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
+ if ( auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
+ pSwDrawTextShell->Init();
rSh.GetDrawView()->KeyInput( rKEvt, this );
}
}
@@ -2393,8 +2393,8 @@ KEYINPUT_CHECKTABLE_INSDEL:
if(pObj)
{
EnterDrawTextMode(pObj->GetLogicRect().Center());
- if (dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr )
- static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
+ if (auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
+ pSwDrawTextShell->Init();
}
}
eKeyState = SwKeyState::End;
@@ -3356,8 +3356,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
case SelectionType::DrawObject:
RstMBDownFlags();
EnterDrawTextMode(aDocPos);
- if ( dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr )
- static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
+ if ( auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
+ pSwDrawTextShell->Init();
return;
default: break;
@@ -5090,8 +5090,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
if (SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj())
{
EnterDrawTextMode(pObj->GetLogicRect().Center());
- if ( dynamic_cast< const SwDrawTextShell *>( m_rView.GetCurShell() ) != nullptr )
- static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
+ if ( auto pSwDrawTextShell = dynamic_cast< SwDrawTextShell *>( m_rView.GetCurShell() ) )
+ pSwDrawTextShell->Init();
}
}
}