chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx |   68 
++++------
 chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx |    1 
 2 files changed, 30 insertions(+), 39 deletions(-)

New commits:
commit d1fecfda9b3d6b15a996b60aec19cb4ae9f747b9
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Mar 28 20:03:12 2025 +0200
Commit:     Noel Grandin <noelgran...@gmail.com>
CommitDate: Sat Mar 29 08:01:05 2025 +0100

    simplify Chart2ModelContact a little
    
    Change-Id: I26ac8717e70a737c0c15441603cbf48db4913233
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183465
    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 771ca721b781..f2b2d3c0a685 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -114,21 +114,13 @@ rtl::Reference< ::chart::ChartView > const & 
Chart2ModelContact::getChartView()
     return m_xChartView;
 }
 
-ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const
-{
-    getChartView();
-
-    //obtain the ExplicitValueProvider from the chart view
-    return m_xChartView.get();
-}
-
 rtl::Reference<SvxDrawPage> Chart2ModelContact::getDrawPage() const
 {
     rtl::Reference<SvxDrawPage> xResult;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView )
     {
-        xResult = pProvider->getDrawModelWrapper()->getMainDrawPage();
+        xResult = rxChartView->getDrawModelWrapper()->getMainDrawPage();
     }
     return xResult;
 }
@@ -138,10 +130,10 @@ void Chart2ModelContact::getExplicitValuesForAxis(
     ExplicitScaleData &  rOutExplicitScale,
     ExplicitIncrementData & rOutExplicitIncrement )
 {
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView )
     {
-        pProvider->getExplicitValuesForAxis(
+        rxChartView->getExplicitValuesForAxis(
             xAxis, rOutExplicitScale, rOutExplicitIncrement );
     }
 }
@@ -196,9 +188,9 @@ awt::Rectangle 
Chart2ModelContact::GetDiagramRectangleIncludingAxes() const
         aRect = 
DiagramHelper::getDiagramRectangleFromModel(m_xChartModel.get());
     else
     {
-        ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-        if( pProvider )
-            aRect = 
pProvider->getRectangleOfObject(u"PlotAreaIncludingAxes"_ustr);
+        rtl::Reference< ChartView > const & rxChartView = getChartView();
+        if( rxChartView )
+            aRect = 
rxChartView->getRectangleOfObject(u"PlotAreaIncludingAxes"_ustr);
     }
     return aRect;
 }
@@ -212,9 +204,9 @@ awt::Rectangle 
Chart2ModelContact::GetDiagramRectangleExcludingAxes() const
         aRect = 
DiagramHelper::getDiagramRectangleFromModel(m_xChartModel.get());
     else
     {
-        ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-        if( pProvider )
-            aRect = pProvider->getDiagramRectangleExcludingAxes();
+        rtl::Reference< ChartView > const & rxChartView = getChartView();
+        if( rxChartView )
+            aRect = rxChartView->getDiagramRectangleExcludingAxes();
     }
     return aRect;
 }
@@ -222,12 +214,12 @@ awt::Rectangle 
Chart2ModelContact::GetDiagramRectangleExcludingAxes() const
 awt::Size Chart2ModelContact::GetLegendSize() const
 {
     awt::Size aSize;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView )
     {
         rtl::Reference< Legend > xLegend = LegendHelper::getLegend( 
*m_xChartModel.get() );
         OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( 
xLegend, m_xChartModel ) );
-        aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+        aSize = ToSize( rxChartView->getRectangleOfObject( aCID ) );
     }
     return aSize;
 }
@@ -235,12 +227,12 @@ awt::Size Chart2ModelContact::GetLegendSize() const
 awt::Point Chart2ModelContact::GetLegendPosition() const
 {
     awt::Point aPoint;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView )
     {
         rtl::Reference< Legend > xLegend = LegendHelper::getLegend( 
*m_xChartModel.get() );
         OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( 
xLegend, m_xChartModel ) );
-        aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+        aPoint = ToPoint( rxChartView->getRectangleOfObject( aCID ) );
     }
     return aPoint;
 }
@@ -248,11 +240,11 @@ awt::Point Chart2ModelContact::GetLegendPosition() const
 awt::Size Chart2ModelContact::GetTitleSize( const uno::Reference< 
css::chart2::XTitle > & xTitle ) const
 {
     awt::Size aSize;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider && xTitle.is() )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView && xTitle.is() )
     {
         OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( 
xTitle, m_xChartModel ) );
-        aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+        aSize = ToSize( rxChartView->getRectangleOfObject( aCID ) );
     }
     return aSize;
 }
@@ -260,11 +252,11 @@ awt::Size Chart2ModelContact::GetTitleSize( const 
uno::Reference< css::chart2::X
 awt::Point Chart2ModelContact::GetTitlePosition( const uno::Reference< 
css::chart2::XTitle > & xTitle ) const
 {
     awt::Point aPoint;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider && xTitle.is() )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView && xTitle.is() )
     {
         OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( 
xTitle, m_xChartModel.get() ) );
-        aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+        aPoint = ToPoint( rxChartView->getRectangleOfObject( aCID ) );
     }
     return aPoint;
 }
@@ -272,11 +264,11 @@ awt::Point Chart2ModelContact::GetTitlePosition( const 
uno::Reference< css::char
 awt::Size Chart2ModelContact::GetAxisSize( const uno::Reference< 
css::chart2::XAxis > & xAxis ) const
 {
     awt::Size aSize;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider && xAxis.is() )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView && xAxis.is() )
     {
         OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( 
xAxis, m_xChartModel.get() ) );
-        aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+        aSize = ToSize( rxChartView->getRectangleOfObject( aCID ) );
     }
     return aSize;
 }
@@ -284,11 +276,11 @@ awt::Size Chart2ModelContact::GetAxisSize( const 
uno::Reference< css::chart2::XA
 awt::Point Chart2ModelContact::GetAxisPosition( const uno::Reference< 
css::chart2::XAxis > & xAxis ) const
 {
     awt::Point aPoint;
-    ExplicitValueProvider* pProvider( getExplicitValueProvider() );
-    if( pProvider && xAxis.is() )
+    rtl::Reference< ChartView > const & rxChartView = getChartView();
+    if( rxChartView && xAxis.is() )
     {
         OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( 
xAxis, m_xChartModel.get() ) );
-        aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+        aPoint = ToPoint( rxChartView->getRectangleOfObject( aCID ) );
     }
     return aPoint;
 }
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx 
b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
index 96a38755f778..42750f102756 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -124,7 +124,6 @@ public:
     css::awt::Point GetAxisPosition( const css::uno::Reference< 
css::chart2::XAxis > & xAxis ) const;
 
 private: //methods
-    ExplicitValueProvider* getExplicitValueProvider() const;
     rtl::Reference< ChartView > const & getChartView() const;
 
 public: //member

Reply via email to