[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - oox/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 19 13:55:32 UTC 2021


 oox/source/drawingml/chart/typegroupconverter.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 31bd823c522dfbe6a495c7d93fce2ebc1f724514
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Apr 7 11:00:25 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Apr 19 15:54:31 2021 +0200

    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 at collabora.com>

diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index f6cea5df9b38..5c96001909bc 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -290,11 +290,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" );
     }


More information about the Libreoffice-commits mailing list