summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-04-01 13:57:33 +0200
committerLászló Németh <nemeth@numbertext.org>2019-04-02 08:34:08 +0200
commitad363fd42e439b43c57b6541988234fbaf1ddb30 (patch)
tree3f868c12acc9a03a4fced9f6d08f8bf16347fa09 /oox
parent7b74a1f41c5dd004e4d3af50b79cfd006ec59ab8 (diff)
tdf#124463 XLSX export: fix splitDataSeriesByAxis
splitDataSeriesByAxis couldn't split series correctly into two sequences, because it put all series into the first created sequence, except the first series of the newer sequence. Other improvement: first sequence of the return vector always contains the series attached to the primary axis. Change-Id: I6e107aa990f9a1a1db49cae2a4f3c9d8a35fb54c Reviewed-on: https://gerrit.libreoffice.org/70059 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 47c30b1ba569..062636c91d62 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1592,6 +1592,7 @@ std::vector<Sequence<Reference<chart2::XDataSeries> > > splitDataSeriesByAxis(co
Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
if(xDSCnt.is())
{
+ sal_Int32 nAxisIndexOfFirstSeries = -1;
Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
for (sal_Int32 nIndex = 0, nEnd = aSeriesSeq.getLength(); nIndex < nEnd; ++nIndex)
{
@@ -1604,6 +1605,10 @@ std::vector<Sequence<Reference<chart2::XDataSeries> > > splitDataSeriesByAxis(co
uno::Any aAny = xPropSet->getPropertyValue("AttachedAxisIndex");
aAny >>= nAxisIndex;
size_t nVectorPos = 0;
+ if (nAxisIndexOfFirstSeries == -1)
+ {
+ nAxisIndexOfFirstSeries = nAxisIndex;
+ }
auto it = aMapAxisToIndex.find(nAxisIndex);
if (it == aMapAxisToIndex.end())
@@ -1612,12 +1617,22 @@ std::vector<Sequence<Reference<chart2::XDataSeries> > > splitDataSeriesByAxis(co
nVectorPos = aSplitSeries.size() - 1;
aMapAxisToIndex.insert(std::pair<sal_Int32, size_t>(nAxisIndex, nVectorPos));
}
+ else
+ {
+ nVectorPos = it->second;
+ }
uno::Sequence<Reference<chart2::XDataSeries> >& rAxisSeriesSeq = aSplitSeries[nVectorPos];
sal_Int32 nLength = rAxisSeriesSeq.getLength();
rAxisSeriesSeq.realloc(nLength + 1);
rAxisSeriesSeq[nLength] = xSeries;
}
+ // if the first series attached to secondary axis, then export those series first, which are attached to primary axis
+ // also the MS Office export every time in this order
+ if ( aSplitSeries.size() > 1 && nAxisIndexOfFirstSeries == 1 )
+ {
+ std::swap( aSplitSeries[0], aSplitSeries[1] );
+ }
}
return aSplitSeries;