diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-03-25 11:31:02 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-04-09 10:25:52 +0200 |
commit | e4a087876da2584b772480d4fe8fc58081dfe0b8 (patch) | |
tree | 66a698eb2271cb21d5cf1ab4c36dac808a98ff9f /chart2/source/view/main/ChartView.cxx | |
parent | ab4522548179651c55edbe7ee19cc90658d68634 (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
of unit test document testAreaChartNumberFormat.docx of
commit e57d90cd4e51a1353eafc87bb29cfe6076704a7c
(tdf#129173 tdf#129175 Fix number format of data labels)
to see the Data Labels for Data Series... window. On the page
"Data Labels...", click on the Number format... button to see
the enabled checkbox "Source format" (that was disabled
previously).
Change-Id: I2845e6f462db273f21c47bb286bed56046f8cf21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91038
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 | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 9900d5139af4..547295155b12 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -1874,45 +1874,17 @@ 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() ) return 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 ) ); - - 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)); + xSeriesOrPointProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nFormat; } + catch (const beans::UnknownPropertyException&) {} if(nFormat<0) nFormat=0; |