summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-04-07 11:00:25 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-04-12 11:22:18 +0200
commit5bf84e085b3749330ce213b09ecdf71177e84bed (patch)
treed793517c8820986f4099f692f8ce469fd4c2f65c
parent6ffad2ef4f08906c32fbf5ee72ee428f3bb68fb1 (diff)
Don't overwrite existing categories for series
When chart serie has defined categories which are not references we can fail on creating XLabeledDataSequence and in the end overwrite them. Change-Id: Ie8dc76e420fc4a2508df66a6dca80b8023ee895b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113835 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--oox/source/drawingml/chart/typegroupconverter.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 6cc4d81eba25..d6982192a4f5 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -291,11 +291,14 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence()
if( nMaxValues < 0 )
nMaxValues = 2;
SeriesModel &aModel = *mrModel.maSeries.get(0);
- DataSourceModel &aSrc = aModel.maSources.create( SeriesModel::CATEGORIES );
- DataSequenceModel &aSeq = aSrc.mxDataSeq.create();
- aSeq.mnPointCount = nMaxValues;
- for( sal_Int32 i = 0; i < nMaxValues; i++ )
- aSeq.maData[ i ] <<= OUString::number( i + 1 );
+ if (!aModel.maSources.has(SeriesModel::CATEGORIES))
+ {
+ DataSourceModel &aSrc = aModel.maSources.create( SeriesModel::CATEGORIES );
+ DataSequenceModel &aSeq = aSrc.mxDataSeq.create();
+ aSeq.mnPointCount = nMaxValues;
+ for( sal_Int32 i = 0; i < nMaxValues; i++ )
+ aSeq.maData[ i ] <<= OUString::number( i + 1 );
+ }
SeriesConverter aSeriesConv( *this, aModel );
xLabeledSeq = aSeriesConv.createCategorySequence( "categories" );
}