diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-08-29 13:44:37 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-09-02 09:41:32 +0200 |
commit | 0d2340998415fb4b2f794054c62ef61c83e32155 (patch) | |
tree | 8061d63de276c27cc75f961742033b31105beb8d /chart2 | |
parent | 7541fac2c0d5341f4d362779594ae236f05ff9a6 (diff) |
tdf#136061 Chart ODF/OOXML: fix missing custom labels
by UNO extensions ShowCustomLabel in DataPointLabel.idl and
CUSTOM in ChartDataCaption.idl, fixing OOXML/ODF import/export.
We should display custom data label even if DataPointLabel is
disabled (e.g. category name and/or value fields are not displayed).
Note: import of the embedded chart of the DOCX unit test
document uses also ODF format in the background, testing
also the extension of the native file format.
Change-Id: I73e21f1e69fddec9f3b4163c46b6582cd1c74b5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101640
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
5 files changed, 11 insertions, 5 deletions
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx index f55540f67db8..c786c1b3913c 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx @@ -71,7 +71,7 @@ sal_Int32 lcl_LabelToCaption( const chart2::DataPointLabel& rLabel ) chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption ) { - chart2::DataPointLabel aLabel(false,false,false,false); + chart2::DataPointLabel aLabel(false,false,false,false,false); if( nCaption & css::chart::ChartDataCaption::VALUE ) aLabel.ShowNumber = true; @@ -81,6 +81,8 @@ chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption ) aLabel.ShowCategoryName = true; if( nCaption & css::chart::ChartDataCaption::SYMBOL ) aLabel.ShowLegendSymbol = true; + if( nCaption & css::chart::ChartDataCaption::CUSTOM ) + aLabel.ShowCustomLabel = true; return aLabel; } diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 2d8435d9b436..3668321589db 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -761,6 +761,7 @@ bool ChartController::executeDispatch_Delete() aLabel.ShowNumberInPercent = false; aLabel.ShowCategoryName = false; aLabel.ShowLegendSymbol = false; + aLabel.ShowCustomLabel = false; if( aObjectType == OBJECTTYPE_DATA_LABELS ) { uno::Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( aCID, getModel() )); diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx index dba488fdd924..dcc343002ffb 100644 --- a/chart2/source/model/main/DataPointProperties.cxx +++ b/chart2/source/model/main/DataPointProperties.cxx @@ -515,7 +515,8 @@ void DataPointProperties::AddDefaultsToMap( false, // ShowNumber false, // ShowNumberInPercent false, // ShowCategoryName - false // ShowLegendSymbol + false, // ShowLegendSymbol + false // ShowCustomLabel )); PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_TEXT_WORD_WRAP, false ); diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 11f6bf2d94b3..809ba67a931e 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -170,6 +170,7 @@ void lcl_insertOrDeleteDataLabelsToSeriesAndAllPoints( const Reference< chart2:: { aLabel.ShowNumberInPercent = false; aLabel.ShowCategoryName = false; + aLabel.ShowCustomLabel = false; } xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel)); } @@ -746,7 +747,7 @@ bool hasDataLabelsAtPoints( const Reference< chart2::XDataSeries >& xSeries ) { DataPointLabel aLabel; if( xPointProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel ) - bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName || aLabel.ShowCustomLabel; if( bRet ) break; } @@ -784,7 +785,7 @@ bool hasDataLabelAtPoint( const Reference< chart2::XDataSeries >& xSeries, sal_I { DataPointLabel aLabel; if( xProp->getPropertyValue(CHART_UNONAME_LABEL) >>= aLabel ) - bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName; + bRet = aLabel.ShowNumber || aLabel.ShowNumberInPercent || aLabel.ShowCategoryName || aLabel.ShowCustomLabel; } } } @@ -834,6 +835,7 @@ void deleteDataLabelsFromPoint( const Reference< beans::XPropertySet >& xPointPr aLabel.ShowNumber = false; aLabel.ShowNumberInPercent = false; aLabel.ShowCategoryName = false; + aLabel.ShowCustomLabel = false; xPointProp->setPropertyValue(CHART_UNONAME_LABEL, uno::Any(aLabel)); } } diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index 91388d1c2eda..db93d255fe21 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -996,7 +996,7 @@ DataPointLabel* VDataSeries::getDataPointLabelIfLabel( sal_Int32 index ) const { DataPointLabel* pLabel = getDataPointLabel( index ); if( !pLabel || (!pLabel->ShowNumber && !pLabel->ShowNumberInPercent - && !pLabel->ShowCategoryName ) ) + && !pLabel->ShowCategoryName && !pLabel->ShowCustomLabel ) ) return nullptr; return pLabel; } |