summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-07-21 16:55:31 +0200
committerJan Holesovsky <kendy@collabora.com>2016-07-21 19:55:18 +0200
commit0788ce918fd0c3bca06e6cff045cc4dba9de5ad7 (patch)
tree440e2f8fef6ce39e0f3c0bd14d1b029ed937afb4 /sw
parent4b0243c03ecf1fd1c9686f8ea9064d23733cc0a6 (diff)
Simplify dynamic_cast followed by a static_cast.
Change-Id: I9a37110b5d7b89e41393f1b4344b3ab3d673d700
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx10
-rw-r--r--sw/source/uibase/uiview/pview.cxx8
-rw-r--r--sw/source/uibase/uiview/view.cxx17
3 files changed, 17 insertions, 18 deletions
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 0943a1ffd111..24b6914a92db 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -1058,13 +1058,13 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
if (pFieldItem)
{
- const SvxFieldData* pField = pFieldItem->GetField();
+ const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pFieldItem->GetField());
- if (dynamic_cast< const SvxURLField *>( pField ) != nullptr)
+ if (pURLField)
{
- aHLinkItem.SetName(static_cast<const SvxURLField*>( pField)->GetRepresentation());
- aHLinkItem.SetURL(static_cast<const SvxURLField*>( pField)->GetURL());
- aHLinkItem.SetTargetFrame(static_cast<const SvxURLField*>( pField)->GetTargetFrame());
+ aHLinkItem.SetName(pURLField->GetRepresentation());
+ aHLinkItem.SetURL(pURLField->GetURL());
+ aHLinkItem.SetTargetFrame(pURLField->GetTargetFrame());
}
}
else
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 3754e0eddfc8..12f6d2729113 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -1210,13 +1210,13 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
SwViewShell *pVS, *pNew;
- if( pOldSh && dynamic_cast<const SwPagePreview *>(pOldSh) != nullptr )
- pVS = static_cast<SwPagePreview*>(pOldSh)->GetViewShell();
+ if (SwPagePreview* pPagePreview = dynamic_cast<SwPagePreview*>(pOldSh))
+ pVS = pPagePreview->GetViewShell();
else
{
- if( pOldSh && dynamic_cast<const SwView *>(pOldSh) != nullptr )
+ if (SwView* pView = dynamic_cast<SwView *>(pOldSh))
{
- pVS = static_cast<SwView*>(pOldSh)->GetWrtShellPtr();
+ pVS = pView->GetWrtShellPtr();
// save the current ViewData of the previous SwView
pOldSh->WriteUserData( sSwViewData );
}
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 09d2e83f827d..fd69c6fb8d93 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -775,15 +775,15 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
{
pExistingSh = pOldSh;
// determine type of existing view
- if( dynamic_cast<const SwPagePreview *>(pExistingSh) != nullptr )
+ if (SwPagePreview* pPagePreview = dynamic_cast<SwPagePreview *>(pExistingSh))
{
- m_sSwViewData = static_cast<SwPagePreview*>(pExistingSh)->GetPrevSwViewData();
- m_sNewCursorPos = static_cast<SwPagePreview*>(pExistingSh)->GetNewCursorPos();
- m_nNewPage = static_cast<SwPagePreview*>(pExistingSh)->GetNewPage();
+ m_sSwViewData = pPagePreview->GetPrevSwViewData();
+ m_sNewCursorPos = pPagePreview->GetNewCursorPos();
+ m_nNewPage = pPagePreview->GetNewPage();
m_bOldShellWasPagePreview = true;
m_bIsPreviewDoubleClick = !m_sNewCursorPos.isEmpty() || m_nNewPage != USHRT_MAX;
}
- else if( dynamic_cast<const SwSrcView *>(pExistingSh) != nullptr )
+ else if (dynamic_cast<const SwSrcView *>(pExistingSh) != nullptr)
bOldShellWasSrcView = true;
}
@@ -1566,9 +1566,9 @@ SwGlossaryHdl* SwView::GetGlosHdl()
void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
bool bCallBase = true;
- if ( dynamic_cast<const SfxSimpleHint*>(&rHint) )
+ if (const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint))
{
- sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId();
+ sal_uInt32 nId = pSimpleHint->GetId();
switch ( nId )
{
// sub shells will be destroyed by the
@@ -1628,8 +1628,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
bCallBase = false;
if ( GetFormShell() )
{
- GetFormShell()->SetView(
- dynamic_cast<FmFormView*>( GetWrtShell().GetDrawView()) );
+ GetFormShell()->SetView(dynamic_cast<FmFormView*>(GetWrtShell().GetDrawView()));
SfxBoolItem aItem( SID_FM_DESIGN_MODE, !GetDocShell()->IsReadOnly());
GetDispatcher().ExecuteList(SID_FM_DESIGN_MODE,
SfxCallMode::SYNCHRON, { &aItem });