summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-05-01 00:53:03 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-02 09:53:48 +0200
commit855f52ead7fa361b6a73105d1f0086559a8ed5b6 (patch)
tree042fb792f2c64666ef5fa01436ccafd728860eca /xmloff
parent0c434b06a3792a6429fbe718a0231c48597c1ff5 (diff)
Use hasElements to check Sequence emptiness in [v-x]*
Similar to clang-tidy readability-container-size-empty Change-Id: I71e7af4ac3043d8d40922e99f8a4798f0993294c Reviewed-on: https://gerrit.libreoffice.org/71603 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLAxisContext.cxx4
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx6
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx14
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx2
-rw-r--r--xmloff/source/chart/SchXMLTableContext.cxx6
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx2
-rw-r--r--xmloff/source/core/xmlexp.cxx4
-rw-r--r--xmloff/source/draw/animationexport.cxx6
-rw-r--r--xmloff/source/draw/shapeexport.cxx4
-rw-r--r--xmloff/source/draw/ximpshap.cxx4
-rw-r--r--xmloff/source/forms/elementexport.cxx4
-rw-r--r--xmloff/source/meta/xmlmetae.cxx2
-rw-r--r--xmloff/source/style/XMLFontStylesContext.cxx4
-rw-r--r--xmloff/source/style/tabsthdl.cxx2
-rw-r--r--xmloff/source/style/xmlimppr.cxx2
-rw-r--r--xmloff/source/text/XMLRedlineExport.cxx2
-rw-r--r--xmloff/source/text/XMLSectionExport.cxx2
-rw-r--r--xmloff/source/text/txtflde.cxx2
-rw-r--r--xmloff/source/transform/Oasis2OOo.cxx2
19 files changed, 37 insertions, 37 deletions
diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx
index 29992bb8ca2e..f55877609937 100644
--- a/xmloff/source/chart/SchXMLAxisContext.cxx
+++ b/xmloff/source/chart/SchXMLAxisContext.cxx
@@ -529,7 +529,7 @@ void SchXMLAxisContext::CreateAxis()
if( xCooSysCnt.is() )
{
uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- if( aCooSysSeq.getLength() )
+ if( aCooSysSeq.hasElements() )
{
bool bSwapXandYAxis = false;
Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
@@ -732,7 +732,7 @@ void SchXMLAxisContext::CorrectAxisPositions( const Reference< chart2::XChartDoc
{
Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xNewDoc->getFirstDiagram(), uno::UNO_QUERY_THROW );
uno::Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
- if( aCooSysSeq.getLength() )
+ if( aCooSysSeq.hasElements() )
{
Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[0] );
if( xCooSys.is() )
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index b7f0a2ff8087..7c3d355f9c64 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -93,7 +93,7 @@ void lcl_MoveDataToCandleStickSeries(
{
uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLabeledSeq(
xDataSource->getDataSequences());
- if( aLabeledSeq.getLength())
+ if( aLabeledSeq.hasElements())
{
lcl_setRoleAtLabeledSequence( aLabeledSeq[0], rRole );
@@ -121,7 +121,7 @@ void lcl_setRoleAtFirstSequence(
if( xSource.is())
{
uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aSeq( xSource->getDataSequences());
- if( aSeq.getLength())
+ if( aSeq.hasElements())
lcl_setRoleAtLabeledSequence( aSeq[0], rRole );
}
}
@@ -156,7 +156,7 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen
for( sal_Int32 nJ=aCTSeq.getLength(); nJ-- && (nRemainingGroups > 1); )
{
uno::Reference< chart2::XDataSeriesContainer > xDSCnt( aCTSeq[nJ], uno::UNO_QUERY_THROW );
- if( xDSCnt->getDataSeries().getLength() == 0 )
+ if( !xDSCnt->getDataSeries().hasElements() )
{
// note: iterator stays valid as we have a local sequence
xCTCnt->removeChartType( aCTSeq[nJ] );
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 337864d809fb..6507cb91b926 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -665,7 +665,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& )
@@ -673,7 +673,7 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque
return true;
}
}
- return xDataSequence->getData().getLength();
+ return xDataSequence->getData().hasElements();
}
typedef vector< OUString > tStringVector;
@@ -1230,7 +1230,7 @@ void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >
}
//column-mapping or row-mapping
- if( maSequenceMapping.getLength() )
+ if( maSequenceMapping.hasElements() )
{
enum XMLTokenEnum eTransToken = ::xmloff::token::XML_ROW_MAPPING;
if( mbRowSourceColumns )
@@ -1633,7 +1633,7 @@ void SchXMLExportHelper_Impl::exportTable()
if( nC < nComplexCount )
{
const Sequence< uno::Any >& rComplexLabel = rComplexColumnDescriptions[nC];
- if( rComplexLabel.getLength()>0 )
+ if( rComplexLabel.hasElements() )
{
double fValue=0.0;
if( rComplexLabel[0] >>=fValue )
@@ -1688,7 +1688,7 @@ void SchXMLExportHelper_Impl::exportTable()
if( nC < nComplexCount )
{
const Sequence< uno::Any >& rComplexLabel = rComplexRowDescriptions[nC];
- if( rComplexLabel.getLength()>0 )
+ if( rComplexLabel.hasElements() )
{
double fValue=0.0;
if( rComplexLabel[0] >>=fValue )
@@ -1762,7 +1762,7 @@ Reference< chart2::XCoordinateSystem > lcl_getCooSys( const Reference< chart2::X
if(xCooSysCnt.is())
{
Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems() );
- if(aCooSysSeq.getLength()>0)
+ if(aCooSysSeq.hasElements())
xCooSys = aCooSysSeq[0];
}
return xCooSys;
@@ -2493,7 +2493,7 @@ namespace
}
else
{
- if( !aData.getLength() )
+ if( !aData.hasElements() )
aData = xDataSequence->getData();
OUString aString;
sal_Int32 nCount = aData.getLength();
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 57e4e5fe05a7..bc3219ee0115 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -454,7 +454,7 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries(
uno::UNO_QUERY );
if( xCurrentType.is())
{
- if( bPushLastChartType && aChartTypes.getLength())
+ if( bPushLastChartType && aChartTypes.hasElements())
{
sal_Int32 nIndex( aChartTypes.getLength() - 1 );
aChartTypes.realloc( aChartTypes.getLength() + 1 );
diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx
index 9dceca28faed..cb0423c92976 100644
--- a/xmloff/source/chart/SchXMLTableContext.cxx
+++ b/xmloff/source/chart/SchXMLTableContext.cxx
@@ -379,7 +379,7 @@ void SchXMLTableContext::EndElement()
void SchXMLTableContext::setRowPermutation( const uno::Sequence< sal_Int32 > & rPermutation )
{
maRowPermutation = rPermutation;
- mbHasRowPermutation = ( rPermutation.getLength() > 0 );
+ mbHasRowPermutation = rPermutation.hasElements();
if( mbHasRowPermutation && mbHasColumnPermutation )
{
@@ -391,7 +391,7 @@ void SchXMLTableContext::setRowPermutation( const uno::Sequence< sal_Int32 > & r
void SchXMLTableContext::setColumnPermutation( const uno::Sequence< sal_Int32 > & rPermutation )
{
maColumnPermutation = rPermutation;
- mbHasColumnPermutation = ( rPermutation.getLength() > 0 );
+ mbHasColumnPermutation = rPermutation.hasElements();
if( mbHasColumnPermutation && mbHasRowPermutation )
{
@@ -716,7 +716,7 @@ static void lcl_ApplyCellToComplexLabel( const SchXMLCell& rCell, Sequence< uno:
rComplexLabel.realloc(1);
rComplexLabel[0] <<= rCell.aString;
}
- else if( rCell.aComplexString.getLength() && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING )
+ else if( rCell.aComplexString.hasElements() && rCell.eType == SCH_CELL_TYPE_COMPLEX_STRING )
{
sal_Int32 nCount = rCell.aComplexString.getLength();
rComplexLabel.realloc( nCount );
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
index ea90734c99e0..2d0c48a2c4d0 100644
--- a/xmloff/source/core/RDFaExportHelper.cxx
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -121,7 +121,7 @@ RDFaExportHelper::AddRDFa(
uno::Sequence<rdf::Statement> const & rStatements( RDFaResult.First );
- if (0 == rStatements.getLength())
+ if (!rStatements.hasElements())
{
return; // no RDFa
}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 3f94c56586bc..c6746b3ea51b 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1100,7 +1100,7 @@ void SvXMLExport::ImplExportSettings()
for (auto const& settings : aSettings)
{
- if ( !settings.aSettings.getLength() )
+ if ( !settings.aSettings.hasElements() )
continue;
const OUString& sSettingsName( GetXMLToken( settings.eGroupName ) );
@@ -1787,7 +1787,7 @@ void SvXMLExport::GetViewSettingsAndViews(uno::Sequence<beans::PropertyValue>& r
uno::Sequence<beans::PropertyValue> aProps;
if( aAny >>= aProps )
{
- if( aProps.getLength() > 0 )
+ if( aProps.hasElements() )
{
bAdd = true;
break;
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx
index 84387f7624da..b721d22fce90 100644
--- a/xmloff/source/draw/animationexport.cxx
+++ b/xmloff/source/draw/animationexport.cxx
@@ -1140,7 +1140,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
}
Sequence< Any > aValues( xAnimate->getValues() );
- if( aValues.getLength() )
+ if( aValues.hasElements() )
{
aTemp <<= aValues;
convertValue( eAttributeName, sTmp, aTemp );
@@ -1173,7 +1173,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
if(nNodeType != AnimationNodeType::SET)
{
Sequence< double > aKeyTimes( xAnimate->getKeyTimes() );
- if( aKeyTimes.getLength() )
+ if( aKeyTimes.hasElements() )
{
sal_Int32 nLength = aKeyTimes.getLength();
const double* p = aKeyTimes.getConstArray();
@@ -1217,7 +1217,7 @@ void AnimationsExporterImpl::exportAnimate( const Reference< XAnimate >& xAnimat
}
Sequence< TimeFilterPair > aTimeFilter( xAnimate->getTimeFilter() );
- if( aTimeFilter.getLength() )
+ if( aTimeFilter.hasElements() )
{
sal_Int32 nLength = aTimeFilter.getLength();
const TimeFilterPair* p = aTimeFilter.getConstArray();
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index 58d2c2c811b5..c10213a3d7a7 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2053,7 +2053,7 @@ void XMLShapeExport::ImpExportLineShape(
if (pSourcePolyPolygon->getLength() > 0)
{
const drawing::PointSequence& rInnerSequence = (*pSourcePolyPolygon)[0];
- if (rInnerSequence.getLength() > 0)
+ if (rInnerSequence.hasElements())
{
const awt::Point& rPoint = rInnerSequence[0];
aStart = awt::Point(rPoint.X + aBasePosition.X, rPoint.Y + aBasePosition.Y);
@@ -4674,7 +4674,7 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
if ( rProp.Value >>= aPathTextFrames )
{
- if ( static_cast<sal_uInt16>(aPathTextFrames.getLength()) )
+ if ( aPathTextFrames.hasElements() )
{
sal_uInt16 k, nElements = static_cast<sal_uInt16>(aPathTextFrames.getLength());
for ( k = 0; k < nElements; k++ )
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 9f67a8225821..43ca70cb59ed 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2867,7 +2867,7 @@ void SdXMLAppletShapeContext::EndElement()
xProps->setPropertyValue("VisibleArea", Any(aRect) );
}
- if( maParams.getLength() )
+ if( maParams.hasElements() )
{
xProps->setPropertyValue("AppletCommands", Any(maParams) );
}
@@ -3083,7 +3083,7 @@ void SdXMLPluginShapeContext::EndElement()
if( !mbMedia )
{
// in case we have a plugin object
- if( maParams.getLength() )
+ if( maParams.hasElements() )
{
xProps->setPropertyValue("PluginCommands", Any(maParams) );
}
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 1642fcfd8247..20aebd730727 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -216,7 +216,7 @@ namespace xmloff
void OElementExport::exportEvents()
{
- if (!m_aEvents.getLength())
+ if (!m_aEvents.hasElements())
// nothing to do
return;
@@ -1232,7 +1232,7 @@ namespace xmloff
{
Sequence< OUString > aListSourceSequence;
aListSource >>= aListSourceSequence;
- if ( aListSourceSequence.getLength() )
+ if ( aListSourceSequence.hasElements() )
sListSource = aListSourceSequence[ 0 ];
}
return sListSource;
diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx
index 865d536b385c..9ee67dd9bf63 100644
--- a/xmloff/source/meta/xmlmetae.cxx
+++ b/xmloff/source/meta/xmlmetae.cxx
@@ -254,7 +254,7 @@ void SvXMLMetaExport::MExport_()
const uno::Sequence< beans::NamedValue > aDocStatistic =
mxDocProps->getDocumentStatistics();
// write document statistic if there is any provided
- if ( aDocStatistic.getLength() )
+ if ( aDocStatistic.hasElements() )
{
for ( sal_Int32 nInd = 0; nInd < aDocStatistic.getLength(); nInd++ )
{
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx
index b31bd380e0ee..b56460353b0b 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -277,7 +277,7 @@ const char EOT_FORMAT[] = "embedded-opentype";
void XMLFontStyleContextFontFaceUri::EndElement()
{
- if( ( linkPath.getLength() == 0 ) && ( maFontData.getLength() == 0 ) )
+ if( ( linkPath.getLength() == 0 ) && ( !maFontData.hasElements() ) )
{
SAL_WARN( "xmloff", "svg:font-face-uri tag with no link or base64 data; ignoring." );
return;
@@ -299,7 +299,7 @@ void XMLFontStyleContextFontFaceUri::EndElement()
SAL_WARN( "xmloff", "Unknown format of embedded font; assuming TTF." );
eot = false;
}
- if ( maFontData.getLength() == 0 )
+ if ( !maFontData.hasElements() )
handleEmbeddedFont( linkPath, eot );
else
handleEmbeddedFont( maFontData, eot );
diff --git a/xmloff/source/style/tabsthdl.cxx b/xmloff/source/style/tabsthdl.cxx
index 76dd4a70160b..c70e73f1dc9c 100644
--- a/xmloff/source/style/tabsthdl.cxx
+++ b/xmloff/source/style/tabsthdl.cxx
@@ -45,7 +45,7 @@ bool XMLTabStopPropHdl::equals( const uno::Any& r1, const uno::Any& r2 ) const
if( aSeq1.getLength() == aSeq2.getLength() )
{
bEqual = true;
- if( aSeq1.getLength() > 0 )
+ if( aSeq1.hasElements() )
{
const style::TabStop* pTabs1 = aSeq1.getConstArray();
const style::TabStop* pTabs2 = aSeq2.getConstArray();
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
index 1391f7937722..1790478651e3 100644
--- a/xmloff/source/style/xmlimppr.cxx
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -689,7 +689,7 @@ bool SvXMLImportPropertyMapper::FillTolerantMultiPropertySet_(
try
{
Sequence< SetPropertyTolerantFailed > aResults(rTolMultiPropSet->setPropertyValuesTolerant( aNames, aValues ));
- if (aResults.getLength() == 0)
+ if (!aResults.hasElements())
bSuccessful = true;
else
{
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 672eeb4f26f9..7e21cacd9a88 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -377,7 +377,7 @@ void XMLRedlineExport::ExportChangedRegion(
// if we actually got a hierarchical change, make element and
// process change info
- if (aSuccessorData.getLength() > 0)
+ if (aSuccessorData.hasElements())
{
// The only change that can be "undone" is an insertion -
// after all, you can't re-insert an deletion, but you can
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index 45b02e05c35d..ed9e9e2e6cae 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -396,7 +396,7 @@ void XMLSectionExport::ExportRegularSectionStart(
}
Sequence<sal_Int8> aPassword;
xPropSet->getPropertyValue("ProtectionKey") >>= aPassword;
- if (aPassword.getLength() > 0)
+ if (aPassword.hasElements())
{
OUStringBuffer aBuffer;
::comphelper::Base64::encode(aBuffer, aPassword);
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 8576b261d5ce..df43562daf23 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -2852,7 +2852,7 @@ bool XMLTextFieldExport::GetDependentFieldPropertySet(
aAny >>= aFields;
// any fields?
- if (aFields.getLength() > 0)
+ if (aFields.hasElements())
{
// get first one and return
Reference<XDependentTextField> xTField = aFields[0];
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index 966f2291ff2d..5a73c1e86f02 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -1552,7 +1552,7 @@ void XMLTrackedChangesOASISTContext_Impl::StartElement(
Any aAny = rPropSet->getPropertyValue( aPropName);
Sequence < sal_Int8 > aKey;
aAny >>= aKey;
- if( aKey.getLength() )
+ if( aKey.hasElements() )
{
OUStringBuffer aBuffer;
::comphelper::Base64::encode( aBuffer, aKey );