sw/source/uibase/shells/annotsh.cxx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
New commits: commit c3081a93de58a877edcdecf3461b6275fda38e43 Author: Jan Holesovsky <ke...@collabora.com> Date: Mon Aug 1 07:37:02 2016 +0200 Simplify dynamic_cast followed by a static_cast. Change-Id: I3eab142e0df07371c1a5657d9304e556542a513a diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index e83249e..03834f4 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(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits