diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-08-01 07:37:02 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-08-01 09:48:50 +0200 |
commit | c3081a93de58a877edcdecf3461b6275fda38e43 (patch) | |
tree | 89b5bf8c878f46f3a9cf33c4bc9cd24d4078e99a /sw/source/uibase/shells | |
parent | a4a71214d69ce2ef3f1e8dbbf17362ce50e55a45 (diff) |
Simplify dynamic_cast followed by a static_cast.
Change-Id: I3eab142e0df07371c1a5657d9304e556542a513a
Diffstat (limited to 'sw/source/uibase/shells')
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index e83249e9538d..03834f40fda5 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -396,7 +396,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection(); - if (pFieldItem && dynamic_cast< const SvxURLField *>( pFieldItem->GetField() ) != nullptr ) + if (pFieldItem && dynamic_cast<const SvxURLField *>(pFieldItem->GetField()) != nullptr) { // Select the field so that it will be deleted during insert ESelection aSel = pOLV->GetSelection(); @@ -940,10 +940,10 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) { SotClipboardFormatId nFormat = SotClipboardFormatId::NONE; const SfxPoolItem* pItem; - if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && - dynamic_cast< const SfxUInt32Item *>( pItem ) != nullptr ) + if (rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SfxItemState::SET) { - nFormat = static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pItem)->GetValue()); + if (const SfxUInt32Item* pUInt32Item = dynamic_cast<const SfxUInt32Item *>(pItem)) + nFormat = static_cast<SotClipboardFormatId>(pUInt32Item->GetValue()); } if ( nFormat != SotClipboardFormatId::NONE ) @@ -1063,13 +1063,11 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet) if (pFieldItem) { - const SvxFieldData* pField = pFieldItem->GetField(); - - if (dynamic_cast< const SvxURLField *>( pField ) != nullptr) + if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField *>(pFieldItem->GetField())) { - 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 @@ -1692,8 +1690,8 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) sSym = static_cast<const SfxStringItem*>(pItem)->GetValue(); const SfxPoolItem* pFtItem = nullptr; pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); - const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem ); - if ( pFontItem ) + + if (const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>(pFtItem)) sFontName = pFontItem->GetValue(); } |