Kaydet (Commit) 0e4c542f authored tarafından Arkadiy Illarionov's avatar Arkadiy Illarionov Kaydeden (comit) Michael Stahl

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: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 644ca26a
......@@ -171,8 +171,8 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales()
k = 0;
for (auto const& dict : aDics)
{
if (dict.aLocaleNames.getLength() > 0 &&
dict.aLocations.getLength() > 0)
if (dict.aLocaleNames.hasElements() &&
dict.aLocations.hasElements())
{
uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
sal_Int32 nLocales = aLocaleNames.getLength();
......@@ -218,7 +218,7 @@ sal_Bool SAL_CALL Hyphenator::hasLocale(const Locale& rLocale)
MutexGuard aGuard( GetLinguMutex() );
bool bRes = false;
if (!aSuppLocales.getLength())
if (!aSuppLocales.hasElements())
getLocales();
const Locale *pLocale = aSuppLocales.getConstArray();
......
......@@ -197,8 +197,8 @@ Sequence< Locale > SAL_CALL SpellChecker::getLocales()
m_DictItems.reserve(nDictSize);
for (auto const& dict : aDics)
{
if (dict.aLocaleNames.getLength() > 0 &&
dict.aLocations.getLength() > 0)
if (dict.aLocaleNames.hasElements() &&
dict.aLocations.hasElements())
{
uno::Sequence< OUString > aLocaleNames( dict.aLocaleNames );
......@@ -235,7 +235,7 @@ sal_Bool SAL_CALL SpellChecker::hasLocale(const Locale& rLocale)
MutexGuard aGuard( GetLinguMutex() );
bool bRes = false;
if (!m_aSuppLocales.getLength())
if (!m_aSuppLocales.hasElements())
getLocales();
for (auto const& suppLocale : m_aSuppLocales)
......
......@@ -175,8 +175,8 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales()
k = 0;
for (auto const& dict : aDics)
{
if (dict.aLocaleNames.getLength() > 0 &&
dict.aLocations.getLength() > 0)
if (dict.aLocaleNames.hasElements() &&
dict.aLocations.hasElements())
{
uno::Sequence< OUString > aLocaleNames(dict.aLocaleNames);
sal_Int32 nLocales = aLocaleNames.getLength();
......@@ -220,7 +220,7 @@ sal_Bool SAL_CALL Thesaurus::hasLocale(const Locale& rLocale)
MutexGuard aGuard( GetLinguMutex() );
bool bRes = false;
if (!aSuppLocales.getLength())
if (!aSuppLocales.hasElements())
getLocales();
sal_Int32 nLen = aSuppLocales.getLength();
for (sal_Int32 i = 0; i < nLen; ++i)
......@@ -344,7 +344,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (xTmpRes2.is())
{
Sequence<OUString>seq = xTmpRes2->getAlternatives();
if (seq.getLength() > 0)
if (seq.hasElements())
{
codeTerm = seq[0];
stem2 = 1;
......@@ -381,7 +381,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
if (seq.getLength() > 0)
if (seq.hasElements())
sTerm = seq[0];
}
}
......@@ -437,7 +437,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
if (seq.getLength() > 0)
if (seq.hasElements())
{
aRTerm = seq[0]; // XXX Use only the first stem
continue;
......@@ -454,7 +454,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
if (seq.getLength() > 0)
if (seq.hasElements())
{
aPTerm = aRTerm.copy(pos + 1);
aRTerm = aRTerm.copy(0, pos + 1) + seq[0];
......
......@@ -1093,7 +1093,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
uno::Any aTmp( xNA->getByName( pElementNames[i] ) );
if (aTmp >>= aImplNames)
{
if (aImplNames.getLength() > 0)
if (aImplNames.hasElements())
{
// only the first entry is used, there should be only one grammar checker per language
const OUString aImplName( aImplNames[0] );
......@@ -1149,7 +1149,7 @@ void GrammarCheckingIterator::SetServiceList(
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
OUString aImplName;
if (rSvcImplNames.getLength() > 0)
if (rSvcImplNames.hasElements())
aImplName = rSvcImplNames[0]; // there is only one grammar checker per language
if (!LinguIsUnspecified(nLanguage) && nLanguage != LANGUAGE_DONTKNOW)
......
......@@ -328,13 +328,13 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
sal_Int32 i = 0;
Reference< XHyphenator > xHyph;
if (pEntry->aSvcRefs.getLength() > 0)
if (pEntry->aSvcRefs.hasElements())
xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
......@@ -460,13 +460,13 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
sal_Int32 i = 0;
Reference< XHyphenator > xHyph;
if (pEntry->aSvcRefs.getLength() > 0)
if (pEntry->aSvcRefs.hasElements())
xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
......@@ -582,13 +582,13 @@ Reference< XPossibleHyphens > SAL_CALL
}
else
{
sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0;
sal_Int32 nLen = pEntry->aSvcImplNames.hasElements() ? 1 : 0;
DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen,
"lng : index out of range");
sal_Int32 i = 0;
Reference< XHyphenator > xHyph;
if (pEntry->aSvcRefs.getLength() > 0)
if (pEntry->aSvcRefs.hasElements())
xHyph = pEntry->aSvcRefs[0];
// try already instantiated service
......@@ -700,7 +700,7 @@ Sequence< OUString >
if (pEntry)
{
aRes = pEntry->aSvcImplNames;
if (aRes.getLength() > 0)
if (aRes.hasElements())
aRes.realloc(1);
}
......
......@@ -565,7 +565,7 @@ namespace
{
Sequence< OUString > aNames { rLastFoundList + "/" + rCfgLocaleStr };
Sequence< Any > aValues( rCfg.GetProperties( aNames ) );
if (aValues.getLength())
if (aValues.hasElements())
{
SAL_WARN_IF( aValues.getLength() != 1, "linguistic", "unexpected length of sequence" );
Sequence< OUString > aSvcImplNames;
......@@ -799,7 +799,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aSpellCheckerList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
......@@ -822,7 +822,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aGrammarCheckerList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
......@@ -848,7 +848,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aHyphenatorList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
......@@ -871,7 +871,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
pNames[0] = aThesaurusList + "/" + aKeyText;
aValues = /*aCfg.*/GetProperties( aNames );
uno::Sequence< OUString > aSvcImplNames;
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
LanguageType nLang = LANGUAGE_NONE;
......@@ -1677,7 +1677,7 @@ bool LngSvcMgr::SaveCfgSvcs( const OUString &rServiceName )
aLocales = getAvailableLocales( SN_THESAURUS );
}
if (pDsp && aLocales.getLength())
if (pDsp && aLocales.hasElements())
{
sal_Int32 nLen = aLocales.getLength();
const lang::Locale *pLocale = aLocales.getConstArray();
......@@ -1809,7 +1809,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
}
}
......@@ -1821,7 +1821,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
}
}
......@@ -1833,7 +1833,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
}
}
......@@ -1845,7 +1845,7 @@ uno::Sequence< OUString > SAL_CALL
{
pNames[0] = aNode + "/" + aCfgLocale;
aValues = /*aCfg.*/GetProperties( aNames );
if (aValues.getLength())
if (aValues.hasElements())
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
}
}
......
......@@ -321,7 +321,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (bTmpRes && 0 == rProperties.getLength())
if (bTmpRes && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
......@@ -380,7 +380,7 @@ bool SpellCheckerDispatcher::isValid_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (bTmpRes && 0 == rProperties.getLength())
if (bTmpRes && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
......@@ -486,7 +486,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (!xTmpRes.is() && 0 == rProperties.getLength())
if (!xTmpRes.is() && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
......@@ -565,7 +565,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (!xTmpRes.is() && 0 == rProperties.getLength())
if (!xTmpRes.is() && !rProperties.hasElements())
GetCache().AddWord( aChkWord, nLanguage );
}
}
......
......@@ -139,7 +139,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
{
const Reference< XThesaurus > *pRef = pEntry->aSvcRefs.getConstArray();
while (i <= pEntry->nLastTriedSvcIndex
&& aMeanings.getLength() == 0)
&& !aMeanings.hasElements())
{
if (pRef[i].is() && pRef[i]->hasLocale( rLocale ))
aMeanings = pRef[i]->queryMeanings( aChkWord, rLocale, rProperties );
......@@ -148,7 +148,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
}
// if still no result instantiate new services and try those
if (aMeanings.getLength() == 0
if (!aMeanings.hasElements()
&& pEntry->nLastTriedSvcIndex < nLen - 1)
{
const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray();
......@@ -161,7 +161,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
Sequence< Any > aArgs(1);
aArgs.getArray()[0] <<= GetPropSet();
while (i < nLen && aMeanings.getLength() == 0)
while (i < nLen && !aMeanings.hasElements())
{
// create specific service via it's implementation name
Reference< XThesaurus > xThes;
......@@ -186,7 +186,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
// if language is not supported by any of the services
// remove it from the list.
if (i == nLen && aMeanings.getLength() == 0)
if (i == nLen && !aMeanings.hasElements())
{
if (!SvcListHasLanguage( pEntry->aSvcRefs, rLocale ))
aSvcMap.erase( nLanguage );
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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];
......
......@@ -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;
......
......@@ -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() );
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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& )
......
......@@ -89,7 +89,7 @@ bool PackageEncryptionDatasEqual( const ::comphelper::SequenceAsHashMap& aHash1,
++aIter )
{
uno::Sequence< sal_Int8 > aKey1;
bResult = ( ( aIter->second >>= aKey1 ) && aKey1.getLength() );
bResult = ( ( aIter->second >>= aKey1 ) && aKey1.hasElements() );
if ( bResult )
{
uno::Sequence< sal_Int8 > aKey2 = aHash2.getUnpackedValueOrDefault( aIter->first, uno::Sequence< sal_Int8 >() );
......@@ -401,7 +401,7 @@ bool OWriteStream_Impl::IsEncrypted()
// That means that if it is intended to use common storage key
// it is already has no encryption but is marked to be stored
// encrypted and the key is empty.
if ( !bWasEncr && bToBeEncr && !aKey.getLength() )
if ( !bWasEncr && bToBeEncr && !aKey.hasElements() )
{
// the stream is intended to use common storage password
m_bUseCommonEncryption = true;
......@@ -926,7 +926,7 @@ void OWriteStream_Impl::Revert()
uno::Sequence< beans::PropertyValue > const & OWriteStream_Impl::GetStreamProperties()
{
if ( !m_aProps.getLength() )
if ( !m_aProps.hasElements() )
m_aProps = ReadPackageStreamProperties();
return m_aProps;
......@@ -1551,7 +1551,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora
if ( m_nRelInfoStatus == RELINFO_CHANGED )
{
if ( m_aNewRelInfo.getLength() )
if ( m_aNewRelInfo.hasElements() )
{
uno::Reference< io::XStream > xRelsStream =
xRelStorage->openStreamElement( aNewRelStreamName,
......
......@@ -5518,7 +5518,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL OStorage::openEncrypted
if ( aStreamPath.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aStreamPath, true ) )
throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
if ( !aEncryptionData.getLength() )
if ( !aEncryptionData.hasElements() )
throw lang::IllegalArgumentException( THROW_WHERE, uno::Reference< uno::XInterface >(), 3 );
if ( !( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE )
......
......@@ -143,7 +143,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::readBytes( Sequence< sal_Int8 >& rDa
while( nPendingBytes )
{
const Buffer &pBuffer = getNextBlock();
if( pBuffer.getLength() <= 0 )
if( !pBuffer.hasElements() )
{
rData.realloc( nAvailableSize - nPendingBytes );
return nAvailableSize - nPendingBytes;
......
......@@ -81,10 +81,10 @@ XUnbufferedStream::XUnbufferedStream(
if (mnZipSize < 0)
throw ZipIOException("The stream seems to be broken!");
bool bHaveEncryptData = rData.is() && rData->m_aInitVector.getLength() &&
((rData->m_aSalt.getLength() && rData->m_nIterationCount != 0)
bool bHaveEncryptData = rData.is() && rData->m_aInitVector.hasElements() &&
((rData->m_aSalt.hasElements() && rData->m_nIterationCount != 0)
||
rData->m_aKey.getLength());
rData->m_aKey.hasElements());
bool bMustDecrypt = nStreamMode == UNBUFF_STREAM_DATA && bHaveEncryptData && bIsEncrypted;
if ( bMustDecrypt )
......@@ -268,7 +268,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
if ( mnZipCurrent == mnZipEnd )
{
uno::Sequence< sal_Int8 > aSuffix = m_xCipherContext->finalizeCipherContextAndDispose();
if ( aSuffix.getLength() )
if ( aSuffix.hasElements() )
{
sal_Int32 nOldLen = maCompBuffer.getLength();
maCompBuffer.realloc( nOldLen + aSuffix.getLength() );
......
......@@ -397,7 +397,7 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const rtl::R
if ( !rData.is() )
throw ZipIOException("Encrypted stream without encryption data!" );
if ( !rData->m_aKey.getLength() )
if ( !rData->m_aKey.hasElements() )
throw packages::WrongPasswordException(THROW_WHERE );
uno::Reference< XSeekable > xSeek( xStream, UNO_QUERY );
......@@ -406,8 +406,8 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const rtl::R
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!" );
if ( rData->m_aDigest.getLength() )
OSL_ENSURE( rData->m_aDigest.hasElements(), "Can't detect password correctness without digest!" );
if ( rData->m_aDigest.hasElements() )
{
sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
if ( nSize > n_ConstDigestLength + 32 )
......@@ -446,7 +446,7 @@ void CheckSequence( const uno::Sequence< sal_Int8 >& aSequence )
bool ZipFile::StaticHasValidPassword( const uno::Reference< uno::XComponentContext >& rxContext, const Sequence< sal_Int8 > &aReadBuffer, const ::rtl::Reference< EncryptionData > &rData )
{
if ( !rData.is() || !rData->m_aKey.getLength() )
if ( !rData.is() || !rData->m_aKey.hasElements() )
return false;
bool bRet = false;
......@@ -466,7 +466,7 @@ bool ZipFile::StaticHasValidPassword( const uno::Reference< uno::XComponentConte
// it is no problem, actually this is why we read 32 additional bytes ( two of maximal possible encryption blocks )
}
if ( aDecryptBuffer2.getLength() )