diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2018-08-09 00:06:47 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2018-08-10 15:36:52 +0200 |
commit | 15035b98dc694bde4c4073fa75bdd2ce9d7e6670 (patch) | |
tree | 54627b70512c47e223837558674f88190735d959 /oox | |
parent | 7861689c420f38223b8d53dd6911728ea7f26395 (diff) |
tdf#96469 Export Data Point properties in Charts on DOCX/XLSX
If the color or other property of a datapoint in the chart
deviates from the dataseries property, this patch will write it
into a separate dPt tag and fixing the lost properies during
OOXML export.
Change-Id: I3d975675ac3691fcafe76de16e46851561eb2807
Reviewed-on: https://gerrit.libreoffice.org/58806
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Jenkins
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/chartexport.cxx | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 891bb9707e55..3a97ee186560 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -3285,6 +3285,57 @@ void ChartExport::exportDataPoints( } } } + + // Export Data Point Property in Charts even if the VaryColors is false + if( !bVaryColorsByPoint ) + { + ::std::set< sal_Int32 > aAttrPointSet; + ::std::copy( pPoints, pPoints + aDataPointSeq.getLength(), + ::std::inserter( aAttrPointSet, aAttrPointSet.begin())); + const ::std::set< sal_Int32 >::const_iterator aEndIt( aAttrPointSet.end()); + for( nElement = 0; nElement < nSeriesLength; ++nElement ) + { + uno::Reference< beans::XPropertySet > xPropSet; + if( aAttrPointSet.find( nElement ) != aEndIt ) + { + try + { + xPropSet = SchXMLSeriesHelper::createOldAPIDataPointPropertySet( + xSeries, nElement, getModel() ); + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION( "oox", "Exception caught during Export of data point" ); + } + } + + if( xPropSet.is() ) + { + FSHelperPtr pFS = GetFS(); + pFS->startElement( FSNS( XML_c, XML_dPt ), + FSEND ); + pFS->singleElement( FSNS( XML_c, XML_idx ), + XML_val, I32S(nElement), + FSEND ); + + switch( eChartType ) + { + case chart::TYPEID_BUBBLE: + case chart::TYPEID_HORBAR: + case chart::TYPEID_BAR: + { + pFS->singleElement(FSNS(XML_c, XML_invertIfNegative), + XML_val, "0", + FSEND); + } + break; + } + exportShapeProps( xPropSet ); + + pFS->endElement( FSNS( XML_c, XML_dPt ) ); + } + } + } } void ChartExport::exportAxesId(bool bPrimaryAxes) |