diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-14 12:27:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-18 09:08:49 +0000 |
commit | 90d658d6d1054ac352e1b074a37b8963514a05f8 (patch) | |
tree | 6146fdb37b23ad4f99efad77fb0a2384e14031c3 /chart2/source | |
parent | d395b42cdf3ef517d215dee905e5ccf2ae73b2b8 (diff) |
XUnoTunnel->dynamic_cast in ExplicitValueProvider
Change-Id: I72b85a18d0a754f81a136fd79e56789aa926f425
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
7 files changed, 14 insertions, 27 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index 5ba72c5dbec6..b7ae9a67ebe0 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -21,6 +21,7 @@ #include "AccessibleChartShape.hxx" #include <ObjectHierarchy.hxx> #include <ObjectIdentifier.hxx> +#include <ChartView.hxx> #include <chartview/ExplicitValueProvider.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> @@ -612,12 +613,11 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const aw awt::Rectangle SAL_CALL AccessibleBase::getBounds() { - ExplicitValueProvider *pExplicitValueProvider( - comphelper::getFromUnoTunnel<ExplicitValueProvider>( m_aAccInfo.m_xView )); - if( pExplicitValueProvider ) + rtl::Reference<ChartView> pChartView = m_aAccInfo.m_xView.get(); + if( pChartView ) { VclPtr<vcl::Window> pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow )); - awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() )); + awt::Rectangle aLogicRect( pChartView->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() )); if( pWindow ) { tools::Rectangle aRect( aLogicRect.X, aLogicRect.Y, diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx index 8e35e05706ac..1f23976d44e5 100644 --- a/chart2/source/controller/accessibility/AccessibleChartView.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx @@ -303,7 +303,7 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments MutexGuard aGuard( m_aMutex); if( xChartModel.is()) m_spObjectHierarchy = - std::make_shared<ObjectHierarchy>( xChartModel, comphelper::getFromUnoTunnel<ExplicitValueProvider>(m_xChartView) ); + std::make_shared<ObjectHierarchy>( xChartModel, m_xChartView.get().get() ); else m_spObjectHierarchy.reset(); } diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 7b911fbd3820..51f066c3ba3e 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -1045,11 +1045,10 @@ rtl::Reference<SvxDrawPage> ChartDocumentWrapper::impl_getDrawPage() const namespace { -uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const uno::Reference<uno::XInterface>& xChartView) +uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const rtl::Reference<ChartView>& xChartView) { - auto pProvider = comphelper::getFromUnoTunnel<ExplicitValueProvider>(xChartView); - if( pProvider ) - return pProvider->getDrawModelWrapper()->getShapeFactory(); + if( xChartView ) + return xChartView->getDrawModelWrapper()->getShapeFactory(); return uno::Reference< lang::XMultiServiceFactory >(); } @@ -1257,7 +1256,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( { if( !m_xShapeFactory.is() && m_xChartView.is() ) { - m_xShapeFactory = getShapeFactory( static_cast<cppu::OWeakObject*>(m_xChartView.get()) ); + m_xShapeFactory = getShapeFactory( m_xChartView ); } else { @@ -1265,7 +1264,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance( if(pModel) { m_xChartView = pModel->getChartView(); - m_xShapeFactory = getShapeFactory( static_cast<cppu::OWeakObject*>(m_xChartView.get()) ); + m_xShapeFactory = getShapeFactory( m_xChartView ); } } diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx index 58e122e8a2d2..6c1bc93b326f 100644 --- a/chart2/source/controller/inc/AccessibleBase.hxx +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -53,6 +53,7 @@ namespace chart { class AccessibleBase; +class ChartView; class ObjectHierarchy; typedef ObjectIdentifier AccessibleUniqueId; @@ -63,7 +64,7 @@ struct AccessibleElementInfo unotools::WeakReference< ::chart::ChartModel > m_xChartDocument; css::uno::WeakReference< css::view::XSelectionSupplier > m_xSelectionSupplier; - css::uno::WeakReference< css::uno::XInterface > m_xView; + unotools::WeakReference< ::chart::ChartView > m_xView; css::uno::WeakReference< css::awt::XWindow > m_xWindow; std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy; diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx index d97de84586a1..35b2dd15fa4c 100644 --- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx +++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx @@ -18,6 +18,7 @@ */ #pragma once +#include <sal/types.h> #include <chartview/chartviewdllapi.hxx> #include <rtl/ref.hxx> #include <rtl/ustring.hxx> @@ -47,7 +48,7 @@ class ChartModel; struct ExplicitIncrementData; struct ExplicitScaleData; -class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider +class OOO_DLLPUBLIC_CHARTVIEW SAL_LOPLUGIN_ANNOTATE("crosscast") ExplicitValueProvider { public: /** Gives calculated scale and increment values for a given xAxis in the current view. @@ -72,8 +73,6 @@ public: virtual std::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0; - static const css::uno::Sequence<sal_Int8>& getUnoTunnelId(); - static css::awt::Rectangle AddSubtractAxisTitleSizes( ChartModel& rModel diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 37d237e7ee7a..da37dd659f9e 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -308,12 +308,6 @@ sal_Bool SAL_CALL ChartView::isDataFlavorSupported( const datatransfer::DataFlav aFlavor.MimeType == lcl_aGDIMetaFileMIMETypeHighContrast ); } -// ____ XUnoTunnel ___ -::sal_Int64 SAL_CALL ChartView::getSomething( const uno::Sequence< ::sal_Int8 >& aIdentifier ) -{ - return comphelper::getSomethingImpl<ExplicitValueProvider>(aIdentifier, this); -} - // lang::XServiceInfo OUString SAL_CALL ChartView::getImplementationName() diff --git a/chart2/source/view/main/ExplicitValueProvider.cxx b/chart2/source/view/main/ExplicitValueProvider.cxx index 4b07b8d6659e..fc1307fe8820 100644 --- a/chart2/source/view/main/ExplicitValueProvider.cxx +++ b/chart2/source/view/main/ExplicitValueProvider.cxx @@ -77,12 +77,6 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( true /*bSearchForParallelAxisIfNothingIsFound*/); } -const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId() -{ - static const comphelper::UnoIdInit theExplicitValueProviderUnoTunnelId; - return theExplicitValueProviderUnoTunnelId.getSeq(); -} - sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( const uno::Reference<beans::XPropertySet>& xSeriesOrPointProp) { |