diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-13 11:30:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-13 13:29:08 +0200 |
commit | 530d0e0569342742d7bcf529b77ba4a409cf01a9 (patch) | |
tree | 95ce9c30275c0f6806dc004e9aeab2faee5a4693 /svx/source/engine3d | |
parent | 1374f5fdcbbd24b9ba614b378fd94f5ff95ad102 (diff) |
static_cast after dynamic_cast
Change-Id: If93fa126f10393a250cc1ad64bee28e84c42a6b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104226
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/engine3d')
-rw-r--r-- | svx/source/engine3d/dragmt3d.cxx | 8 | ||||
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 12 |
2 files changed, 8 insertions, 12 deletions
diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 9e7425a02ed0..3020e19a4ab0 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -338,9 +338,9 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) // Get modifier sal_uInt16 nModifier = 0; - if(dynamic_cast<const E3dView*>(&getSdrDragView())) + if(auto pDragView = dynamic_cast<const E3dView*>(&getSdrDragView())) { - const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent(); + const MouseEvent& rLastMouse = pDragView->GetMouseEvent(); nModifier = rLastMouse.GetModifier(); } @@ -520,9 +520,9 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) // Get modifier sal_uInt16 nModifier(0); - if(dynamic_cast<const E3dView*>(&getSdrDragView())) + if(auto pDragView = dynamic_cast<const E3dView*>(&getSdrDragView())) { - const MouseEvent& rLastMouse = static_cast<E3dView&>(getSdrDragView()).GetMouseEvent(); + const MouseEvent& rLastMouse = pDragView->GetMouseEvent(); nModifier = rLastMouse.GetModifier(); } diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 09a7bbdfa973..9cd91246071a 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -116,10 +116,10 @@ Imp3DDepthRemapper::Imp3DDepthRemapper(E3dScene const & rScene) if(pCandidate) { - if(dynamic_cast< const E3dCompoundObject*>(pCandidate)) + if(auto pCompoundObj = dynamic_cast< const E3dCompoundObject*>(pCandidate)) { // single 3d object, calc depth - const double fMinimalDepth(getMinimalDepthInViewCoordinates(static_cast< const E3dCompoundObject& >(*pCandidate))); + const double fMinimalDepth(getMinimalDepthInViewCoordinates(*pCompoundObj)); ImpRemap3DDepth aEntry(a, fMinimalDepth); maVector.push_back(aEntry); } @@ -378,10 +378,8 @@ void E3dScene::removeAllNonSelectedObjects() { bool bRemoveObject(false); - if(dynamic_cast< const E3dScene*>(pObj)) + if(auto pScene = dynamic_cast<E3dScene*>(pObj)) { - E3dScene* pScene = static_cast<E3dScene*>(pObj); - // iterate over this sub-scene pScene->removeAllNonSelectedObjects(); @@ -394,10 +392,8 @@ void E3dScene::removeAllNonSelectedObjects() bRemoveObject = true; } } - else if(dynamic_cast< const E3dCompoundObject*>(pObj)) + else if(auto pCompound = dynamic_cast<E3dCompoundObject*>(pObj)) { - E3dCompoundObject* pCompound = static_cast<E3dCompoundObject*>(pObj); - if(!pCompound->GetSelected()) { bRemoveObject = true; |