diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-03 22:11:02 +0300 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2019-05-17 11:20:15 +0200 |
commit | 0e4c542f7a862e681baf25f042bc3a928c14004f (patch) | |
tree | 56582ddb40671a22eaaa54e1ab3058dc553b9d5d /oox/source | |
parent | 644ca26af744aec1e66c8dd4199d1228e0f780be (diff) |
Use hasElements to check Sequence emptiness in [l-r]*
Similar to clang-tidy readability-container-size-empty
Change-Id: Idd67f332b04857a39df26bad1733aae21236f105
Reviewed-on: https://gerrit.libreoffice.org/71764
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/core/filterbase.cxx | 2 | ||||
-rw-r--r-- | oox/source/core/filterdetect.cxx | 2 | ||||
-rw-r--r-- | oox/source/core/xmlfilterbase.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/chart/chartspaceconverter.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/customshapeproperties.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 6 | ||||
-rw-r--r-- | oox/source/export/chartexport.cxx | 10 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 20 | ||||
-rw-r--r-- | oox/source/export/shapes.cxx | 2 | ||||
-rw-r--r-- | oox/source/helper/zipstorage.cxx | 2 | ||||
-rw-r--r-- | oox/source/ole/olestorage.cxx | 2 |
11 files changed, 27 insertions, 27 deletions
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index b79b0a569b69..ede7b7ac06c3 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -423,7 +423,7 @@ void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) { } - if (rArgs.getLength() >= 1) + if (rArgs.hasElements()) { Sequence<css::beans::PropertyValue> aSeq; rArgs[0] >>= aSeq; diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 59a4f605ab5c..c5ea4b385849 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -321,7 +321,7 @@ Reference< XInputStream > FilterDetect::extractUnencryptedPackage( MediaDescript comphelper::DocPasswordRequestType::MS, &aDefaultPasswords ); - if( aEncryptionData.getLength() == 0 ) + if( !aEncryptionData.hasElements() ) { rMediaDescriptor[ MediaDescriptor::PROP_ABORTED() ] <<= true; } diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 6e26fa86595a..54f8b9f6ca83 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -595,7 +595,7 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const util::DateTi static void writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const Sequence< OUString >& aItems ) { - if( aItems.getLength() == 0 ) + if( !aItems.hasElements() ) return; OUStringBuffer sRep; diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 2e2c8bc3885b..0a9a690031ae 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -84,13 +84,13 @@ static bool lcl_useWorkaroundForNoGapInOOXML( Reference< chart2::XChartDocument Reference< chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW ); Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems()); - if ( xCooSysSequence.getLength() == 0 ) + if ( !xCooSysSequence.hasElements() ) return false; Reference< chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[0], UNO_QUERY_THROW ); Sequence< Reference< chart2::XChartType > > xChartTypeSequence( xChartTypeContainer->getChartTypes() ); - if ( xChartTypeSequence.getLength() == 0 ) + if ( !xChartTypeSequence.hasElements() ) return false; const Reference<chart2::XChartType>& xCT = xChartTypeSequence[0]; diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 323831166f59..048fb4610709 100644 --- a/oox/source/drawingml/customshapeproperties.cxx +++ b/oox/source/drawingml/customshapeproperties.cxx @@ -203,7 +203,7 @@ void CustomShapeProperties::pushToPropSet( aAdjustmentVal.Name = adjustmentGuide.maName; aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal; } - } else if ( aAdjustmentSeq.getLength() > 0 ) { + } else if ( aAdjustmentSeq.hasElements() ) { EnhancedCustomShapeAdjustmentValue aAdjustmentVal; aAdjustmentVal.Value <<= adjustmentGuide.maFormula.toInt32(); aAdjustmentVal.State = PropertyState_DIRECT_VALUE; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 1003b66e386c..4656c96bc111 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1291,7 +1291,7 @@ Reference< XShape > const & Shape::createAndInsert( Sequence< PropertyValue > aCamera3DEffects = get3DProperties().getCameraAttributes(); Sequence< PropertyValue > aLightRig3DEffects = get3DProperties().getLightRigAttributes(); Sequence< PropertyValue > aShape3DEffects = get3DProperties().getShape3DAttributes( rGraphicHelper, nFillPhClr ); - if( aCamera3DEffects.getLength() > 0 || aLightRig3DEffects.getLength() > 0 || aShape3DEffects.getLength() > 0 ) + if( aCamera3DEffects.hasElements() || aLightRig3DEffects.hasElements() || aShape3DEffects.hasElements() ) { uno::Sequence<beans::PropertyValue> a3DEffectsGrabBag = comphelper::InitPropertySequence( { @@ -1660,8 +1660,8 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& { Reference< chart2::data::XDataReceiver > xDataRec( xChartDoc, UNO_QUERY ); Reference< chart2::data::XDataSource > xData( xDataRec->getUsedData(), UNO_QUERY ); - if( xData->getDataSequences().getLength() <= 0 || !xData->getDataSequences()[0]->getValues().is() || - xData->getDataSequences()[0]->getValues()->getData().getLength() <= 0 ) + if( !xData->getDataSequences().hasElements() || !xData->getDataSequences()[0]->getValues().is() || + !xData->getDataSequences()[0]->getValues()->getData().hasElements() ) { rFilter.useInternalChartDataTable( true ); rFilter.getChartConverter()->convertFromModel( rFilter, aModel, xChartDoc, xExternalPage, mxShape->getPosition(), mxShape->getSize() ); diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 6d4dc1efa1b3..95962aa1d656 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -1403,7 +1403,7 @@ void ChartExport::exportBarChart( const Reference< chart2::XChartType >& xChartT { uno::Sequence< sal_Int32 > aBarPositionSequence; mAny >>= aBarPositionSequence; - if( aBarPositionSequence.getLength() ) + if( aBarPositionSequence.hasElements() ) { sal_Int32 nGapWidth = aBarPositionSequence[0]; pFS->singleElement(FSNS(XML_c, XML_gapWidth), XML_val, OString::number(nGapWidth)); @@ -1441,7 +1441,7 @@ void ChartExport::exportBarChart( const Reference< chart2::XChartType >& xChartT { uno::Sequence< sal_Int32 > aBarPositionSequence; mAny >>= aBarPositionSequence; - if( aBarPositionSequence.getLength() ) + if( aBarPositionSequence.hasElements() ) { sal_Int32 nOverlap = aBarPositionSequence[0]; // Stacked/Percent Bar/Column chart Overlap-workaround @@ -1564,7 +1564,7 @@ void ChartExport::exportLineChart( const Reference< chart2::XChartType >& xChart std::vector<Sequence<Reference<chart2::XDataSeries> > > aSplitDataSeries = splitDataSeriesByAxis(xChartType); for (auto & splitDataSeries : aSplitDataSeries) { - if (splitDataSeries.getLength() == 0) + if (!splitDataSeries.hasElements()) continue; sal_Int32 nTypeId = XML_lineChart; @@ -1686,7 +1686,7 @@ void ChartExport::exportScatterChart( const Reference< chart2::XChartType >& xCh bool bExported = false; for (auto & splitDataSeries : aSplitDataSeries) { - if (splitDataSeries.getLength() == 0) + if (!splitDataSeries.hasElements()) continue; bExported = true; @@ -2953,7 +2953,7 @@ void writeLabelProperties( const FSHelperPtr& pFS, ChartExport* pChartExport, pFS->endElement(FSNS(XML_c, XML_spPr)); } - if (aCustomLabelFields.getLength() > 0) + if (aCustomLabelFields.hasElements()) writeCustomLabel(pFS, pChartExport, aCustomLabelFields); if (rLabelParam.mbExport) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 7a069945d571..78225dcc532a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -3235,7 +3235,7 @@ void DrawingML::WriteFill( const Reference< XPropertySet >& xPropSet ) void DrawingML::WriteStyleProperties( sal_Int32 nTokenId, const Sequence< PropertyValue >& aProperties ) { - if( aProperties.getLength() > 0 ) + if( aProperties.hasElements() ) { OUString sSchemeClr; sal_uInt32 nIdx = 0; @@ -3290,7 +3290,7 @@ void DrawingML::WriteShapeStyle( const Reference< XPropertySet >& xPropSet ) void DrawingML::WriteShapeEffect( const OUString& sName, const Sequence< PropertyValue >& aEffectProps ) { - if( aEffectProps.getLength() == 0 ) + if( !aEffectProps.hasElements() ) return; // assign the proper tag and enable bContainsColor if necessary @@ -3502,7 +3502,7 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet ) } } - if( aEffects.getLength() == 0 ) + if( !aEffects.hasElements() ) { bool bHasShadow = false; if( GetProperty( rXPropSet, "Shadow" ) ) @@ -3615,7 +3615,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) break; } } - if( aEffectProps.getLength() == 0 && aLightRigProps.getLength() == 0 && aShape3DProps.getLength() == 0 ) + if( !aEffectProps.hasElements() && !aLightRigProps.hasElements() && !aShape3DProps.hasElements() ) return; bool bCameraRotationPresent = false; @@ -3697,7 +3697,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) mpFS->startElementNS(XML_a, XML_scene3d); - if( aEffectProps.getLength() > 0 ) + if( aEffectProps.hasElements() ) { mpFS->startElementNS( XML_a, XML_camera, xCameraAttrList ); if( bCameraRotationPresent ) @@ -3712,7 +3712,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) mpFS->singleElementNS(XML_a, XML_camera, XML_prst, "orthographicFront"); } - if( aEffectProps.getLength() > 0 ) + if( aEffectProps.hasElements() ) { mpFS->startElementNS( XML_a, XML_lightRig, xLightAttrList ); if( bLightRigRotationPresent ) @@ -3729,7 +3729,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) mpFS->endElementNS( XML_a, XML_scene3d ); - if( aShape3DProps.getLength() == 0 ) + if( !aShape3DProps.hasElements() ) return; bool bBevelTPresent = false, bBevelBPresent = false; @@ -3771,7 +3771,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) { Sequence< PropertyValue > aBevelProps; aShape3DProps[i].Value >>= aBevelProps; - if ( aBevelProps.getLength() == 0 ) + if ( !aBevelProps.hasElements() ) continue; sax_fastparser::FastAttributeList *aBevelAttrList = nullptr; @@ -3818,7 +3818,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) { mpFS->singleElementNS( XML_a, XML_bevelB, xBevelBAttrList ); } - if( aExtrusionColorProps.getLength() > 0 ) + if( aExtrusionColorProps.hasElements() ) { OUString sSchemeClr; ::Color nColor; @@ -3844,7 +3844,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet ) mpFS->endElementNS( XML_a, XML_extrusionClr ); } - if( aContourColorProps.getLength() > 0 ) + if( aContourColorProps.hasElements() ) { OUString sSchemeClr; ::Color nColor; diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 3cb71aeacf8c..b36ebb26f67f 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -744,7 +744,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape ) else if ( rProp.Name == "Handles" ) { rProp.Value >>= aHandles; - if ( aHandles.getLength() ) + if ( aHandles.hasElements() ) bHasHandles = true; if( !bIsDefaultObject ) bPredefinedHandlesUsed = false; diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx index 0c455bc8948f..2dbf3cdf2700 100644 --- a/oox/source/helper/zipstorage.cxx +++ b/oox/source/helper/zipstorage.cxx @@ -114,7 +114,7 @@ void ZipStorage::implGetElementNames( ::std::vector< OUString >& orElementNames if( mxStorage.is() ) try { aNames = mxStorage->getElementNames(); - if( aNames.getLength() > 0 ) + if( aNames.hasElements() ) orElementNames.insert( orElementNames.end(), aNames.begin(), aNames.end() ); } catch (Exception const& e) diff --git a/oox/source/ole/olestorage.cxx b/oox/source/ole/olestorage.cxx index 92bdca21321a..c53f252554d9 100644 --- a/oox/source/ole/olestorage.cxx +++ b/oox/source/ole/olestorage.cxx @@ -287,7 +287,7 @@ void OleStorage::implGetElementNames( ::std::vector< OUString >& orElementNames if( mxStorage.is() ) try { aNames = mxStorage->getElementNames(); - if( aNames.getLength() > 0 ) + if( aNames.hasElements() ) orElementNames.insert( orElementNames.end(), aNames.begin(), aNames.end() ); } catch(const Exception& ) |