[Libreoffice-commits] core.git: oox/source

Muthu Subramanian sumuthu at collabora.com
Tue Oct 22 02:28:14 PDT 2013


 oox/source/drawingml/chart/typegroupconverter.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 6bb564b93d85493476d7879a29b6db85b76800f1
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Tue Oct 22 14:47:56 2013 +0530

    n#839727: Chart missing dataset.
    
    This was because there is no explicit category
    in the chart - while libreoffice expects it.

diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 12d086d..bf8e166 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;
 }


More information about the Libreoffice-commits mailing list