diff options
-rw-r--r-- | chart2/inc/ChartView.hxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ObjectHierarchy.cxx | 10 | ||||
-rw-r--r-- | chart2/source/inc/chartview/ExplicitValueProvider.hxx | 3 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 23 |
4 files changed, 24 insertions, 14 deletions
diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 228d24bc19fe..4d50c7693d4f 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -121,7 +121,7 @@ public: css::uno::Reference< css::chart2::XAxis > xAxis , ExplicitScaleData& rExplicitScale , ExplicitIncrementData& rExplicitIncrement ) override; - virtual css::uno::Reference< css::drawing::XShape > + virtual rtl::Reference< SvxShape > getShapeForCID( const OUString& rObjectCID ) override; virtual css::awt::Rectangle getRectangleOfObject( const OUString& rObjectCID, bool bSnapRect=false ) override; diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index 0472cf23e9a6..cba33e832180 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -203,8 +203,9 @@ void ObjectHierarchy::createLegendTree( // iterate over child shapes of legend and search for matching CIDs if( m_pExplicitValueProvider ) { - Reference< container::XIndexAccess > xLegendShapeContainer( - m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ), uno::UNO_QUERY ); + rtl::Reference< SvxShapeGroupAnyD > xLegendShapeContainer = + dynamic_cast<SvxShapeGroupAnyD*>( + m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ).get() ); ObjectHierarchy::tChildContainer aLegendEntryOIDs; lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer ); @@ -394,8 +395,9 @@ void ObjectHierarchy::createDataSeriesTree( // iterate over child shapes of legend and search for matching CIDs if( m_pExplicitValueProvider ) { - Reference< container::XIndexAccess > xSeriesShapeContainer( - m_pExplicitValueProvider->getShapeForCID( aSeriesOID.getObjectCID() ), uno::UNO_QUERY ); + rtl::Reference< SvxShapeGroupAnyD > xSeriesShapeContainer = + dynamic_cast<SvxShapeGroupAnyD*>( + m_pExplicitValueProvider->getShapeForCID( aSeriesOID.getObjectCID() ).get() ); lcl_getChildOIDs( aSeriesSubContainer, xSeriesShapeContainer ); } diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx index e77df0ddcf3d..3e599a0cf9ab 100644 --- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx +++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx @@ -38,6 +38,7 @@ namespace com::sun::star::uno { class XInterface; } namespace com::sun::star::uno { template <typename > class Reference; } namespace com::sun::star::uno { template <typename > class Sequence; } namespace com::sun::star::util { class XNumberFormatsSupplier; } +class SvxShape; namespace chart { @@ -64,7 +65,7 @@ public: virtual css::awt::Rectangle getDiagramRectangleExcludingAxes()=0; - virtual css::uno::Reference< css::drawing::XShape > + virtual rtl::Reference< SvxShape > getShapeForCID( const OUString& rObjectCID )=0; virtual std::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index a0b09a86202c..56955f4c8f8b 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1707,13 +1707,17 @@ SdrPage* ChartView::getSdrPage() return nullptr; } -uno::Reference< drawing::XShape > ChartView::getShapeForCID( const OUString& rObjectCID ) +rtl::Reference< SvxShape > ChartView::getShapeForCID( const OUString& rObjectCID ) { SolarMutexGuard aSolarGuard; SdrObject* pObj = DrawModelWrapper::getNamedSdrObject( rObjectCID, this->getSdrPage() ); - if( pObj ) - return uno::Reference< drawing::XShape >( pObj->getUnoShape(), uno::UNO_QUERY); - return nullptr; + if( !pObj ) + return nullptr; + + uno::Reference< drawing::XShape > xShape = pObj->getUnoShape(); + rtl::Reference<SvxShape> xShape2 = dynamic_cast<SvxShape*>(xShape.get()); + assert(xShape2 || !xShape); + return xShape2; } awt::Rectangle ChartView::getDiagramRectangleExcludingAxes() @@ -1727,7 +1731,7 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool impl_updateView(); awt::Rectangle aRet; - uno::Reference< drawing::XShape > xShape( getShapeForCID(rObjectCID) ); + rtl::Reference< SvxShape > xShape = getShapeForCID(rObjectCID); if(xShape.is()) { //special handling for axis for old api: @@ -1736,7 +1740,7 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool if( eObjectType == OBJECTTYPE_AXIS || eObjectType == OBJECTTYPE_DIAGRAM ) { SolarMutexGuard aSolarGuard; - SdrObject* pRootSdrObject = SdrObject::getSdrObjectFromXShape( xShape ); + SdrObject* pRootSdrObject = xShape->GetSdrObject(); if( pRootSdrObject ) { SdrObjList* pRootList = pRootSdrObject->GetSubList(); @@ -1747,7 +1751,10 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool aShapeName = "PlotAreaIncludingAxes"; SdrObject* pShape = DrawModelWrapper::getNamedSdrObject( aShapeName, pRootList ); if( pShape ) - xShape.set( pShape->getUnoShape(), uno::UNO_QUERY); + { + xShape = dynamic_cast<SvxShape*>(pShape->getUnoShape().get()); + assert(xShape); + } } } } @@ -1758,7 +1765,7 @@ awt::Rectangle ChartView::getRectangleOfObject( const OUString& rObjectCID, bool if( bSnapRect ) { //for rotated objects the shape size and position differs from the visible rectangle - SdrObject* pSdrObject = SdrObject::getSdrObjectFromXShape( xShape ); + SdrObject* pSdrObject = xShape->GetSdrObject(); if( pSdrObject ) { tools::Rectangle aSnapRect( pSdrObject->GetSnapRect() ); |