diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-04 23:16:48 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-10 10:55:57 +0200 |
commit | 1eb8859813ff43b3753dcbab9e3e0bdfe7d72edb (patch) | |
tree | 4e04ab9584a5ef874faf8141c962158c32448d35 /chart2/source/model/template | |
parent | ec905d131374f0860bac77c52873eed984b1966f (diff) |
Use hasElements to check Sequence emptiness in chart2..connectivity
Similar to clang-tidy readability-container-size-empty
Change-Id: I41824e8a4ef38d6a35a0ac4421cffcbcd17308e1
Reviewed-on: https://gerrit.libreoffice.org/71802
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/model/template')
6 files changed, 21 insertions, 21 deletions
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index e20d23494f63..c3710e45d7d4 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -84,7 +84,7 @@ void lcl_ensureCorrectLabelPlacement( const Reference< beans::XPropertySet >& xP { uno::Any aNewValue; //otherwise use the first supported one - if( rAvailablePlacements.getLength() ) + if( rAvailablePlacements.hasElements() ) aNewValue <<=rAvailablePlacements[0]; xProp->setPropertyValue( "LabelPlacement", aNewValue ); } @@ -110,7 +110,7 @@ void lcl_ensureCorrectMissingValueTreatment( const Reference< chart2::XDiagram > uno::Sequence < sal_Int32 > aAvailableMissingValueTreatment( ::chart::ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ) ); - if( aAvailableMissingValueTreatment.getLength() ) + if( aAvailableMissingValueTreatment.hasElements() ) xDiaProp->setPropertyValue( "MissingValueTreatment", uno::Any( aAvailableMissingValueTreatment[0] ) ); else xDiaProp->setPropertyValue( "MissingValueTreatment", uno::Any() ); @@ -321,7 +321,7 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate( xCooSysCnt->getCoordinateSystems()); // need to have at least one coordinate system - bResult = (aCooSysSeq.getLength() > 0); + bResult = aCooSysSeq.hasElements(); if( bResult ) { Sequence< Reference< XChartType > > aFormerlyUsedChartTypes; @@ -488,7 +488,7 @@ void SAL_CALL ChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram uno::Sequence < sal_Int32 > aAvailablePlacements( ChartTypeHelper::getSupportedLabelPlacements( xChartType, isSwapXAndY(), xSeries ) ); - if(!aAvailablePlacements.getLength()) + if(!aAvailablePlacements.hasElements()) continue; sal_Int32 nDefaultPlacement = aAvailablePlacements[0]; @@ -555,7 +555,7 @@ void ChartTypeTemplate::createCoordinateSystems( Sequence< Reference< XCoordinateSystem > > aCoordinateSystems( xOutCooSysCnt->getCoordinateSystems()); - if( aCoordinateSystems.getLength()) + if( aCoordinateSystems.hasElements()) { bool bOk = true; for( sal_Int32 i=0; bOk && i<aCoordinateSystems.getLength(); ++i ) @@ -568,7 +568,7 @@ void ChartTypeTemplate::createCoordinateSystems( } //copy as much info from former coordinate system as possible: - if( aCoordinateSystems.getLength() ) + if( aCoordinateSystems.hasElements() ) { Reference< XCoordinateSystem > xOldCooSys( aCoordinateSystems[0] ); sal_Int32 nMaxDimensionCount = std::min( xCooSys->getDimension(), xOldCooSys->getDimension() ); @@ -679,7 +679,7 @@ void ChartTypeTemplate::createAxes( const Sequence< Reference< XCoordinateSystem > > & rCoordSys ) { //create missing axes - if( rCoordSys.getLength() > 0 ) + if( rCoordSys.hasElements() ) { Reference< XCoordinateSystem > xCooSys( rCoordSys[0] ); if(!xCooSys.is()) @@ -713,7 +713,7 @@ void ChartTypeTemplate::adaptAxes( { //adapt properties of existing axes and remove superfluous axes - if( rCoordSys.getLength() > 0 ) + if( rCoordSys.hasElements() ) { for( sal_Int32 nCooSysIdx=0; nCooSysIdx < rCoordSys.getLength(); ++nCooSysIdx ) { @@ -789,7 +789,7 @@ void ChartTypeTemplate::createChartTypes( const Sequence< Reference< XCoordinateSystem > > & rCoordSys, const Sequence< Reference< XChartType > >& aOldChartTypesSeq ) { - if( rCoordSys.getLength() == 0 || + if( ! rCoordSys.hasElements() || ! rCoordSys[0].is() ) return; @@ -797,7 +797,7 @@ void ChartTypeTemplate::createChartTypes( { sal_Int32 nCooSysIdx=0; Reference< XChartType > xCT; - if( aSeriesSeq.getLength() == 0 ) + if( !aSeriesSeq.hasElements() ) { // we need a new chart type xCT.set( getChartTypeForNewSeries( aOldChartTypesSeq )); @@ -817,7 +817,7 @@ void ChartTypeTemplate::createChartTypes( xCT.set( getChartTypeForNewSeries( aOldChartTypesSeq )); Reference< XChartTypeContainer > xCTCnt( rCoordSys[nCooSysIdx], uno::UNO_QUERY_THROW ); Sequence< Reference< XChartType > > aCTSeq( xCTCnt->getChartTypes()); - if( aCTSeq.getLength()) + if( aCTSeq.hasElements()) { aCTSeq[0] = xCT; xCTCnt->setChartTypes( aCTSeq ); diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx index da606f6ce424..8b357a852e8b 100644 --- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx +++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx @@ -161,7 +161,7 @@ void ColumnLineChartTypeTemplate::createChartTypes( const Sequence< Reference< XCoordinateSystem > > & rCoordSys, const Sequence< Reference< XChartType > >& aOldChartTypesSeq ) { - if( rCoordSys.getLength() == 0 || + if( ! rCoordSys.hasElements() || ! rCoordSys[0].is() ) return; diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx index a0b1d9641f2f..e90b2f083ace 100644 --- a/chart2/source/model/template/DataInterpreter.cxx +++ b/chart2/source/model/template/DataInterpreter.cxx @@ -353,7 +353,7 @@ bool DataInterpreter::HasCategories( { bool bHasCategories = false; - if( rArguments.getLength() > 0 ) + if( rArguments.hasElements() ) GetProperty( rArguments, "HasCategories" ) >>= bHasCategories; for( sal_Int32 nLSeqIdx=0; ! bHasCategories && nLSeqIdx<rData.getLength(); ++nLSeqIdx ) @@ -365,7 +365,7 @@ bool DataInterpreter::HasCategories( bool DataInterpreter::UseCategoriesAsX( const Sequence< beans::PropertyValue > & rArguments ) { bool bUseCategoriesAsX = true; - if( rArguments.getLength() > 0 ) + if( rArguments.hasElements() ) GetProperty( rArguments, "UseCategoriesAsX" ) >>= bUseCategoriesAsX; return bUseCategoriesAsX; } diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 25b97c2a3a90..56acc536f39e 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -261,7 +261,7 @@ void PieChartTypeTemplate::createChartTypes( const Sequence< Reference< chart2::XCoordinateSystem > > & rCoordSys, const Sequence< Reference< chart2::XChartType > >& /* aOldChartTypesSeq */ ) { - if( rCoordSys.getLength() == 0 || + if( ! rCoordSys.hasElements() || ! rCoordSys[0].is() ) return; @@ -281,7 +281,7 @@ void PieChartTypeTemplate::createChartTypes( Reference< chart2::XChartTypeContainer > xCTCnt( rCoordSys[0], uno::UNO_QUERY_THROW ); xCTCnt->setChartTypes( Sequence< Reference< chart2::XChartType > >( &xCT, 1 )); - if( aSeriesSeq.getLength() > 0 ) + if( aSeriesSeq.hasElements() ) { Reference< chart2::XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW ); Sequence< Reference< chart2::XDataSeries > > aFlatSeriesSeq( FlattenSequence( aSeriesSeq )); diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index 8b4f6552b1c4..807cc6dd7dfd 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -303,7 +303,7 @@ void StockChartTypeTemplate::createChartTypes( const Sequence< Reference< XCoordinateSystem > > & rCoordSys, const Sequence< Reference< XChartType > >& /* aOldChartTypesSeq */ ) { - if( rCoordSys.getLength() < 1 ) + if( !rCoordSys.hasElements() ) return; try @@ -333,7 +333,7 @@ void StockChartTypeTemplate::createChartTypes( aChartTypeVec.push_back( xCT ); if( aSeriesSeq.getLength() > nSeriesIndex && - aSeriesSeq[nSeriesIndex].getLength() > 0 ) + aSeriesSeq[nSeriesIndex].hasElements() ) { Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW ); xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] ); @@ -355,7 +355,7 @@ void StockChartTypeTemplate::createChartTypes( } if( aSeriesSeq.getLength() > nSeriesIndex && - aSeriesSeq[ nSeriesIndex ].getLength() > 0 ) + aSeriesSeq[ nSeriesIndex ].hasElements() ) { Reference< XDataSeriesContainer > xDSCnt( xCT, uno::UNO_QUERY_THROW ); xDSCnt->setDataSeries( aSeriesSeq[ nSeriesIndex ] ); @@ -364,7 +364,7 @@ void StockChartTypeTemplate::createChartTypes( // Lines (remaining series) if( aSeriesSeq.getLength() > nSeriesIndex && - aSeriesSeq[ nSeriesIndex ].getLength() > 0 ) + aSeriesSeq[ nSeriesIndex ].hasElements() ) { xCT.set( xFact->createInstance( diff --git a/chart2/source/model/template/StockDataInterpreter.cxx b/chart2/source/model/template/StockDataInterpreter.cxx index cb36912c67bd..d2ad7b296604 100644 --- a/chart2/source/model/template/StockDataInterpreter.cxx +++ b/chart2/source/model/template/StockDataInterpreter.cxx @@ -283,7 +283,7 @@ sal_Bool SAL_CALL StockDataInterpreter::isDataCompatible( { OSL_ASSERT( aInterpretedData.Series.getLength() > (bHasVolume ? 1 : 0)); Sequence< Reference< XDataSeries > > aSeries( aInterpretedData.Series[(bHasVolume ? 1 : 0)] ); - if(!aSeries.getLength()) + if(!aSeries.hasElements()) return false; for( sal_Int32 i=0; i<aSeries.getLength(); ++i ) { |