[Libreoffice-commits] core.git: 2 commits - chart2/qa helpcontent2 include/oox oox/source
Olivier Hallot (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 10 12:02:36 UTC 2021
chart2/qa/extras/chart2export.cxx | 20 +
chart2/qa/extras/data/xlsx/testSecondaryAxis.xlsx |binary
helpcontent2 | 2
include/oox/export/chartexport.hxx | 4
oox/source/export/chartexport.cxx | 336 ++++++++++++----------
5 files changed, 208 insertions(+), 154 deletions(-)
New commits:
commit 7930a1c5de1dfea458ba52502259b4ff702fd3f4
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
AuthorDate: Thu Jun 10 09:02:01 2021 -0300
Commit: Gerrit Code Review <gerrit at gerrit.libreoffice.org>
CommitDate: Thu Jun 10 14:02:01 2021 +0200
Update git submodules
* Update helpcontent2 from branch 'master'
to fded06f95f73fd0bfb27d861843c2f317db83d29
- tdf#132906 Update Sampling statistics dialog
Change-Id: Ibe4132cfb80455dfc3338b17155bf449aad6e840
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/116925
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/helpcontent2 b/helpcontent2
index 9fffc3e09d2c..fded06f95f73 160000
--- a/helpcontent2
+++ b/helpcontent2
@@ -1 +1 @@
-Subproject commit 9fffc3e09d2cddfc614e5520d8d33942572dd5a5
+Subproject commit fded06f95f73fd0bfb27d861843c2f317db83d29
commit 3b4c11350a631e27345e87ecfe258d12983cbfbc
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Jun 8 09:24:48 2021 +0200
Commit: Balazs Varga <varga.balazs3 at nisz.hu>
CommitDate: Thu Jun 10 14:01:52 2021 +0200
tdf#142713 OOXML: export secondary axis of all chart types
where the secondary axis is supported by the chart model
and OOXML.
Change-Id: Ifbcc905139487965510063aa87991ce6f8df73ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116809
Tested-by: Jenkins
Reviewed-by: Balazs Varga <varga.balazs3 at nisz.hu>
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index dd8b40182d05..89dcdeb529fd 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -128,6 +128,7 @@ public:
void testTdf96161();
void testMultipleAxisXLSX();
void testSecondaryAxisXLSX();
+ void testBarChartSecondaryAxisXLSX();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -221,6 +222,7 @@ public:
CPPUNIT_TEST(testTdf96161);
CPPUNIT_TEST(testMultipleAxisXLSX);
CPPUNIT_TEST(testSecondaryAxisXLSX);
+ CPPUNIT_TEST(testBarChartSecondaryAxisXLSX);
CPPUNIT_TEST_SUITE_END();
};
@@ -1925,6 +1927,24 @@ void Chart2ExportTest::testSecondaryAxisXLSX()
assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart[2]/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v", "a");
}
+void Chart2ExportTest::testBarChartSecondaryAxisXLSX()
+{
+ load(u"/chart2/qa/extras/data/xlsx/", "testSecondaryAxis.xlsx");
+ xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+ // Collect barchart axID on primary Axis
+ OUString XValueIdOf1Barchart = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart[1]/c:axId[1]", "val");
+ OUString YValueIdOf1Barchart = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart[1]/c:axId[2]", "val");
+ // Collect barchart axID on secondary Axis
+ OUString XValueIdOf2Barchart = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart[2]/c:axId[1]", "val");
+ OUString YValueIdOf2Barchart = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart[2]/c:axId[2]", "val");
+ // Check which c:catAx and c:valAx contain the AxisId of barcharts
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[1]/c:axId", "val", XValueIdOf1Barchart);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[1]/c:axId", "val", YValueIdOf1Barchart);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:catAx[2]/c:axId", "val", XValueIdOf2Barchart);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", "val", YValueIdOf2Barchart);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/testSecondaryAxis.xlsx b/chart2/qa/extras/data/xlsx/testSecondaryAxis.xlsx
new file mode 100644
index 000000000000..6faa39b29480
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/testSecondaryAxis.xlsx differ
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index b6ed39c72dbb..5dbf8c20ac0b 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -158,7 +158,7 @@ private:
void exportRadarChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
void exportScatterChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
void exportScatterChartSeries( const css::uno::Reference< css::chart2::XChartType >& xChartType,
- css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries>>* pSeries);
+ const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries>>* pSeries);
void exportStockChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
void exportSurfaceChart( const css::uno::Reference< css::chart2::XChartType >& xChartType );
void exportHiLowLines();
@@ -166,7 +166,7 @@ private:
void exportAllSeries(const css::uno::Reference<css::chart2::XChartType>& xChartType, bool& rPrimaryAxes);
void exportSeries(const css::uno::Reference< css::chart2::XChartType >& xChartType,
- css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes);
+ const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes);
void exportVaryColors(const css::uno::Reference<css::chart2::XChartType>& xChartType);
void exportCandleStickSeries(
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 4a9a1d027bc5..63f29a245ddc 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1511,7 +1511,64 @@ void ChartExport::exportTitle( const Reference< XShape >& xShape, const OUString
pFS->endElement( FSNS( XML_c, XML_title ) );
}
-void ChartExport::exportPlotArea( const Reference< css::chart::XChartDocument >& xChartDoc )
+namespace {
+
+ std::vector<Sequence<Reference<chart2::XDataSeries> > > splitDataSeriesByAxis(const Reference< chart2::XChartType >& xChartType)
+ {
+ std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitSeries;
+ std::map<sal_Int32, size_t> aMapAxisToIndex;
+
+ Reference< chart2::XDataSeriesContainer > xDSCnt(xChartType, uno::UNO_QUERY);
+ if (xDSCnt.is())
+ {
+ sal_Int32 nAxisIndexOfFirstSeries = -1;
+ const Sequence< Reference< chart2::XDataSeries > > aSeriesSeq(xDSCnt->getDataSeries());
+ for (const uno::Reference<chart2::XDataSeries>& xSeries : aSeriesSeq)
+ {
+ Reference<beans::XPropertySet> xPropSet(xSeries, uno::UNO_QUERY);
+ if (!xPropSet.is())
+ continue;
+
+ sal_Int32 nAxisIndex = -1;
+ 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())
+ {
+ aSplitSeries.emplace_back();
+ 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;
+ }
+
+}
+
+void ChartExport::exportPlotArea(const Reference< css::chart::XChartDocument >& xChartDoc)
{
Reference< chart2::XCoordinateSystemContainer > xBCooSysCnt( mxNewDiagram, uno::UNO_QUERY );
if( ! xBCooSysCnt.is())
@@ -1542,7 +1599,14 @@ void ChartExport::exportPlotArea( const Reference< css::chart::XChartDocument >&
// tdf#123647 Save empty chart as empty bar chart.
if (!aCooSysSeq.hasElements())
- exportBarChart(nullptr);
+ {
+ pFS->startElement(FSNS(XML_c, XML_barChart));
+ pFS->singleElement(FSNS(XML_c, XML_barDir), XML_val, "col");
+ pFS->singleElement(FSNS(XML_c, XML_grouping), XML_val, "clustered");
+ pFS->singleElement(FSNS(XML_c, XML_varyColors), XML_val, "0");
+ exportAxesId(true);
+ pFS->endElement(FSNS(XML_c, XML_barChart));
+ }
for( const auto& rCS : aCooSysSeq )
{
@@ -1959,65 +2023,79 @@ void ChartExport::exportDataTable( )
void ChartExport::exportAreaChart( const Reference< chart2::XChartType >& xChartType )
{
FSHelperPtr pFS = GetFS();
- sal_Int32 nTypeId = XML_areaChart;
- if( mbIs3DChart )
- nTypeId = XML_area3DChart;
- pFS->startElement(FSNS(XML_c, nTypeId));
+ const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
+ for (const auto& splitDataSeries : aSplitDataSeries)
+ {
+ if (!splitDataSeries.hasElements())
+ continue;
- exportGrouping( );
- bool bPrimaryAxes = true;
- exportAllSeries(xChartType, bPrimaryAxes);
- exportAxesId(bPrimaryAxes);
+ sal_Int32 nTypeId = XML_areaChart;
+ if (mbIs3DChart)
+ nTypeId = XML_area3DChart;
+ pFS->startElement(FSNS(XML_c, nTypeId));
- pFS->endElement( FSNS( XML_c, nTypeId ) );
+ exportGrouping();
+ bool bPrimaryAxes = true;
+ exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
+ exportAxesId(bPrimaryAxes);
+
+ pFS->endElement(FSNS(XML_c, nTypeId));
+ }
}
-void ChartExport::exportBarChart( const Reference< chart2::XChartType >& xChartType )
+void ChartExport::exportBarChart(const Reference< chart2::XChartType >& xChartType)
{
sal_Int32 nTypeId = XML_barChart;
- if( mbIs3DChart )
+ if (mbIs3DChart)
nTypeId = XML_bar3DChart;
FSHelperPtr pFS = GetFS();
- pFS->startElement(FSNS(XML_c, nTypeId));
- // bar direction
- bool bVertical = false;
- Reference< XPropertySet > xPropSet( mxDiagram , uno::UNO_QUERY);
- if( GetProperty( xPropSet, "Vertical" ) )
- mAny >>= bVertical;
- const char* bardir = bVertical? "bar":"col";
- pFS->singleElement(FSNS(XML_c, XML_barDir), XML_val, bardir);
+ const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
+ for (const auto& splitDataSeries : aSplitDataSeries)
+ {
+ if (!splitDataSeries.hasElements())
+ continue;
- exportGrouping( true );
+ pFS->startElement(FSNS(XML_c, nTypeId));
+ // bar direction
+ bool bVertical = false;
+ Reference< XPropertySet > xPropSet(mxDiagram, uno::UNO_QUERY);
+ if (GetProperty(xPropSet, "Vertical"))
+ mAny >>= bVertical;
- exportVaryColors(xChartType);
+ const char* bardir = bVertical ? "bar" : "col";
+ pFS->singleElement(FSNS(XML_c, XML_barDir), XML_val, bardir);
- bool bPrimaryAxes = true;
- exportAllSeries(xChartType, bPrimaryAxes);
+ exportGrouping(true);
- Reference< XPropertySet > xTypeProp( xChartType, uno::UNO_QUERY );
+ exportVaryColors(xChartType);
- if( xTypeProp.is() && GetProperty( xTypeProp, "GapwidthSequence") )
- {
- uno::Sequence< sal_Int32 > aBarPositionSequence;
- mAny >>= aBarPositionSequence;
- if( aBarPositionSequence.hasElements() )
+ bool bPrimaryAxes = true;
+ exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
+
+ Reference< XPropertySet > xTypeProp(xChartType, uno::UNO_QUERY);
+
+ if (xTypeProp.is() && GetProperty(xTypeProp, "GapwidthSequence"))
{
- sal_Int32 nGapWidth = aBarPositionSequence[0];
- pFS->singleElement(FSNS(XML_c, XML_gapWidth), XML_val, OString::number(nGapWidth));
+ uno::Sequence< sal_Int32 > aBarPositionSequence;
+ mAny >>= aBarPositionSequence;
+ if (aBarPositionSequence.hasElements())
+ {
+ sal_Int32 nGapWidth = aBarPositionSequence[0];
+ pFS->singleElement(FSNS(XML_c, XML_gapWidth), XML_val, OString::number(nGapWidth));
+ }
}
- }
- if( mbIs3DChart )
- {
- // Shape
- namespace cssc = css::chart;
- sal_Int32 nGeom3d = cssc::ChartSolidType::RECTANGULAR_SOLID;
- if( xPropSet.is() && GetProperty( xPropSet, "SolidType") )
- mAny >>= nGeom3d;
- const char* sShapeType = nullptr;
- switch( nGeom3d )
+ if (mbIs3DChart)
{
+ // Shape
+ namespace cssc = css::chart;
+ sal_Int32 nGeom3d = cssc::ChartSolidType::RECTANGULAR_SOLID;
+ if (xPropSet.is() && GetProperty(xPropSet, "SolidType"))
+ mAny >>= nGeom3d;
+ const char* sShapeType = nullptr;
+ switch (nGeom3d)
+ {
case cssc::ChartSolidType::RECTANGULAR_SOLID:
sShapeType = "box";
break;
@@ -2030,53 +2108,61 @@ void ChartExport::exportBarChart( const Reference< chart2::XChartType >& xChartT
case cssc::ChartSolidType::PYRAMID:
sShapeType = "pyramid";
break;
+ }
+ pFS->singleElement(FSNS(XML_c, XML_shape), XML_val, sShapeType);
}
- pFS->singleElement(FSNS(XML_c, XML_shape), XML_val, sShapeType);
- }
- //overlap
- if( !mbIs3DChart && xTypeProp.is() && GetProperty( xTypeProp, "OverlapSequence") )
- {
- uno::Sequence< sal_Int32 > aBarPositionSequence;
- mAny >>= aBarPositionSequence;
- if( aBarPositionSequence.hasElements() )
+ //overlap
+ if (!mbIs3DChart && xTypeProp.is() && GetProperty(xTypeProp, "OverlapSequence"))
{
- sal_Int32 nOverlap = aBarPositionSequence[0];
- // Stacked/Percent Bar/Column chart Overlap-workaround
- // Export the Overlap value with 100% for stacked charts,
- // because the default overlap value of the Bar/Column chart is 0% and
- // LibreOffice do nothing with the overlap value in Stacked charts case,
- // unlike the MS Office, which is interpreted differently.
- if( ( mbStacked || mbPercent ) && nOverlap != 100 )
- {
- nOverlap = 100;
- pFS->singleElement(FSNS(XML_c, XML_overlap), XML_val, OString::number(nOverlap));
- }
- else // Normal bar chart
+ uno::Sequence< sal_Int32 > aBarPositionSequence;
+ mAny >>= aBarPositionSequence;
+ if (aBarPositionSequence.hasElements())
{
- pFS->singleElement(FSNS(XML_c, XML_overlap), XML_val, OString::number(nOverlap));
+ sal_Int32 nOverlap = aBarPositionSequence[0];
+ // Stacked/Percent Bar/Column chart Overlap-workaround
+ // Export the Overlap value with 100% for stacked charts,
+ // because the default overlap value of the Bar/Column chart is 0% and
+ // LibreOffice do nothing with the overlap value in Stacked charts case,
+ // unlike the MS Office, which is interpreted differently.
+ if ((mbStacked || mbPercent) && nOverlap != 100)
+ {
+ nOverlap = 100;
+ pFS->singleElement(FSNS(XML_c, XML_overlap), XML_val, OString::number(nOverlap));
+ }
+ else // Normal bar chart
+ {
+ pFS->singleElement(FSNS(XML_c, XML_overlap), XML_val, OString::number(nOverlap));
+ }
}
}
- }
- exportAxesId(bPrimaryAxes);
+ exportAxesId(bPrimaryAxes);
- pFS->endElement( FSNS( XML_c, nTypeId ) );
+ pFS->endElement(FSNS(XML_c, nTypeId));
+ }
}
void ChartExport::exportBubbleChart( const Reference< chart2::XChartType >& xChartType )
{
FSHelperPtr pFS = GetFS();
- pFS->startElement(FSNS(XML_c, XML_bubbleChart));
+ const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
+ for (const auto& splitDataSeries : aSplitDataSeries)
+ {
+ if (!splitDataSeries.hasElements())
+ continue;
- exportVaryColors(xChartType);
+ pFS->startElement(FSNS(XML_c, XML_bubbleChart));
- bool bPrimaryAxes = true;
- exportAllSeries(xChartType, bPrimaryAxes);
+ exportVaryColors(xChartType);
- exportAxesId(bPrimaryAxes);
+ bool bPrimaryAxes = true;
+ exportSeries(xChartType, splitDataSeries, bPrimaryAxes);
- pFS->endElement( FSNS( XML_c, XML_bubbleChart ) );
+ exportAxesId(bPrimaryAxes);
+
+ pFS->endElement(FSNS(XML_c, XML_bubbleChart));
+ }
}
void ChartExport::exportDoughnutChart( const Reference< chart2::XChartType >& xChartType )
@@ -2096,68 +2182,11 @@ void ChartExport::exportDoughnutChart( const Reference< chart2::XChartType >& xC
pFS->endElement( FSNS( XML_c, XML_doughnutChart ) );
}
-namespace {
-
-std::vector<Sequence<Reference<chart2::XDataSeries> > > splitDataSeriesByAxis(const Reference< chart2::XChartType >& xChartType)
-{
- std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitSeries;
- std::map<sal_Int32, size_t> aMapAxisToIndex;
-
- Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
- if(xDSCnt.is())
- {
- sal_Int32 nAxisIndexOfFirstSeries = -1;
- const Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries());
- for (const uno::Reference<chart2::XDataSeries>& xSeries : aSeriesSeq)
- {
- Reference<beans::XPropertySet> xPropSet(xSeries, uno::UNO_QUERY);
- if (!xPropSet.is())
- continue;
-
- sal_Int32 nAxisIndex = -1;
- 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())
- {
- aSplitSeries.emplace_back();
- 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;
-}
-
-}
-
void ChartExport::exportLineChart( const Reference< chart2::XChartType >& xChartType )
{
FSHelperPtr pFS = GetFS();
- std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
- for (auto & splitDataSeries : aSplitDataSeries)
+ const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
+ for (const auto& splitDataSeries : aSplitDataSeries)
{
if (!splitDataSeries.hasElements())
continue;
@@ -2245,7 +2274,7 @@ void ChartExport::exportRadarChart( const Reference< chart2::XChartType >& xChar
}
void ChartExport::exportScatterChartSeries( const Reference< chart2::XChartType >& xChartType,
- css::uno::Sequence<css::uno::Reference<chart2::XDataSeries>>* pSeries)
+ const css::uno::Sequence<css::uno::Reference<chart2::XDataSeries>>* pSeries)
{
FSHelperPtr pFS = GetFS();
pFS->startElement(FSNS(XML_c, XML_scatterChart));
@@ -2276,9 +2305,9 @@ void ChartExport::exportScatterChartSeries( const Reference< chart2::XChartType
void ChartExport::exportScatterChart( const Reference< chart2::XChartType >& xChartType )
{
- std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
+ const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
bool bExported = false;
- for (auto & splitDataSeries : aSplitDataSeries)
+ for (const auto& splitDataSeries : aSplitDataSeries)
{
if (!splitDataSeries.hasElements())
continue;
@@ -2293,24 +2322,29 @@ void ChartExport::exportScatterChart( const Reference< chart2::XChartType >& xCh
void ChartExport::exportStockChart( const Reference< chart2::XChartType >& xChartType )
{
FSHelperPtr pFS = GetFS();
- pFS->startElement(FSNS(XML_c, XML_stockChart));
+ const std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType);
+ for (const auto& splitDataSeries : aSplitDataSeries)
+ {
+ if (!splitDataSeries.hasElements())
+ continue;
- bool bPrimaryAxes = true;
- Reference< chart2::XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY );
- if(xDSCnt.is())
- exportCandleStickSeries( xDSCnt->getDataSeries(), bPrimaryAxes );
+ pFS->startElement(FSNS(XML_c, XML_stockChart));
- // export stock properties
- Reference< css::chart::XStatisticDisplay > xStockPropProvider( mxDiagram, uno::UNO_QUERY );
- if( xStockPropProvider.is())
- {
- exportHiLowLines();
- exportUpDownBars(xChartType);
- }
+ bool bPrimaryAxes = true;
+ exportCandleStickSeries(splitDataSeries, bPrimaryAxes);
- exportAxesId(bPrimaryAxes);
+ // export stock properties
+ Reference< css::chart::XStatisticDisplay > xStockPropProvider(mxDiagram, uno::UNO_QUERY);
+ if (xStockPropProvider.is())
+ {
+ exportHiLowLines();
+ exportUpDownBars(xChartType);
+ }
- pFS->endElement( FSNS( XML_c, XML_stockChart ) );
+ exportAxesId(bPrimaryAxes);
+
+ pFS->endElement(FSNS(XML_c, XML_stockChart));
+ }
}
void ChartExport::exportHiLowLines()
@@ -2417,13 +2451,13 @@ void ChartExport::exportVaryColors(const Reference<chart2::XChartType>& xChartTy
}
void ChartExport::exportSeries( const Reference<chart2::XChartType>& xChartType,
- Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes )
+ const Sequence<Reference<chart2::XDataSeries> >& rSeriesSeq, bool& rPrimaryAxes )
{
OUString aLabelRole = xChartType->getRoleOfSequenceForSeriesLabel();
OUString aChartType( xChartType->getChartType());
sal_Int32 eChartType = lcl_getChartType( aChartType );
- for( const auto& rSeries : std::as_const(rSeriesSeq) )
+ for( const auto& rSeries : rSeriesSeq )
{
// export series
Reference< chart2::data::XDataSource > xSource( rSeries, uno::UNO_QUERY );
More information about the Libreoffice-commits
mailing list