summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-09-22 18:20:39 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-09-23 15:47:12 +0200
commit1d398fb983d8f8b53a78e7c47b588fc1f1e7f748 (patch)
tree89e11384ea13d73b3c1dc198c5fee8675036abbe /chart2
parentcd6780aae1392d4c1af0b15b311a4966834a9602 (diff)
tdf#39593 use getUnoTunnelImplementation
Change-Id: I78eb67913a568c610e38e5002f914773c4906dfd Reviewed-on: https://gerrit.libreoffice.org/79350 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx12
-rw-r--r--chart2/source/controller/drawinglayer/DrawViewWrapper.cxx5
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx5
-rw-r--r--chart2/source/view/main/ChartView.cxx17
4 files changed, 13 insertions, 26 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 046f8bd87ea4..406df92db13a 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -47,6 +47,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <vcl/settings.hxx>
#include <com/sun/star/drawing/ShapeCollection.hpp>
@@ -1026,15 +1027,10 @@ namespace {
uno::Reference< lang::XMultiServiceFactory > getShapeFactory(const uno::Reference<uno::XInterface>& xChartView)
{
- Reference< lang::XUnoTunnel> xUnoTunnel(xChartView,uno::UNO_QUERY);
- if(xUnoTunnel.is())
- {
- ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
- ExplicitValueProvider::getUnoTunnelId() ));
- if( pProvider )
- return pProvider->getDrawModelWrapper()->getShapeFactory();
+ auto pProvider = comphelper::getUnoTunnelImplementation<ExplicitValueProvider>(xChartView);
+ if( pProvider )
+ return pProvider->getDrawModelWrapper()->getShapeFactory();
- }
return uno::Reference< lang::XMultiServiceFactory >();
}
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index f09f4035c70a..2141c4f76bce 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -371,11 +371,10 @@ SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference<
drawing::XShape >& xShape )
{
SdrObject* pRet = nullptr;
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY );
uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
- if(xUnoTunnel.is()&&xTypeProvider.is())
+ if(xTypeProvider.is())
{
- SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() ));
+ SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
if(pSvxShape)
pRet = pSvxShape->GetSdrObject();
}
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index ffce05afa0ad..fec07e83f0a3 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -204,11 +204,10 @@ void VDiagram::createShapes_2d()
static E3dScene* lcl_getE3dScene( const uno::Reference< drawing::XShape >& xShape )
{
E3dScene* pRet=nullptr;
- uno::Reference< lang::XUnoTunnel > xUnoTunnel( xShape, uno::UNO_QUERY );
uno::Reference< lang::XTypeProvider > xTypeProvider( xShape, uno::UNO_QUERY );
- if(xUnoTunnel.is()&&xTypeProvider.is())
+ if(xTypeProvider.is())
{
- SvxShape* pSvxShape = reinterpret_cast<SvxShape*>(xUnoTunnel->getSomething( SvxShape::getUnoTunnelId() ));
+ SvxShape* pSvxShape = comphelper::getUnoTunnelImplementation<SvxShape>(xShape);
if(pSvxShape)
{
SdrObject* pObj = pSvxShape->GetSdrObject();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ab3b10d7c8cf..200b4b4e9823 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1747,18 +1747,11 @@ bool ChartView::getExplicitValuesForAxis(
SdrPage* ChartView::getSdrPage()
{
- SdrPage* pPage=nullptr;
- Reference< lang::XUnoTunnel> xUnoTunnel(m_xDrawPage,uno::UNO_QUERY);
- if(xUnoTunnel.is())
- {
- SvxDrawPage* pSvxDrawPage = reinterpret_cast<SvxDrawPage*>(xUnoTunnel->getSomething(
- SvxDrawPage::getUnoTunnelId() ));
- if(pSvxDrawPage)
- {
- pPage = pSvxDrawPage->GetSdrPage();
- }
- }
- return pPage;
+ auto pSvxDrawPage = comphelper::getUnoTunnelImplementation<SvxDrawPage>(m_xDrawPage);
+ if(pSvxDrawPage)
+ return pSvxDrawPage->GetSdrPage();
+
+ return nullptr;
}
uno::Reference< drawing::XShape > ChartView::getShapeForCID( const OUString& rObjectCID )