diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-04-02 16:10:00 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-04-08 15:30:03 +0200 |
commit | a3881a66b8ffda4a8a89ecfc4347555e34193665 (patch) | |
tree | 403934182fbcb8b39d39ceb9af69e598e885cd1e /oox | |
parent | 69b5da392951fbd655912185434edab94f8ac0af (diff) |
tdf#124466 XLSX: fix broken export by removing chart type data redundancy
XLSX import created a redundant series container for data series with the
same chart type, when they were attached to a different axis. Modifying
the loaded chart by the user, ie. attaching one of its data series to a
different axis resulted broken OOXML export later, because based on the
new axis, splitDataSeriesByAxis splitted the first or the redundant series
container further. Now the import creates only a single series container
for the series with the same chart type, preventing potential export problems.
Change-Id: If951feaca3cb3b5df7718e9d7bfd59620ef3c4d3
Reviewed-on: https://gerrit.libreoffice.org/70141
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/source/drawingml/chart/typegroupconverter.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index 1f6c73e11d0b..bd592e6adbc5 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -312,6 +312,10 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra OUString aService = OUString::createFromAscii( maTypeInfo.mpcServiceName ); Reference< XChartType > xChartType( createInstance( aService ), UNO_QUERY_THROW ); + Reference< XChartTypeContainer > xChartTypeContOld( rxCoordSystem, UNO_QUERY_THROW ); + Sequence< Reference< XChartType > > xOldChartTypes( xChartTypeContOld->getChartTypes() ); + sal_Int32 nOldChartTypeIdx = -1; + // additional properties PropertySet aDiaProp( rxDiagram ); PropertySet aTypeProp( xChartType ); @@ -419,11 +423,19 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra } else { + for( sal_Int32 nCTIdx=0; nCTIdx<xOldChartTypes.getLength(); ++nCTIdx ) + { + if ( xChartType->getChartType() == xOldChartTypes[nCTIdx]->getChartType() ) + { + nOldChartTypeIdx = nCTIdx; + } + } + for (auto const& elem : aSeries) { SeriesConverter& rSeriesConv = *elem; Reference< XDataSeries > xDataSeries = rSeriesConv.createDataSeries( *this, bVaryColorsByPoint ); - insertDataSeries( xChartType, xDataSeries, nAxesSetIdx ); + insertDataSeries( nOldChartTypeIdx == -1 ? xChartType : xOldChartTypes[nOldChartTypeIdx], xDataSeries, nAxesSetIdx ); /* Excel does not use the value of the c:smooth element of the chart type to set a default line smoothing for the data @@ -440,7 +452,10 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra // add chart type object to coordinate system Reference< XChartTypeContainer > xChartTypeCont( rxCoordSystem, UNO_QUERY_THROW ); - xChartTypeCont->addChartType( xChartType ); + if (nOldChartTypeIdx == -1) + { + xChartTypeCont->addChartType(xChartType); + } // set existence of bar connector lines at diagram (only in stacked 2D bar charts) if( mrModel.mxSerLines.is() && !mb3dChart && (maTypeInfo.meTypeCategory == TYPECATEGORY_BAR) && (isStacked() || isPercent()) ) |