chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx                
    |   11 +++++-----
 chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx                
    |    4 +--
 
chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
 |    1 
 chart2/source/inc/chartview/ExplicitValueProvider.hxx                          
    |    2 -
 chart2/source/view/main/ChartView.cxx                                          
    |    4 +--
 5 files changed, 12 insertions(+), 10 deletions(-)

New commits:
commit c592574948b0a28bac965b508bc260aaa6c365d3
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jan 16 12:25:49 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Jan 16 12:55:26 2022 +0100

    use more concrete types in chart2, ChartView
    
    Change-Id: I51d503cd71ef2adc0e590ef836dabf9906495bbc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128475
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx 
b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
index 9ce03b9cc8a7..88f362070795 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -26,6 +26,7 @@
 #include <chartview/ExplicitValueProvider.hxx>
 #include <chartview/DrawModelWrapper.hxx>
 #include <AxisHelper.hxx>
+#include <ChartView.hxx>
 #include <DiagramHelper.hxx>
 
 #include <ChartModel.hxx>
@@ -98,14 +99,14 @@ rtl::Reference< ::chart::Diagram > 
Chart2ModelContact::getDiagram() const
     return nullptr;
 }
 
-uno::Reference< lang::XUnoTunnel > const & Chart2ModelContact::getChartView() 
const
+rtl::Reference< ::chart::ChartView > const & 
Chart2ModelContact::getChartView() const
 {
     if(!m_xChartView.is())
     {
         // get the chart view
         rtl::Reference<ChartModel> xChartModel( m_xChartModel );
         if( xChartModel )
-            m_xChartView.set( xChartModel->createInstance( 
CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+            m_xChartView = xChartModel->getChartView(); // will create if 
necessary
     }
     return m_xChartView;
 }
@@ -115,7 +116,7 @@ ExplicitValueProvider* 
Chart2ModelContact::getExplicitValueProvider() const
     getChartView();
 
     //obtain the ExplicitValueProvider from the chart view
-    return comphelper::getFromUnoTunnel<ExplicitValueProvider>(m_xChartView);
+    return m_xChartView.get();
 }
 
 rtl::Reference<SvxDrawPage> Chart2ModelContact::getDrawPage() const
@@ -168,7 +169,7 @@ awt::Size Chart2ModelContact::GetPageSize() const
 awt::Rectangle Chart2ModelContact::SubstractAxisTitleSizes( const 
awt::Rectangle& rPositionRect )
 {
     awt::Rectangle aRect = ExplicitValueProvider::AddSubtractAxisTitleSizes(
-        *m_xChartModel.get(), getChartView(), rPositionRect, true );
+        *m_xChartModel.get(), getChartView().get(), rPositionRect, true );
     return aRect;
 }
 
@@ -178,7 +179,7 @@ awt::Rectangle 
Chart2ModelContact::GetDiagramRectangleIncludingTitle() const
 
     //add axis title sizes to the diagram size
     aRect = ExplicitValueProvider::AddSubtractAxisTitleSizes(
-        *m_xChartModel.get(), getChartView(), aRect, false );
+        *m_xChartModel.get(), getChartView().get(), aRect, false );
 
     return aRect;
 }
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx 
b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index c0f7185fe4ed..837c09341fd3 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -131,7 +131,7 @@ public:
 
 private: //methods
     ExplicitValueProvider* getExplicitValueProvider() const;
-    css::uno::Reference< css::lang::XUnoTunnel > const & getChartView() const;
+    rtl::Reference< ChartView > const & getChartView() const;
 
 public: //member
     css::uno::Reference< css::uno::XComponentContext >  m_xContext;
@@ -139,7 +139,7 @@ public: //member
 private: //member
     unotools::WeakReference< ChartModel >   m_xChartModel;
 
-    mutable css::uno::Reference< css::lang::XUnoTunnel > m_xChartView;
+    mutable rtl::Reference< ChartView > m_xChartView;
 
     std::map< OUString, css::uno::Reference< css::container::XNameContainer > 
> m_aTableMap;
 };
diff --git 
a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
 
b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
index a02ff69f2cc8..4895e1c40b9d 100644
--- 
a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
+++ 
b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
@@ -29,6 +29,7 @@
 #include <WrappedProperty.hxx>
 #include "Chart2ModelContact.hxx"
 #include <TitleHelper.hxx>
+#include <ChartView.hxx>
 #include <osl/diagnose.h>
 
 using namespace ::com::sun::star;
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx 
b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index 12047a5b9515..f367271e3b80 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -72,7 +72,7 @@ public:
     static css::awt::Rectangle
         AddSubtractAxisTitleSizes(
                 ChartModel& rModel
-            , const css::uno::Reference< css::uno::XInterface >& xChartView
+            , ExplicitValueProvider* pChartView
             , const css::awt::Rectangle& rPositionAndSize, bool bSubtract );
 
     static sal_Int32 getExplicitNumberFormatKeyForAxis(
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index de9ffcc9d204..456be98ba8ee 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1867,7 +1867,7 @@ sal_Int32 
ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabe
 
 awt::Rectangle ExplicitValueProvider::AddSubtractAxisTitleSizes(
             ChartModel& rModel
-            , const Reference< uno::XInterface >& xChartView
+            , ExplicitValueProvider* pChartView
             , const awt::Rectangle& rPositionAndSize, bool bSubtract )
 {
     awt::Rectangle aRet(rPositionAndSize);
@@ -1879,7 +1879,7 @@ awt::Rectangle 
ExplicitValueProvider::AddSubtractAxisTitleSizes(
     uno::Reference< chart2::XTitle > xSecondTitle_Width( 
TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, rModel ) );
     if( xTitle_Height.is() || xTitle_Width.is() || xSecondTitle_Height.is() || 
xSecondTitle_Width.is() )
     {
-        ExplicitValueProvider* pExplicitValueProvider = 
comphelper::getFromUnoTunnel<ExplicitValueProvider>(xChartView);
+        ExplicitValueProvider* pExplicitValueProvider = pChartView;
         if( pExplicitValueProvider )
         {
             //detect whether x axis points into x direction or not

Reply via email to