diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-07 13:55:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-11-09 07:31:24 +0100 |
commit | 5ba447bdcd13ba3d7c27c8609f207910227e4ab6 (patch) | |
tree | 9a59e7058ef40be90867518590e35abb6c0615f5 /sd/source/ui/func/fuconrec.cxx | |
parent | ea4a47d7d442d5d897cfa3a6e9f09ce3f1f233c5 (diff) |
new loplugin simplifydynamiccast
simplify dynamic_cast followed by static_cast
Change-Id: I965afcf05d1675094cfde53d3590a0fd00f26279
Reviewed-on: https://gerrit.libreoffice.org/44460
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/func/fuconrec.cxx')
-rw-r--r-- | sd/source/ui/func/fuconrec.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx index bc5f9c5685c5..e10b37b53c0e 100644 --- a/sd/source/ui/func/fuconrec.cxx +++ b/sd/source/ui/func/fuconrec.cxx @@ -819,11 +819,11 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_DRAW_MEASURELINE: { - if( dynamic_cast< SdrMeasureObj *>( pObj ) != nullptr) + if( auto pMeasureObj = dynamic_cast< SdrMeasureObj *>( pObj ) ) { sal_Int32 nYMiddle((aRect.Top() + aRect.Bottom()) / 2); - static_cast<SdrMeasureObj*>(pObj)->SetPoint(Point(aStart.X(), nYMiddle), 0); - static_cast<SdrMeasureObj*>(pObj)->SetPoint(Point(aEnd.X(), nYMiddle), 1); + pMeasureObj->SetPoint(Point(aStart.X(), nYMiddle), 0); + pMeasureObj->SetPoint(Point(aEnd.X(), nYMiddle), 1); } else { @@ -862,10 +862,10 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_CONNECTOR_LINES_CIRCLE_END: case SID_CONNECTOR_LINES_CIRCLES: { - if( dynamic_cast< SdrEdgeObj *>( pObj ) != nullptr) + if( auto pEdgeObj = dynamic_cast< SdrEdgeObj *>( pObj ) ) { - static_cast<SdrEdgeObj*>(pObj)->SetTailPoint(false, aStart); - static_cast<SdrEdgeObj*>(pObj)->SetTailPoint(true, aEnd); + pEdgeObj->SetTailPoint(false, aStart); + pEdgeObj->SetTailPoint(true, aEnd); } else { @@ -877,7 +877,7 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const case SID_DRAW_CAPTION: case SID_DRAW_CAPTION_VERTICAL: { - if( dynamic_cast< SdrCaptionObj *>( pObj ) != nullptr) + if( auto pCaptionObj = dynamic_cast< SdrCaptionObj *>( pObj ) ) { bool bIsVertical(SID_DRAW_CAPTION_VERTICAL == nID); @@ -893,8 +893,8 @@ SdrObject* FuConstructRectangle::CreateDefaultObject(const sal_uInt16 nID, const // The default text is not inserted anymore. - static_cast<SdrCaptionObj*>(pObj)->SetLogicRect(aRect); - static_cast<SdrCaptionObj*>(pObj)->SetTailPos( + pCaptionObj->SetLogicRect(aRect); + pCaptionObj->SetTailPos( aRect.TopLeft() - Point(aRect.GetWidth() / 2, aRect.GetHeight() / 2)); } else |