diff options
author | Muthu Subramanian <sumuthu@collabora.com> | 2013-10-22 14:47:56 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@collabora.com> | 2013-10-22 15:01:37 +0530 |
commit | 6bb564b93d85493476d7879a29b6db85b76800f1 (patch) | |
tree | 59c1944ad29d51c52f23a7c9403e45687c03c7b4 | |
parent | 7a6043c20b1df3ed90341d9d079a16d385ccca4b (diff) |
n#839727: Chart missing dataset.
This was because there is no explicit category
in the chart - while libreoffice expects it.
-rw-r--r-- | oox/source/drawingml/chart/typegroupconverter.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx index 12d086d09fef..bf8e16669df4 100644 --- a/oox/source/drawingml/chart/typegroupconverter.cxx +++ b/oox/source/drawingml/chart/typegroupconverter.cxx @@ -272,6 +272,7 @@ Reference< XCoordinateSystem > TypeGroupConverter::createCoordinateSystem() Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence() { + sal_Int32 nMaxValues = 0; Reference< XLabeledDataSequence > xLabeledSeq; /* Find first existing category sequence. The bahaviour of Excel 2007 is different to Excel 2003, which always used the category sequence of the @@ -283,6 +284,24 @@ Reference< XLabeledDataSequence > TypeGroupConverter::createCategorySequence() SeriesConverter aSeriesConv( *this, **aIt ); xLabeledSeq = aSeriesConv.createCategorySequence( "categories" ); } + else if( nMaxValues <= 0 && (*aIt)->maSources.has( SeriesModel::VALUES ) ) + { + DataSourceModel *pValues = (*aIt)->maSources.get( SeriesModel::VALUES ).get(); + if( pValues->mxDataSeq.is() ) + nMaxValues = pValues->mxDataSeq.get()->maData.size(); + } + } + /* n#839727 Create Category Sequence when none are found */ + if( !xLabeledSeq.is() && mrModel.maSeries.size() > 0 ) { + if( nMaxValues < 0 ) + nMaxValues = 2; + SeriesModel &aModel = mrModel.maSeries.create(); + DataSourceModel &aSrc = aModel.maSources.create( SeriesModel::CATEGORIES ); + DataSequenceModel &aSeq = aSrc.mxDataSeq.create(); + for( sal_Int32 i = 0; i < nMaxValues; i++ ) + aSeq.maData[ i ] <<= OUString::number( i + 1 ); + SeriesConverter aSeriesConv( *this, aModel ); + xLabeledSeq = aSeriesConv.createCategorySequence( "categories" ); } return xLabeledSeq; } |