chart2/source/view/axes/VAxisBase.cxx                  |    6 +-
 chart2/source/view/axes/VAxisProperties.cxx            |   35 +++++++----------
 chart2/source/view/axes/VAxisProperties.hxx            |    8 ++-
 chart2/source/view/axes/VCartesianAxis.cxx             |    3 -
 chart2/source/view/axes/VCartesianCoordinateSystem.cxx |    6 +-
 chart2/source/view/axes/VPolarAngleAxis.cxx            |    3 -
 chart2/source/view/axes/VPolarRadiusAxis.cxx           |    1 
 7 files changed, 32 insertions(+), 30 deletions(-)

New commits:
commit da7e9f8613f66265bc8822519fa60412cd463917
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Feb 8 20:29:39 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Feb 9 07:34:07 2022 +0100

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

diff --git a/chart2/source/view/axes/VAxisBase.cxx 
b/chart2/source/view/axes/VAxisBase.cxx
index b225b1f7c0c7..3737237da2d4 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -21,6 +21,7 @@
 #include <ShapeFactory.hxx>
 #include <ExplicitCategoriesProvider.hxx>
 #include "Tickmarks.hxx"
+#include <Axis.hxx>
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/chart2/AxisType.hpp>
 #include <com/sun/star/chart2/XAxis.hpp>
@@ -136,11 +137,10 @@ bool VAxisBase::isAnythingToDraw()
     if(!(m_xLogicTarget.is()&&m_xFinalTarget.is()))
         return false;
 
-    uno::Reference< beans::XPropertySet > xProps( 
m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
-    if( xProps.is() )
+    if( m_aAxisProperties.m_xAxisModel.is() )
     {
         bool bShow = false;
-        xProps->getPropertyValue( "Show" ) >>= bShow;
+        m_aAxisProperties.m_xAxisModel->getPropertyValue( "Show" ) >>= bShow;
         if( !bShow )
             return false;
     }
diff --git a/chart2/source/view/axes/VAxisProperties.cxx 
b/chart2/source/view/axes/VAxisProperties.cxx
index 656612cc67fc..a53c3c656fe6 100644
--- a/chart2/source/view/axes/VAxisProperties.cxx
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -19,6 +19,7 @@
 
 #include "VAxisProperties.hxx"
 #include <ViewDefines.hxx>
+#include <Axis.hxx>
 #include <AxisHelper.hxx>
 #include <ChartModelHelper.hxx>
 #include <ExplicitCategoriesProvider.hxx>
@@ -152,7 +153,7 @@ TickmarkProperties 
AxisProperties::getBiggestTickmarkProperties()
     return aTickmarkProperties;
 }
 
-AxisProperties::AxisProperties( const uno::Reference< XAxis >& xAxisModel
+AxisProperties::AxisProperties( const rtl::Reference< Axis >& xAxisModel
                               , ExplicitCategoriesProvider* 
pExplicitCategoriesProvider )
     : m_xAxisModel(xAxisModel)
     , m_nDimensionIndex(0)
@@ -240,13 +241,11 @@ void AxisProperties::initAxisPositioning( const 
uno::Reference< beans::XProperty
 
 void AxisProperties::init( bool bCartesian )
 {
-    uno::Reference< beans::XPropertySet > xProp =
-        uno::Reference<beans::XPropertySet>::query( m_xAxisModel );
-    if( !xProp.is() )
+    if( !m_xAxisModel.is() )
         return;
 
     if( m_nDimensionIndex<2 )
-        initAxisPositioning( xProp );
+        initAxisPositioning( m_xAxisModel );
 
     ScaleData aScaleData = m_xAxisModel->getScaleData();
     if( m_nDimensionIndex==0 )
@@ -294,19 +293,19 @@ void AxisProperties::init( bool bCartesian )
     try
     {
         //init LineProperties
-        m_aLineProperties.initFromPropertySet( xProp );
+        m_aLineProperties.initFromPropertySet( m_xAxisModel );
 
         //init display labels
-        xProp->getPropertyValue( "DisplayLabels" ) >>= m_bDisplayLabels;
+        m_xAxisModel->getPropertyValue( "DisplayLabels" ) >>= m_bDisplayLabels;
 
         // Init layout strategy hint for axis labels.
         // Compatibility option: starting from LibreOffice 5.1 the rotated
         // layout is preferred to staggering for axis labels.
-        xProp->getPropertyValue( "TryStaggeringFirst" ) >>= 
m_bTryStaggeringFirst;
+        m_xAxisModel->getPropertyValue( "TryStaggeringFirst" ) >>= 
m_bTryStaggeringFirst;
 
         //init TickmarkProperties
-        xProp->getPropertyValue( "MajorTickmarks" ) >>= m_nMajorTickmarks;
-        xProp->getPropertyValue( "MinorTickmarks" ) >>= m_nMinorTickmarks;
+        m_xAxisModel->getPropertyValue( "MajorTickmarks" ) >>= 
m_nMajorTickmarks;
+        m_xAxisModel->getPropertyValue( "MinorTickmarks" ) >>= 
m_nMinorTickmarks;
 
         sal_Int32 nMaxDepth = 0;
         if(m_nMinorTickmarks!=0)
@@ -341,22 +340,20 @@ AxisLabelProperties::AxisLabelProperties()
 
 }
 
-void AxisLabelProperties::init( const uno::Reference< XAxis >& xAxisModel )
+void AxisLabelProperties::init( const rtl::Reference< Axis >& xAxisModel )
 {
-    uno::Reference< beans::XPropertySet > xProp =
-        uno::Reference<beans::XPropertySet>::query( xAxisModel );
-    if(!xProp.is())
+    if(!xAxisModel.is())
         return;
 
     try
     {
-        xProp->getPropertyValue( "TextBreak" ) >>= m_bLineBreakAllowed;
-        xProp->getPropertyValue( "TextOverlap" ) >>= m_bOverlapAllowed;
-        xProp->getPropertyValue( "StackCharacters" ) >>= m_bStackCharacters;
-        xProp->getPropertyValue( "TextRotation" ) >>= m_fRotationAngleDegree;
+        xAxisModel->getPropertyValue( "TextBreak" ) >>= m_bLineBreakAllowed;
+        xAxisModel->getPropertyValue( "TextOverlap" ) >>= m_bOverlapAllowed;
+        xAxisModel->getPropertyValue( "StackCharacters" ) >>= 
m_bStackCharacters;
+        xAxisModel->getPropertyValue( "TextRotation" ) >>= 
m_fRotationAngleDegree;
 
         css::chart::ChartAxisArrangeOrderType eArrangeOrder;
-        xProp->getPropertyValue( "ArrangeOrder" ) >>= eArrangeOrder;
+        xAxisModel->getPropertyValue( "ArrangeOrder" ) >>= eArrangeOrder;
         switch(eArrangeOrder)
         {
             case css::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
diff --git a/chart2/source/view/axes/VAxisProperties.hxx 
b/chart2/source/view/axes/VAxisProperties.hxx
index 44778cbf916e..4370ccbb6e65 100644
--- a/chart2/source/view/axes/VAxisProperties.hxx
+++ b/chart2/source/view/axes/VAxisProperties.hxx
@@ -27,6 +27,7 @@
 #include <com/sun/star/awt/Rectangle.hpp>
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/uno/Any.hxx>
+#include <rtl/ref.hxx>
 
 #include <vector>
 #include <optional>
@@ -38,6 +39,7 @@ namespace com::sun::star::chart2::data { class 
XTextualDataSequence; }
 
 namespace chart
 {
+class Axis;
 
 //These properties describe how a couple of labels are arranged one to another.
 //The couple can contain all labels for all tickmark depth or just the labels 
for one single depth or
@@ -71,7 +73,7 @@ struct AxisLabelProperties final
     sal_Int32   m_nRhythm; //show only each nth label with n==nRhythm
 
     //methods:
-    void init( const css::uno::Reference< css::chart2::XAxis >&  xAxisModel );
+    void init( const rtl::Reference< ::chart::Axis >&  xAxisModel );
 
     bool isStaggered() const;
 
@@ -90,7 +92,7 @@ struct AxisLabelAlignment
 
 struct AxisProperties final
 {
-    css::uno::Reference<css::chart2::XAxis> m_xAxisModel;
+    rtl::Reference<::chart::Axis> m_xAxisModel;
 
     sal_Int32   m_nDimensionIndex;
     bool        m_bIsMainAxis;//not secondary axis
@@ -138,7 +140,7 @@ struct AxisProperties final
 
     //methods:
 
-    AxisProperties( const css::uno::Reference< css::chart2::XAxis >& xAxisModel
+    AxisProperties( const rtl::Reference< ::chart::Axis >& xAxisModel
                   , ExplicitCategoriesProvider* pExplicitCategoriesProvider );
 
     void init(bool bCartesian=false);//init from model data (m_xAxisModel)
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx 
b/chart2/source/view/axes/VCartesianAxis.cxx
index 645afcce2cb6..8e7b3a1e728e 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -25,6 +25,7 @@
 #include <LabelPositionHelper.hxx>
 #include <TrueGuard.hxx>
 #include <BaseGFXHelper.hxx>
+#include <Axis.hxx>
 #include <AxisHelper.hxx>
 #include "Tickmarks_Equidistant.hxx"
 #include <ExplicitCategoriesProvider.hxx>
@@ -424,7 +425,7 @@ static void getAxisLabelProperties(
     const AxisLabelProperties& rAxisLabelProp,
     sal_Int32 nLimitedSpaceForText, bool bLimitedHeight )
 {
-    Reference<beans::XPropertySet> xProps(rAxisProp.m_xAxisModel, 
uno::UNO_QUERY);
+    Reference<beans::XPropertySet> xProps(rAxisProp.m_xAxisModel);
 
     PropertyMapper::getTextLabelMultiPropertyLists(
         xProps, rPropNames, rPropValues, false, nLimitedSpaceForText, 
bLimitedHeight, false);
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx 
b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
index 64d02eb904c0..2b14282cec6c 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -136,7 +136,7 @@ void VCartesianCoordinateSystem::createVAxisList(
             aAxisProperties.m_bSwapXAndY = bSwapXAndY;
             aAxisProperties.m_bIsMainAxis = (nAxisIndex==0);
             aAxisProperties.m_bLimitSpaceForLabels = bLimitSpaceForLabels;
-            Reference< XAxis > xCrossingMainAxis( 
AxisHelper::getCrossingMainAxis( xAxis, m_xCooSysModel ) );
+            rtl::Reference< Axis > xCrossingMainAxis = 
AxisHelper::getCrossingMainAxis( xAxis, m_xCooSysModel );
             if( xCrossingMainAxis.is() )
             {
                 ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
@@ -151,8 +151,8 @@ void VCartesianCoordinateSystem::createVAxisList(
                 aAxisProperties.m_xAxisTextProvider = new TextualDataProvider( 
m_aSeriesNamesForZAxis );
 
                 //for the z axis copy the positioning properties from the x 
axis (or from the y axis for swapped coordinate systems)
-                Reference< XAxis > xSisterAxis( 
AxisHelper::getCrossingMainAxis( xCrossingMainAxis, m_xCooSysModel ) );
-                aAxisProperties.initAxisPositioning( Reference< 
beans::XPropertySet >( xSisterAxis, uno::UNO_QUERY) );
+                rtl::Reference< Axis > xSisterAxis = 
AxisHelper::getCrossingMainAxis( xCrossingMainAxis, m_xCooSysModel );
+                aAxisProperties.initAxisPositioning( xSisterAxis );
             }
             aAxisProperties.init(true);
             if(aAxisProperties.m_bDisplayLabels)
diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx 
b/chart2/source/view/axes/VPolarAngleAxis.cxx
index 533ffbc92dd1..224f704eb403 100644
--- a/chart2/source/view/axes/VPolarAngleAxis.cxx
+++ b/chart2/source/view/axes/VPolarAngleAxis.cxx
@@ -22,6 +22,7 @@
 #include "VPolarAngleAxis.hxx"
 #include "VPolarGrid.hxx"
 #include <ShapeFactory.hxx>
+#include <Axis.hxx>
 #include <NumberFormatterWrapper.hxx>
 #include <PolarLabelPositionHelper.hxx>
 #include <PlottingPositionHelper.hxx>
@@ -60,7 +61,7 @@ void VPolarAngleAxis::createTextShapes_ForAngleAxis(
     tNameSequence aPropNames;
     tAnySequence aPropValues;
 
-    uno::Reference< beans::XPropertySet > xProps( 
m_aAxisProperties.m_xAxisModel, uno::UNO_QUERY );
+    uno::Reference< beans::XPropertySet > xProps( 
m_aAxisProperties.m_xAxisModel );
     PropertyMapper::getTextLabelMultiPropertyLists( xProps, aPropNames, 
aPropValues, false, -1, false, false );
     LabelPositionHelper::doDynamicFontResize( aPropValues, aPropNames, xProps
         , rAxisLabelProperties.m_aFontReferenceSize );
diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx 
b/chart2/source/view/axes/VPolarRadiusAxis.cxx
index 73e153705db6..f93315410e96 100644
--- a/chart2/source/view/axes/VPolarRadiusAxis.cxx
+++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx
@@ -20,6 +20,7 @@
 #include "VPolarRadiusAxis.hxx"
 #include "VCartesianAxis.hxx"
 #include <PlottingPositionHelper.hxx>
+#include <Axis.hxx>
 #include <CommonConverters.hxx>
 #include "Tickmarks_Equidistant.hxx"
 

Reply via email to