summaryrefslogtreecommitdiff
path: root/chart2/source/tools/DataSeriesHelper.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-29 16:45:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-30 11:14:30 +0000
commitefbbc141b0db77510b41b452bf3931fc3c9ecc7e (patch)
treefaec036400d2a63cb0a81bd14e0e4d564b895315 /chart2/source/tools/DataSeriesHelper.cxx
parent1c8d43d8a9062dbe2cff52b61414e8be6d3b646d (diff)
use more concrete types in chart2
Change-Id: Iaefad282d40c83f58758b41db9b14f6e95552354 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149742 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/tools/DataSeriesHelper.cxx')
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx70
1 files changed, 19 insertions, 51 deletions
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 883b72f2908d..de88c37ecc96 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -229,27 +229,6 @@ std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >
}
std::vector<uno::Reference<chart2::data::XLabeledDataSequence> >
-getAllDataSequences( const uno::Sequence<uno::Reference<chart2::XDataSeries> >& aSeries )
-{
- std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
-
- for( uno::Reference<chart2::XDataSeries> const & dataSeries : aSeries )
- {
- Reference< chart2::data::XDataSource > xSource( dataSeries, uno::UNO_QUERY );
- if( xSource.is())
- {
- const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
- for (const auto & i : aSeq)
- {
- aSeqVec.push_back(i);
- }
- }
- }
-
- return aSeqVec;
-}
-
-std::vector<uno::Reference<chart2::data::XLabeledDataSequence> >
getAllDataSequences( const std::vector<rtl::Reference<DataSeries> >& aSeries )
{
std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aSeqVec;
@@ -332,15 +311,14 @@ void setStackModeAtSeries(
}
}
-sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries )
+sal_Int32 getAttachedAxisIndex( const rtl::Reference< DataSeries > & xSeries )
{
sal_Int32 nRet = 0;
try
{
- Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
- if( xProp.is() )
+ if( xSeries.is() )
{
- xProp->getPropertyValue( "AttachedAxisIndex" ) >>= nRet;
+ xSeries->getPropertyValue( "AttachedAxisIndex" ) >>= nRet;
}
}
catch( const uno::Exception & )
@@ -351,7 +329,7 @@ sal_Int32 getAttachedAxisIndex( const Reference< chart2::XDataSeries > & xSeries
}
sal_Int32 getNumberFormatKeyFromAxis(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
const rtl::Reference< BaseCoordinateSystem > & xCorrespondingCoordinateSystem,
sal_Int32 nDimensionIndex,
sal_Int32 nAxisIndex /* = -1 */ )
@@ -375,14 +353,12 @@ sal_Int32 getNumberFormatKeyFromAxis(
}
rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries(
- const Reference< chart2::XDataSeries > & xSeries,
+ const rtl::Reference< DataSeries > & xSeries,
const rtl::Reference< Diagram > & xDiagram )
{
rtl::Reference< ::chart::BaseCoordinateSystem > xResult;
rtl::Reference< ::chart::ChartType > xDummy;
- rtl::Reference< DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
- assert(pSeries);
- lcl_getCooSysAndChartTypeOfSeries( pSeries, xDiagram, xResult, xDummy );
+ lcl_getCooSysAndChartTypeOfSeries( xSeries, xDiagram, xResult, xDummy );
return xResult;
}
@@ -418,14 +394,14 @@ void deleteSeries(
}
}
-void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties,
+void switchSymbolsOnOrOff( const rtl::Reference< DataSeries > & xSeries,
bool bSymbolsOn, sal_Int32 nSeriesIndex )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
chart2::Symbol aSymbProp;
- if( xSeriesProperties->getPropertyValue( "Symbol") >>= aSymbProp )
+ if( xSeries->getPropertyValue( "Symbol") >>= aSymbProp )
{
if( !bSymbolsOn )
aSymbProp.Style = chart2::SymbolStyle_NONE;
@@ -434,53 +410,45 @@ void switchSymbolsOnOrOff( const Reference< beans::XPropertySet > & xSeriesPrope
aSymbProp.Style = chart2::SymbolStyle_STANDARD;
aSymbProp.StandardSymbol = nSeriesIndex;
}
- xSeriesProperties->setPropertyValue( "Symbol", uno::Any( aSymbProp ));
+ xSeries->setPropertyValue( "Symbol", uno::Any( aSymbProp ));
}
//todo: check attributed data points
}
-void switchLinesOnOrOff( const Reference< beans::XPropertySet > & xSeriesProperties, bool bLinesOn )
+void switchLinesOnOrOff( const rtl::Reference< DataSeries > & xSeries, bool bLinesOn )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
if( bLinesOn )
{
// keep line-styles that are not NONE
drawing::LineStyle eLineStyle;
- if( (xSeriesProperties->getPropertyValue( "LineStyle") >>= eLineStyle ) &&
+ if( (xSeries->getPropertyValue( "LineStyle") >>= eLineStyle ) &&
eLineStyle == drawing::LineStyle_NONE )
{
- xSeriesProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ) );
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_SOLID ) );
}
}
else
- xSeriesProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ) );
+ xSeries->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE ) );
}
-void makeLinesThickOrThin( const Reference< beans::XPropertySet > & xSeriesProperties, bool bThick )
+void makeLinesThickOrThin( const rtl::Reference< ::chart::DataSeries > & xSeries, bool bThick )
{
- if( !xSeriesProperties.is() )
+ if( !xSeries )
return;
sal_Int32 nNewValue = bThick ? 80 : 0;
sal_Int32 nOldValue = 0;
- if( (xSeriesProperties->getPropertyValue( "LineWidth") >>= nOldValue ) &&
+ if( (xSeries->getPropertyValue( "LineWidth") >>= nOldValue ) &&
nOldValue != nNewValue )
{
if( !(bThick && nOldValue>0))
- xSeriesProperties->setPropertyValue( "LineWidth", uno::Any( nNewValue ) );
+ xSeries->setPropertyValue( "LineWidth", uno::Any( nNewValue ) );
}
}
-void setPropertyAlsoToAllAttributedDataPoints( const Reference< chart2::XDataSeries >& xSeries,
- const OUString& rPropertyName, const uno::Any& rPropertyValue )
-{
- rtl::Reference<DataSeries> pSeries = dynamic_cast<DataSeries*>(xSeries.get());
- assert(!xSeries || pSeries);
- setPropertyAlsoToAllAttributedDataPoints(pSeries, rPropertyName, rPropertyValue);
-}
-
void setPropertyAlsoToAllAttributedDataPoints( const rtl::Reference< ::chart::DataSeries >& xSeries,
const OUString& rPropertyName, const uno::Any& rPropertyValue )
{