diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-03-06 10:27:11 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-03-24 11:20:46 +0100 |
commit | 9bf40c635c41c6b3b072b7c61fea67a20ba4342b (patch) | |
tree | 00e3dd6fbbe44dc21dc01328024fd84f710c77e6 /chart2/source/view/main/ChartView.cxx | |
parent | 45435e2ac007aed2aabd175ad944d6c779d99167 (diff) |
tdf#95425 follow-up: enable "Source format" checkbox of data label
settings after file opening, if its value is true in the opened
ODF or OOXML document, instead of always showing disabled state.
Testing notes: double click on a data label during chart editing
to see the Data Labels for Data Series... window. On the page
"Data Labels...", click on the Number format... button to see
the checkbox "Source format".
Change-Id: Idb837d9492ad7e83b9020167c47ed52499c070a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90079
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source/view/main/ChartView.cxx')
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index bcda427a6bdb..f84446fbe47d 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1874,12 +1874,7 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( , true /*bSearchForParallelAxisIfNothingIsFound*/ ); } -sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( - const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp, - const uno::Reference< XDataSeries >& xSeries, - sal_Int32 nPointIndex /*-1 for whole series*/, - const uno::Reference< XDiagram >& xDiagram - ) +sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( const uno::Reference< beans::XPropertySet >& xSeriesOrPointProp ) { sal_Int32 nFormat=0; if( !xSeriesOrPointProp.is() ) @@ -1892,27 +1887,10 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( } 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 ) ); - - Reference< chart2::data::XDataSource > xSeriesSource( xSeries, uno::UNO_QUERY ); - OUString aRole( ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( xChartType ) ); - - Reference< data::XLabeledDataSequence > xLabeledSequence( - DataSeriesHelper::getDataSequenceByRole( xSeriesSource, aRole )); - if( xLabeledSequence.is() ) - { - Reference< data::XDataSequence > xValues( xLabeledSequence->getValues() ); - if( xValues.is() ) - nFormat = xValues->getNumberFormatKeyByIndex( nPointIndex ); - } - - if (nFormat >= 0 && nOldFormat != nFormat) - xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any(nFormat)); - } + if( bLinkToSource ) + xSeriesOrPointProp->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any(nFormat)); + else + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat; if(nFormat<0) nFormat=0; |