summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/GraphicObjectBar.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-11-23 21:37:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-24 07:10:29 +0100
commit5ca88c4a1a97b95c829f6c7c570c4e5219e80e2e (patch)
tree2c66640aafc90448d32908a7c40960a21e596122 /sd/source/ui/view/GraphicObjectBar.cxx
parent356006712320c524515a959a022a0f2b02fa63bb (diff)
static_cast after dynamic_cast
Change-Id: I196d4e9065961d6f4e3fef4475dd5f406e998447 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106451 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view/GraphicObjectBar.cxx')
-rw-r--r--sd/source/ui/view/GraphicObjectBar.cxx42
1 files changed, 22 insertions, 20 deletions
diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx
index cba43660e629..b3f9b1468b28 100644
--- a/sd/source/ui/view/GraphicObjectBar.cxx
+++ b/sd/source/ui/view/GraphicObjectBar.cxx
@@ -90,8 +90,9 @@ void GraphicObjectBar::GetFilterState( SfxItemSet& rSet )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast< SdrGrafObj *>( pObj ) && ( static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap ) )
- bEnable = true;
+ if( auto pGrafObj = dynamic_cast< SdrGrafObj *>( pObj ) )
+ if( pGrafObj->GetGraphicType() == GraphicType::Bitmap )
+ bEnable = true;
}
if( !bEnable )
@@ -106,28 +107,29 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest const & rReq )
{
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( dynamic_cast< SdrGrafObj *>( pObj ) && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
- {
- GraphicObject aFilterObj( static_cast<SdrGrafObj*>(pObj)->GetGraphicObject() );
-
- if( SvxGraphicFilterResult::NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
+ if( auto pGrafObj = dynamic_cast< SdrGrafObj *>( pObj ) )
+ if( pGrafObj->GetGraphicType() == GraphicType::Bitmap )
{
- SdrPageView* pPageView = mpView->GetSdrPageView();
+ GraphicObject aFilterObj( pGrafObj->GetGraphicObject() );
- if( pPageView )
+ if( SvxGraphicFilterResult::NONE ==
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ) )
{
- SdrGrafObj* pFilteredObj = static_cast<SdrGrafObj*>( pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()) );
- OUString aStr = mpView->GetDescriptionOfMarkedObjects() +
- " " + SdResId(STR_UNDO_GRAFFILTER);
- mpView->BegUndo( aStr );
- pFilteredObj->SetGraphicObject( aFilterObj );
- ::sd::View* const pView = mpView;
- pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
- pView->EndUndo();
- return;
+ SdrPageView* pPageView = mpView->GetSdrPageView();
+
+ if( pPageView )
+ {
+ SdrGrafObj* pFilteredObj = static_cast<SdrGrafObj*>( pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()) );
+ OUString aStr = mpView->GetDescriptionOfMarkedObjects() +
+ " " + SdResId(STR_UNDO_GRAFFILTER);
+ mpView->BegUndo( aStr );
+ pFilteredObj->SetGraphicObject( aFilterObj );
+ ::sd::View* const pView = mpView;
+ pView->ReplaceObjectAtView( pObj, *pPageView, pFilteredObj );
+ pView->EndUndo();
+ return;
+ }
}
- }
}
}