summaryrefslogtreecommitdiff
path: root/chart2/source/model
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-02-07 18:41:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-02-08 08:52:11 +0100
commitb314b5a0612c9dc7279039dae44a250d4d3ec6b1 (patch)
tree494aeabb2c9887ca3460b6110f7ba850c9664057 /chart2/source/model
parentd4d16e26a7deb5bfddc9736b4cc9e87c5f6704ee (diff)
use more concrete types in chart2, DataSeries
Change-Id: I80bc8961832a20c29b31f7618b9d2609f15ab3c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129642 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/model')
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx18
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx8
2 files changed, 10 insertions, 16 deletions
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index 126c902728b3..362706a68a66 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -58,7 +58,7 @@ namespace
{
void lcl_applyDefaultStyle(
- const Reference< XDataSeries > & xSeries,
+ const rtl::Reference< ::chart::DataSeries > & xSeries,
sal_Int32 nIndex,
const rtl::Reference< ::chart::Diagram > & xDiagram )
{
@@ -66,10 +66,9 @@ void lcl_applyDefaultStyle(
// setting color as hard attribute
if( xSeries.is() && xDiagram.is())
{
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
Reference< chart2::XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme());
- if( xSeriesProp.is() && xColorScheme.is() )
- xSeriesProp->setPropertyValue(
+ if( xColorScheme.is() )
+ xSeries->setPropertyValue(
"Color",
uno::Any( xColorScheme->getColorByIndex( nIndex )));
}
@@ -436,13 +435,8 @@ void ChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >& x
for( rtl::Reference< ChartType > const & xChartType : xCooSys->getChartTypes2() )
{
//iterate through all series in this chart type
- const uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xChartType->getDataSeries() );
- for( Reference< XDataSeries > const & xSeries : aSeriesList )
+ for( rtl::Reference< DataSeries > const & xSeries : xChartType->getDataSeries2() )
{
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
- if(!xSeries.is() || !xSeriesProp.is() )
- continue;
-
uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements(
xChartType, isSwapXAndY(), xSeries ) );
if(!aAvailablePlacements.hasElements())
@@ -450,10 +444,10 @@ void ChartTypeTemplate::resetStyles( const rtl::Reference< ::chart::Diagram >& x
sal_Int32 nDefaultPlacement = aAvailablePlacements[0];
- lcl_resetLabelPlacementIfDefault( xSeriesProp, nDefaultPlacement );
+ lcl_resetLabelPlacementIfDefault( xSeries, nDefaultPlacement );
uno::Sequence< sal_Int32 > aAttributedDataPointIndexList;
- if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
+ if( xSeries->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList )
for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;)
lcl_resetLabelPlacementIfDefault( xSeries->getDataPointByIndex(aAttributedDataPointIndexList[nN]), nDefaultPlacement );
}
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 460cd2a583c8..1f3bd9c9a538 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -206,10 +206,10 @@ void ColumnLineChartTypeTemplate::createChartTypes(
if( nNumberOfColumns > 0 )
{
- Sequence< Reference< XDataSeries > > aColumnSeq( nNumberOfColumns );
+ std::vector< rtl::Reference< DataSeries > > aColumnSeq( nNumberOfColumns );
std::copy( aFlatSeriesSeq.begin(),
aFlatSeriesSeq.begin() + nNumberOfColumns,
- aColumnSeq.getArray());
+ aColumnSeq.begin());
xCT->setDataSeries( aColumnSeq );
}
@@ -220,10 +220,10 @@ void ColumnLineChartTypeTemplate::createChartTypes(
if( nNumberOfLines > 0 )
{
- Sequence< Reference< XDataSeries > > aLineSeq( nNumberOfLines );
+ std::vector< rtl::Reference< DataSeries > > aLineSeq( nNumberOfLines );
std::copy( aFlatSeriesSeq.begin() + nNumberOfColumns,
aFlatSeriesSeq.end(),
- aLineSeq.getArray());
+ aLineSeq.begin());
xCT->setDataSeries( aLineSeq );
}
}