diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-02-04 10:22:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-02-04 11:19:35 +0100 |
commit | 18982376918c88ec09c2c7fd42ef635e93897b05 (patch) | |
tree | 33745acca3f3b8155628981b81438a15131fc157 /chart2 | |
parent | 380ab85b6594a013f34f5e6ec69fb569336bbb48 (diff) |
use more getSdrObjectFromXShape
Change-Id: Ia237643ab040425f231f781c86e7e060f0b53717
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110400
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/drawinglayer/DrawViewWrapper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BarChart.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/diagram/VDiagram.cxx | 7 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 36 |
4 files changed, 17 insertions, 40 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 9d448b4119fe..ced8421d211b 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -345,9 +345,7 @@ SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference< uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY ); if(xTypeProvider.is()) { - SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape); - if(pSvxShape) - pRet = pSvxShape->GetSdrObject(); + pRet = SdrObject::getSdrObjectFromXShape(xShape); } return pRet; } diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index da7461f38e7a..a1de2d065003 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -441,15 +441,7 @@ void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis() static E3dScene* lcl_getE3dScene(uno::Reference<uno::XInterface> const & xInterface) { - E3dScene* pScene = nullptr; - - SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xInterface); - if (pSvxShape) - { - SdrObject* pObject = pSvxShape->GetSdrObject(); - pScene = dynamic_cast<E3dScene*>(pObject); - } - return pScene; + return dynamic_cast<E3dScene*>(SdrObject::getSdrObjectFromXShape(xInterface)); } void BarChart::createShapes() diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index 670dfab90424..bf3c96e82d53 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -205,12 +205,7 @@ static E3dScene* lcl_getE3dScene( const uno::Reference< drawing::XShape >& xShap uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY ); if(xTypeProvider.is()) { - SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape); - if(pSvxShape) - { - SdrObject* pObj = pSvxShape->GetSdrObject(); - pRet = dynamic_cast< E3dScene* >(pObj); - } + pRet = dynamic_cast< E3dScene* >(SdrObject::getSdrObjectFromXShape(xShape)); } return pRet; } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index e449680daf4c..c88144137721 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1791,22 +1791,18 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_DIAGRAM ) { SolarMutexGuard aSolarGuard; - SvxShape* pRoot = comphelper::getUnoTunnelImplementation<SvxShape>( xShape ); - if( pRoot ) + SdrObject* pRootSdrObject = SdrObject::getSdrObjectFromXShape( xShape ); + if( pRootSdrObject ) { - SdrObject* pRootSdrObject = pRoot->GetSdrObject(); - if( pRootSdrObject ) + SdrObjList* pRootList = pRootSdrObject->GetSubList(); + if( pRootList ) { - SdrObjList* pRootList = pRootSdrObject->GetSubList(); - if( pRootList ) - { - OUString aShapeName = "MarkHandles"; - if( eObjectType == OBJECTTYPE_DIAGRAM ) - aShapeName = "PlotAreaIncludingAxes"; - SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList ); - if( pShape ) - xShape.set( pShape->getUnoShape(), uno::UNO_QUERY); - } + OUString aShapeName = "MarkHandles"; + if( eObjectType == OBJECTTYPE_DIAGRAM ) + aShapeName = "PlotAreaIncludingAxes"; + SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList ); + if( pShape ) + xShape.set( pShape->getUnoShape(), uno::UNO_QUERY); } } } @@ -1817,15 +1813,11 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool if( bSnapRect ) { //for rotated objects the shape size and position differs from the visible rectangle - SvxShape* pShape = comphelper::getUnoTunnelImplementation<SvxShape>( xShape ); - if( pShape ) + SdrObject* pSdrObject = SdrObject::getSdrObjectFromXShape( xShape ); + if( pSdrObject ) { - SdrObject* pSdrObject = pShape->GetSdrObject(); - if( pSdrObject ) - { - tools::Rectangle aSnapRect( pSdrObject->GetSnapRect() ); - aRet = awt::Rectangle(aSnapRect.Left(),aSnapRect.Top(),aSnapRect.GetWidth(),aSnapRect.GetHeight()); - } + tools::Rectangle aSnapRect( pSdrObject->GetSnapRect() ); + aRet = awt::Rectangle(aSnapRect.Left(),aSnapRect.Top(),aSnapRect.GetWidth(),aSnapRect.GetHeight()); } } } |