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/tools | |
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/tools')
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/CachedDataSequence.cxx | 6 | ||||
-rw-r--r-- | chart2/source/tools/ChartModelHelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/ConfigColorScheme.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/DataSeriesHelper.cxx | 8 | ||||
-rw-r--r-- | chart2/source/tools/DataSourceHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 16 | ||||
-rw-r--r-- | chart2/source/tools/ExplicitCategoriesProvider.cxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/InternalDataProvider.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/RegressionCurveHelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/tools/TitleHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/WrappedPropertySet.cxx | 6 |
12 files changed, 29 insertions, 29 deletions
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 0a1091a579c1..607bc41d187b 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -568,7 +568,7 @@ bool AxisHelper::isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, else { Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); - if( aSubGrids.getLength() ) + if( aSubGrids.hasElements() ) bRet = AxisHelper::isGridVisible( aSubGrids[0] ); } diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx index 1341075e9f91..78641ccb9011 100644 --- a/chart2/source/tools/CachedDataSequence.cxx +++ b/chart2/source/tools/CachedDataSequence.cxx @@ -346,17 +346,17 @@ void SAL_CALL CachedDataSequence::initialize(const uno::Sequence< uno::Any > & _ { ::comphelper::SequenceAsHashMap aMap(_aArguments); m_aNumericalSequence = aMap.getUnpackedValueOrDefault( "DataSequence" ,m_aNumericalSequence); - if ( m_aNumericalSequence.getLength() ) + if ( m_aNumericalSequence.hasElements() ) m_eCurrentDataType = NUMERICAL; else { m_aTextualSequence = aMap.getUnpackedValueOrDefault( "DataSequence" ,m_aTextualSequence); - if ( m_aTextualSequence.getLength() ) + if ( m_aTextualSequence.hasElements() ) m_eCurrentDataType = TEXTUAL; else { m_aMixedSequence = aMap.getUnpackedValueOrDefault( "DataSequence" ,m_aMixedSequence); - if ( m_aMixedSequence.getLength() ) + if ( m_aMixedSequence.hasElements() ) m_eCurrentDataType = MIXED; } } diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index 8140adf1477b..6d59b6831911 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -110,7 +110,7 @@ uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( if( xCooSysCnt.is() ) { uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); - if( aCooSysSeq.getLength() ) + if( aCooSysSeq.hasElements() ) XCooSys = aCooSysSeq[0]; } return XCooSys; @@ -123,7 +123,7 @@ uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( if( xCooSysCnt.is() ) { uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() ); - if( aCooSysSeq.getLength() ) + if( aCooSysSeq.hasElements() ) XCooSys = aCooSysSeq[0]; } return XCooSys; diff --git a/chart2/source/tools/ConfigColorScheme.cxx b/chart2/source/tools/ConfigColorScheme.cxx index 84cf07235ddf..c833a311c056 100644 --- a/chart2/source/tools/ConfigColorScheme.cxx +++ b/chart2/source/tools/ConfigColorScheme.cxx @@ -93,7 +93,7 @@ uno::Any ChartConfigItem::getProperty( const OUString & aPropertyName ) { Sequence< uno::Any > aValues( GetProperties( Sequence< OUString >( &aPropertyName, 1 ))); - if( ! aValues.getLength()) + if( ! aValues.hasElements()) return uno::Any(); return aValues[0]; } diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx index 480c6dafa596..ad60f8914c54 100644 --- a/chart2/source/tools/DataSeriesHelper.cxx +++ b/chart2/source/tools/DataSeriesHelper.cxx @@ -334,7 +334,7 @@ OUString getLabelForLabeledDataSequence( chart2::data::LabelOrigin_SHORT_SIDE ) ); // no labels returned is interpreted as: auto-generation not // supported by sequence - if( aLabels.getLength() ) + if( aLabels.hasElements() ) aResult=aLabels[0]; else { @@ -645,7 +645,7 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque try { xProp->getPropertyValue( "HiddenValues" ) >>= aHiddenValues; - if( !aHiddenValues.getLength() ) + if( !aHiddenValues.hasElements() ) return true; } catch( const uno::Exception& ) @@ -653,7 +653,7 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque return true; } } - return xDataSequence->getData().getLength(); + return xDataSequence->getData().hasElements(); } } @@ -689,7 +689,7 @@ sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nIndex, const Refere { Sequence<sal_Int32> aHiddenIndicesSeq; xProp->getPropertyValue( "HiddenValues" ) >>= aHiddenIndicesSeq; - if( aHiddenIndicesSeq.getLength() ) + if( aHiddenIndicesSeq.hasElements() ) { auto aHiddenIndices( comphelper::sequenceToContainer<std::vector< sal_Int32 >>( aHiddenIndicesSeq ) ); std::sort( aHiddenIndices.begin(), aHiddenIndices.end() ); diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index 0631bd1f47b0..4b124aea28a4 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -182,7 +182,7 @@ uno::Sequence< beans::PropertyValue > DataSourceHelper::createArguments( beans::PropertyValue( "CellRangeRepresentation" , -1, uno::Any( rRangeRepresentation ) , beans::PropertyState_DIRECT_VALUE ); - if( rSequenceMapping.getLength() ) + if( rSequenceMapping.hasElements() ) { aArguments.realloc( aArguments.getLength() + 1 ); aArguments[aArguments.getLength() - 1] = diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index f7249ceabf54..7720089ecbaa 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -279,7 +279,7 @@ void DiagramHelper::setStackMode( if( !xChartTypeContainer.is() ) continue; uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() ); - if (!aChartTypeList.getLength()) + if (!aChartTypeList.hasElements()) continue; uno::Reference< XChartType > xChartType( aChartTypeList[0] ); @@ -939,7 +939,7 @@ static void lcl_generateAutomaticCategoriesFromChartType( if( !xValueSeq.is() ) continue; rRet = xValueSeq->generateLabel( chart2::data::LabelOrigin_LONG_SIDE ); - if( rRet.getLength() ) + if( rRet.hasElements() ) return; } } @@ -956,7 +956,7 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const for( sal_Int32 nN=0; nN<aChartTypes.getLength(); nN++ ) { lcl_generateAutomaticCategoriesFromChartType( aRet, aChartTypes[nN] ); - if( aRet.getLength() ) + if( aRet.hasElements() ) return aRet; } } @@ -1036,7 +1036,7 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c //set a date format to the axis const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, rLocaleDataWrapper.getLanguageTag().getLocale(), true/*bCreate*/ ); - if( aKeySeq.getLength() ) + if( aKeySeq.hasElements() ) { xAxisProps->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any(aKeySeq[0])); } @@ -1140,7 +1140,7 @@ sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberForm { Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, rLanguageTag.getLocale(), true/*bCreate */); - if( aKeySeq.getLength() ) + if( aKeySeq.hasElements() ) { nRet = aKeySeq[0]; } @@ -1186,7 +1186,7 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF { Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT, rLanguageTag.getLocale(), true/*bCreate*/ ); - if( aKeySeq.getLength() ) + if( aKeySeq.hasElements() ) { // This *assumes* the sequence is sorted as in // NfIndexTableOffset and the first format is the integer 0% @@ -1385,7 +1385,7 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( if( xOtherDataSeriesContainer.is() ) { uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() ); - if( 0 < aOtherSeriesList.getLength() ) + if( aOtherSeriesList.hasElements() ) { uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[0] ); aOtherSeriesList[0] = xGivenDataSeries; @@ -1558,7 +1558,7 @@ sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( } //otherwise use the first supported one - if( aAvailableMissingValueTreatments.getLength() ) + if( aAvailableMissingValueTreatments.hasElements() ) { nResult = aAvailableMissingValueTreatments[0]; return nResult; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 37d59ea2e500..b6652e25f11d 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -112,7 +112,7 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2: } } } - if( !m_aSplitCategoriesList.getLength() ) + if( !m_aSplitCategoriesList.hasElements() ) { m_aSplitCategoriesList.realloc(1); m_aSplitCategoriesList[0]=m_xOriginalCategories; @@ -506,7 +506,7 @@ Sequence< OUString > const & ExplicitCategoriesProvider::getSimpleCategories() SplitCategoriesProvider_ForLabeledDataSequences( m_aSplitCategoriesList, mrModel ), m_aComplexCats ); } } - if(!m_aExplicitCategories.getLength()) + if(!m_aExplicitCategories.hasElements()) m_aExplicitCategories = DiagramHelper::generateAutomaticCategoriesFromCooSys( m_xCooSysModel ); m_bIsExplicitCategoriesInited = true; } diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 9fdd59d66fbb..86c163e02c4e 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -915,7 +915,7 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation aData = m_aInternalData.getColumnValues(nIndex); else aData = m_aInternalData.getRowValues(nIndex); - if( aData.getLength() ) + if( aData.hasElements() ) { aResult.realloc( aData.getLength()); transform( aData.begin(), aData.end(), diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index 475069bacdd9..5d3d41a0a0f0 100644 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -217,8 +217,8 @@ void RegressionCurveHelper::initializeCurveCalculator( } if( bXValuesFound && bYValuesFound && - aXValues.getLength() > 0 && - aYValues.getLength() > 0 ) + aXValues.hasElements() && + aYValues.hasElements() ) xOutCurveCalculator->recalculateRegression( aXValues, aYValues ); } diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx index a388d5e74677..c6b95d8c238a 100644 --- a/chart2/source/tools/TitleHelper.cxx +++ b/chart2/source/tools/TitleHelper.cxx @@ -354,7 +354,7 @@ void TitleHelper::setCompleteString( const OUString& rNewText uno::Sequence< uno::Reference< XFormattedString > > aNewStringList(1); uno::Sequence< uno::Reference< XFormattedString > > aOldStringList = xTitle->getText(); - if( aOldStringList.getLength() ) + if( aOldStringList.hasElements() ) { aNewStringList[0].set( aOldStringList[0] ); aNewStringList[0]->setString( aNewText ); diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx index 75bb8b68594f..959fe5ef5d70 100644 --- a/chart2/source/tools/WrappedPropertySet.cxx +++ b/chart2/source/tools/WrappedPropertySet.cxx @@ -234,7 +234,7 @@ void SAL_CALL WrappedPropertySet::setPropertyValues( const Sequence< OUString >& Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyValues( const Sequence< OUString >& rNameSeq ) { Sequence< Any > aRetSeq; - if( rNameSeq.getLength() ) + if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) @@ -306,7 +306,7 @@ const WrappedProperty* WrappedPropertySet::getWrappedProperty( sal_Int32 nHandle Sequence< beans::PropertyState > SAL_CALL WrappedPropertySet::getPropertyStates( const Sequence< OUString >& rNameSeq ) { Sequence< beans::PropertyState > aRetSeq; - if( rNameSeq.getLength() ) + if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) @@ -366,7 +366,7 @@ void SAL_CALL WrappedPropertySet::setPropertiesToDefault( const Sequence< OUStri Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence< OUString >& rNameSeq ) { Sequence< Any > aRetSeq; - if( rNameSeq.getLength() ) + if( rNameSeq.hasElements() ) { aRetSeq.realloc( rNameSeq.getLength() ); for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) |