diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-02-08 20:41:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-09 07:34:22 +0100 |
commit | 7c62e59587949344160dd346f7e060577fbc3490 (patch) | |
tree | d82f2e321bd06f604ddd776d506f599117eda0e5 | |
parent | da7e9f8613f66265bc8822519fa60412cd463917 (diff) |
use more concrete types in chart2, Axis
Change-Id: Ia47fd6deedd0a1cf6bedc882cb9817206dfa88b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129690
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
7 files changed, 29 insertions, 33 deletions
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index aff808e82a15..2af84b9142df 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -291,7 +291,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf rItemSet.Get( nWhichId )).GetValue(); if( m_xCooSys.is() ) { - uno::Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1, 0, m_xCooSys ) ); + rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 1, 0, m_xCooSys ); if( xAxis.is() ) { chart2::ScaleData aScaleData( xAxis->getScaleData() ); diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 44195bb102a7..d184850b0dc6 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -742,7 +742,7 @@ void ChartController::executeDispatch_InsertAxis() try { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); if( xAxis.is() ) { AxisHelper::makeAxisVisible( xAxis ); @@ -764,7 +764,7 @@ void ChartController::executeDispatch_DeleteAxis() try { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); if( xAxis.is() ) { AxisHelper::makeAxisInvisible( xAxis ); @@ -786,7 +786,7 @@ void ChartController::executeDispatch_InsertMajorGrid() try { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); if( xAxis.is() ) { AxisHelper::makeGridVisible( xAxis->getGridProperties() ); @@ -808,7 +808,7 @@ void ChartController::executeDispatch_DeleteMajorGrid() try { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); if( xAxis.is() ) { AxisHelper::makeGridInvisible( xAxis->getGridProperties() ); @@ -830,7 +830,7 @@ void ChartController::executeDispatch_InsertMinorGrid() try { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); if( xAxis.is() ) { const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); @@ -854,7 +854,7 @@ void ChartController::executeDispatch_DeleteMinorGrid() try { - Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getChartModel() ); if( xAxis.is() ) { const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); diff --git a/chart2/source/controller/sidebar/ChartAxisPanel.cxx b/chart2/source/controller/sidebar/ChartAxisPanel.cxx index b222691b74cf..c5e15205b325 100644 --- a/chart2/source/controller/sidebar/ChartAxisPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAxisPanel.cxx @@ -123,7 +123,7 @@ void setLabelPosition(const rtl::Reference<::chart::ChartModel>& xModel, bool isReverse(const rtl::Reference<::chart::ChartModel>& xModel, const OUString& rCID) { - css::uno::Reference< css::chart2::XAxis > xAxis = + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID(rCID, xModel); if (!xAxis.is()) @@ -137,7 +137,7 @@ bool isReverse(const rtl::Reference<::chart::ChartModel>& xModel, void setReverse(const rtl::Reference<::chart::ChartModel>& xModel, const OUString& rCID, bool bReverse) { - css::uno::Reference< css::chart2::XAxis > xAxis = + rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID(rCID, xModel); if (!xAxis.is()) diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 362706a68a66..1398785066fe 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -496,7 +496,7 @@ void ChartTypeTemplate::createCoordinateSystems( // #i69680# make grid of first y-axis visible (was in the CooSys CTOR before) if( xCooSys->getDimension() >= 2 ) { - Reference< chart2::XAxis > xAxis( xCooSys->getAxisByDimension( 1, 0 )); + rtl::Reference< Axis > xAxis = xCooSys->getAxisByDimension2( 1, 0 ); if( xAxis.is()) AxisHelper::makeGridVisible( xAxis->getGridProperties() ); } @@ -673,7 +673,7 @@ void ChartTypeTemplate::adaptAxes( sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension( nDim ); for( sal_Int32 nAxisIndex=0; nAxisIndex<=nMaxAxisIndex; nAxisIndex++ ) { - Reference< XAxis > xAxis( AxisHelper::getAxis( nDim, nAxisIndex, xCooSys ) ); + rtl::Reference< Axis > xAxis = AxisHelper::getAxis( nDim, nAxisIndex, xCooSys ); if( !xAxis.is() ) continue; @@ -683,13 +683,9 @@ void ChartTypeTemplate::adaptAxes( bool bPercent = (getStackMode(0) == StackMode::YStackedPercent); if( bPercent && nDim == 1 ) { - Reference< beans::XPropertySet > xAxisProp( xAxis, uno::UNO_QUERY ); - if( xAxisProp.is()) - { - // set number format to source format - xAxisProp->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(true)); - xAxisProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); - } + // set number format to source format + xAxis->setPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT, uno::Any(true)); + xAxis->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any()); } } } diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 9369104f5b52..da7ec3bef878 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -542,8 +542,8 @@ void PieChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram > { try { - Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/ - , coords ) ); + rtl::Reference< Axis > xAxis = AxisHelper::getAxis( 0 /*nDimensionIndex*/,0 /*nAxisIndex*/ + , coords ); if( xAxis.is() ) { chart2::ScaleData aScaleData( xAxis->getScaleData() ); diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 2418ca2097b0..046822980bc0 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -1148,7 +1148,7 @@ void AxisHelper::setRTLAxisLayout( const rtl::Reference< BaseCoordinateSystem >& try { //reverse direction for horizontal main axis - Reference< chart2::XAxis > xHorizontalMainAxis( AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); + rtl::Reference< Axis > xHorizontalMainAxis = AxisHelper::getAxis( nHorizontalAxisDimension, MAIN_AXIS_INDEX, xCooSys ); if( xHorizontalMainAxis.is() ) { chart2::ScaleData aScale = xHorizontalMainAxis->getScaleData(); @@ -1157,7 +1157,7 @@ void AxisHelper::setRTLAxisLayout( const rtl::Reference< BaseCoordinateSystem >& } //mathematical direction for vertical main axis - Reference< chart2::XAxis > xVerticalMainAxis( AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ) ); + rtl::Reference< Axis > xVerticalMainAxis = AxisHelper::getAxis( nVerticalAxisDimension, MAIN_AXIS_INDEX, xCooSys ); if( xVerticalMainAxis.is() ) { chart2::ScaleData aScale = xVerticalMainAxis->getScaleData(); @@ -1173,7 +1173,7 @@ void AxisHelper::setRTLAxisLayout( const rtl::Reference< BaseCoordinateSystem >& try { //reverse direction for horizontal secondary axis - Reference< chart2::XAxis > xHorizontalSecondaryAxis( AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); + rtl::Reference< Axis > xHorizontalSecondaryAxis = AxisHelper::getAxis( nHorizontalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ); if( xHorizontalSecondaryAxis.is() ) { chart2::ScaleData aScale = xHorizontalSecondaryAxis->getScaleData(); @@ -1182,7 +1182,7 @@ void AxisHelper::setRTLAxisLayout( const rtl::Reference< BaseCoordinateSystem >& } //mathematical direction for vertical secondary axis - Reference< chart2::XAxis > xVerticalSecondaryAxis( AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ) ); + rtl::Reference< Axis > xVerticalSecondaryAxis = AxisHelper::getAxis( nVerticalAxisDimension, SECONDARY_AXIS_INDEX, xCooSys ); if( xVerticalSecondaryAxis.is() ) { chart2::ScaleData aScale = xVerticalSecondaryAxis->getScaleData(); diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 867e047ca1dd..f1021442f617 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -523,7 +523,7 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1; sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries); - uno::Reference< chart2::XAxis > xOldAxis( DiagramHelper::getAttachedAxis( xDataSeries, xDiagram ) ); + rtl::Reference< Axis > xOldAxis = DiagramHelper::getAttachedAxis( xDataSeries, xDiagram ); if( nOldAxisIndex != nNewAxisIndex ) { @@ -674,13 +674,13 @@ rtl::Reference< ChartType > namespace { -std::vector< Reference< XAxis > > lcl_getAxisHoldingCategoriesFromDiagram( +std::vector< rtl::Reference< Axis > > lcl_getAxisHoldingCategoriesFromDiagram( const rtl::Reference< Diagram > & xDiagram ) { - std::vector< Reference< XAxis > > aRet; + std::vector< rtl::Reference< Axis > > aRet; // return first x-axis as fall-back - Reference< XAxis > xFallBack; + rtl::Reference< Axis > xFallBack; if (xDiagram.is()) try { for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) @@ -701,7 +701,7 @@ std::vector< Reference< XAxis > > lcl_getAxisHoldingCategoriesFromDiagram( aRet.push_back(xAxis); } if( (nN == 0) && !xFallBack.is()) - xFallBack.set( xAxis ); + xFallBack = xAxis; } } } @@ -758,10 +758,10 @@ void DiagramHelper::setCategoriesToDiagram( bool bSetAxisType /* = false */, bool bCategoryAxis /* = true */ ) { - std::vector< Reference< chart2::XAxis > > aCatAxes( + std::vector< rtl::Reference< Axis > > aCatAxes( lcl_getAxisHoldingCategoriesFromDiagram( xDiagram )); - for (const Reference< chart2::XAxis >& xCatAxis : aCatAxes) + for (const rtl::Reference< Axis >& xCatAxis : aCatAxes) { if( xCatAxis.is()) { @@ -787,12 +787,12 @@ uno::Reference< chart2::data::XLabeledDataSequence > try { - std::vector< Reference< chart2::XAxis > > aCatAxes( + std::vector< rtl::Reference< Axis > > aCatAxes( lcl_getAxisHoldingCategoriesFromDiagram( xDiagram )); //search for first categories if (!aCatAxes.empty()) { - Reference< chart2::XAxis > xCatAxis(aCatAxes[0]); + rtl::Reference< Axis > xCatAxis(aCatAxes[0]); if( xCatAxis.is()) { ScaleData aScaleData( xCatAxis->getScaleData()); |