diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-01-21 14:20:38 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-01-24 13:01:44 +0100 |
commit | a4cdd4d1266e77330d4745f369db85ee7dba265c (patch) | |
tree | 318b92a64666f3a5cd59a4ee860efa6832ca215e /oox | |
parent | 3e4cad1f4b4a6a07b516a0d205d642a985e17484 (diff) |
tdf#130105 Chart OOXML Import: Fix data label position
The position of datapoint labels was overwritten with the
position of series placement. Do not overwrite datapoint
labels placement, if we have explicit datapoint label placement.
Regression from commit: 70944a849dc59fa686e3f316a3983dbc8a47017f
(tdf#109858: Override default point label placement setting...)
Change-Id: Ic27c8a7eb93e8c3776389d1b3d285d120568f024
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87137
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/chart/seriesconverter.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/chart/seriesconverter.cxx | 21 |
2 files changed, 11 insertions, 12 deletions
diff --git a/oox/inc/drawingml/chart/seriesconverter.hxx b/oox/inc/drawingml/chart/seriesconverter.hxx index 3c345f795c1e..0e5443519b47 100644 --- a/oox/inc/drawingml/chart/seriesconverter.hxx +++ b/oox/inc/drawingml/chart/seriesconverter.hxx @@ -47,7 +47,7 @@ public: /** Converts OOXML data label settings for the passed data point. */ void convertFromModel( const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries, - const TypeGroupConverter& rTypeGroup, const PropertySet& rSeriesPropSet ); + const TypeGroupConverter& rTypeGroup ); }; diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 1ac4ec9226fa..dccd19713833 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -132,7 +132,7 @@ void convertTextProperty(PropertySet& rPropSet, ObjectFormatter& rFormatter, void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatter, const DataLabelModelBase& rDataLabel, const TypeGroupConverter& rTypeGroup, - bool bDataSeriesLabel, bool bMSO2007Doc, const PropertySet* pSeriesPropSet ) + bool bDataSeriesLabel, bool bMSO2007Doc ) { const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo(); @@ -191,7 +191,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt if( bDataSeriesLabel || rDataLabel.monLabelPos.has() ) { namespace csscd = ::com::sun::star::chart::DataLabelPlacement; - sal_Int32 nPlacement = rTypeInfo.mnDefLabelPos; + sal_Int32 nPlacement = -1; switch( rDataLabel.monLabelPos.get( XML_TOKEN_INVALID ) ) { case XML_outEnd: nPlacement = csscd::OUTSIDE; break; @@ -205,10 +205,10 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt case XML_bestFit: nPlacement = csscd::AVOID_OVERLAP; break; } - sal_Int32 nGlobalPlacement = 0; - if ( !bDataSeriesLabel && nPlacement == rTypeInfo.mnDefLabelPos && pSeriesPropSet && - pSeriesPropSet->getProperty( nGlobalPlacement, PROP_LabelPlacement ) ) - nPlacement = nGlobalPlacement; + if( !bDataSeriesLabel && nPlacement == -1 ) + return; + else if( nPlacement == -1 ) + nPlacement = rTypeInfo.mnDefLabelPos; rPropSet.setProperty( PROP_LabelPlacement, nPlacement ); } @@ -260,8 +260,7 @@ DataLabelConverter::~DataLabelConverter() { } -void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDataSeries, const TypeGroupConverter& rTypeGroup, - const PropertySet& rSeriesPropSet ) +void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDataSeries, const TypeGroupConverter& rTypeGroup ) { if (!rxDataSeries.is()) return; @@ -270,7 +269,7 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat { bool bMSO2007Doc = getFilter().isMSO2007Document(); PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) ); - lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bMSO2007Doc, &rSeriesPropSet ); + lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false, bMSO2007Doc ); const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo(); bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE; if( mrModel.mxLayout && !mrModel.mxLayout->mbAutoLayout && !bIsPie ) @@ -370,7 +369,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa if( !mrModel.mbDeleted ) { bool bMSO2007Doc = getFilter().isMSO2007Document(); - lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc, nullptr ); + lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, true, bMSO2007Doc ); if (mrModel.mxShapeProp) // Import baseline border properties for these data labels. @@ -384,7 +383,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa pointLabel->maNumberFormat = mrModel.maNumberFormat; DataLabelConverter aLabelConv(*this, *pointLabel); - aLabelConv.convertFromModel( rxDataSeries, rTypeGroup, aPropSet ); + aLabelConv.convertFromModel( rxDataSeries, rTypeGroup ); } } |