diff options
Diffstat (limited to 'chart2/source/view/main/ChartView.cxx')
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 4d4c3c8a74ff..9142b3e6e617 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1870,7 +1870,16 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( if( !xSeriesOrPointProp.is() ) return nFormat; - if (!(xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat)) + bool bLinkToSource = true; + try + { + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; + } + catch ( const beans::UnknownPropertyException& ) {} + + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat; + sal_Int32 nOldFormat = nFormat; + if (bLinkToSource) { uno::Reference< chart2::XChartType > xChartType( DataSeriesHelper::getChartTypeOfSeries( xSeries, xDiagram ) ); @@ -1895,7 +1904,11 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex ); } } + + if (nFormat >= 0 && nOldFormat != nFormat) + xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::makeAny(nFormat)); } + if(nFormat<0) nFormat=0; return nFormat; |