[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 2 commits - oox/source

Muthu Subramanian sumuthu at collabora.com
Tue Oct 22 03:49:58 PDT 2013


 oox/source/drawingml/chart/seriesconverter.cxx    |    3 ++-
 oox/source/drawingml/chart/typegroupconverter.cxx |   19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 812a175d736cf32aa756408b0d7906cd269d2a03
Author: Muthu Subramanian <sumuthu at collabora.com>
Date:   Tue Oct 22 15:13:41 2013 +0530

    n#839727: Crash fix.

diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 9ef1f3f..020b141 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -632,7 +632,8 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve
         {
             // Use number format code from Value series
             DataSourceModel* pValues = mrModel.maSources.get( SeriesModel::VALUES ).get();
-            xLabels->maNumberFormat.maFormatCode = pValues->mxDataSeq->maFormatCode;
+            if( pValues )
+                xLabels->maNumberFormat.maFormatCode = pValues->mxDataSeq->maFormatCode;
         }
         DataLabelsConverter aLabelsConv( *this, *xLabels );
         aLabelsConv.convertFromModel( xDataSeries, rTypeGroup );
commit 1cd5bef6fd9edef708334e3590c57c6aa6f1371f
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