diff options
-rw-r--r-- | chart2/source/inc/AxisHelper.hxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 23 | ||||
-rw-r--r-- | chart2/source/tools/ExplicitCategoriesProvider.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 4 |
4 files changed, 13 insertions, 18 deletions
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index 788ba4cf5f79..df3da4c4de5b 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -59,7 +59,7 @@ public: static sal_Int32 getExplicitNumberFormatKeyForAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem - , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc + , const rtl::Reference< ::chart::ChartModel>& xChartDoc , bool bSearchForParallelAxisIfNothingIsFound ); static css::uno::Reference< diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 36f6a84756cb..25054aa2482c 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -136,14 +136,13 @@ void AxisHelper::checkDateAxis( chart2::ScaleData& rScale, ExplicitCategoriesPro sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( const Reference< chart2::XAxis >& xAxis , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem - , const Reference<chart2::XChartDocument>& xChartDoc + , const rtl::Reference<ChartModel>& xChartDoc , bool bSearchForParallelAxisIfNothingIsFound ) { sal_Int32 nNumberFormatKey(0); sal_Int32 nAxisIndex = 0; sal_Int32 nDimensionIndex = 1; AxisHelper::getIndicesForAxis( xAxis, xCorrespondingCoordinateSystem, nDimensionIndex, nAxisIndex ); - Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier(xChartDoc, uno::UNO_QUERY); Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY ); if (!xProp.is()) @@ -157,18 +156,12 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( { bool bFormatSet = false; //check whether we have a percent scale -> use percent format - ChartModel* pModel = nullptr; - if( xNumberFormatsSupplier.is() ) + if (xChartDoc) { - pModel = dynamic_cast<ChartModel*>( xChartDoc.get() ); - assert(pModel); - } - if (pModel) - { - ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *pModel ); + ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *xChartDoc ); if( aData.AxisType==AxisType::PERCENT ) { - sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xNumberFormatsSupplier ); + sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc ); if( nPercentFormat != -1 ) { nNumberFormatKey = nPercentFormat; @@ -183,7 +176,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) ) nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 ); else - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); bFormatSet = true; } } @@ -192,11 +185,11 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( Reference< chart2::XDiagram > xDiagram( xChartDoc->getFirstDiagram() ); if( DiagramHelper::isSupportingDateAxis( xDiagram ) ) { - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); } else { - Reference< data::XDataSource > xSource( DataSourceHelper::getUsedData( xChartDoc ) ); + Reference< data::XDataSource > xSource( DataSourceHelper::getUsedData( Reference< XChartDocument >(xChartDoc) ) ); if( xSource.is() ) { std::vector< Reference< chart2::data::XLabeledDataSequence > > aXValues( @@ -222,7 +215,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } } if( bHasValidDoubles ) - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); } } } diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index d2070abd1237..936419759301 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -181,7 +181,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr { Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) ); nAxisNumberFormat = AxisHelper::getExplicitNumberFormatKeyForAxis( - xAxis, xCooSysModel, uno::Reference<chart2::XChartDocument>(&rModel), false ); + xAxis, xCooSysModel, &rModel, false ); } Color nLabelColor; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 112bb1b91b42..5084994752f5 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1819,7 +1819,9 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc) { - return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xChartDoc + auto pChartModel = dynamic_cast<ChartModel*>(xChartDoc.get()); + assert(!xChartDoc || pChartModel); + return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, pChartModel , true /*bSearchForParallelAxisIfNothingIsFound*/ ); } |