summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-05-02 17:53:27 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-04 13:57:07 +0200
commit2ddc66e6981a7d819cd6196a7ccbc811ca213be2 (patch)
treeab991ee652a9121ac18213f84d0df7855a2f2e29 /sw/source/filter
parentdec6bb217dd3ae98bee8e48fab9f8e26b7645b2b (diff)
Use hasElements to check Sequence emptiness in sw
Similar to clang-tidy readability-container-size-empty Change-Id: If44f20a7aa678915e32d12101e1af71476f4b590 Reviewed-on: https://gerrit.libreoffice.org/71679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/docxexport.cxx2
-rw-r--r--sw/source/filter/ww8/docxtablestyleexport.cxx2
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx4
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx3
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx6
-rw-r--r--sw/source/filter/ww8/ww8par.cxx8
-rw-r--r--sw/source/filter/xml/swxml.cxx4
-rw-r--r--sw/source/filter/xml/wrtxml.cxx2
9 files changed, 16 insertions, 17 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 509fe1071669..bc20d072a38c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4338,7 +4338,7 @@ void DocxAttributeOutput::LatentStyles()
break;
}
}
- if (!aLatentStyles.getLength())
+ if (!aLatentStyles.hasElements())
return;
// Extract default attributes first.
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 27f721b9b53e..75a28e020a91 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1096,7 +1096,7 @@ void DocxExport::WriteSettings()
uno::Sequence< beans::PropertyValue > rAttributeList;
propList[i].Value >>= rAttributeList;
- if (rAttributeList.getLength())
+ if (rAttributeList.hasElements())
{
sax_fastparser::FastAttributeList* pAttributeList = sax_fastparser::FastSerializerHelper::createAttrList();
for (sal_Int32 j = 0; j < rAttributeList.getLength(); ++j)
diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx
index cf6ee28cef43..e797f85818a3 100644
--- a/sw/source/filter/ww8/docxtablestyleexport.cxx
+++ b/sw/source/filter/ww8/docxtablestyleexport.cxx
@@ -142,7 +142,7 @@ void DocxTableStyleExport::TableStyles(sal_Int32 nCountStylesToWrite)
break;
}
}
- if (!aTableStyles.getLength())
+ if (!aTableStyles.hasElements())
return;
if (nCountStylesToWrite > aTableStyles.getLength())
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index de0098a07fc4..6bc5b11a8e21 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2105,7 +2105,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX);
xPropSet->getPropertyValue("DefaultSelection") >>= aIntSeq;
- if (aIntSeq.getLength())
+ if (aIntSeq.hasElements())
{
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFDEFRES);
// a dropdown list can have only one 'selected item by default'
@@ -2113,7 +2113,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
}
xPropSet->getPropertyValue("SelectedItems") >>= aIntSeq;
- if (aIntSeq.getLength())
+ if (aIntSeq.hasElements())
{
m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFRES);
// a dropdown list can have only one 'currently selected item'
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index feacf1de6f9b..7155136cec52 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -391,8 +391,7 @@ void WW8Export::DoComboBox(uno::Reference<beans::XPropertySet> const & xPropSet)
OUString sSelected;
uno::Sequence<OUString> aListItems;
xPropSet->getPropertyValue("StringItemList") >>= aListItems;
- sal_Int32 nStringsCnt = aListItems.getLength();
- if (nStringsCnt)
+ if (aListItems.hasElements())
{
uno::Any aTmp = xPropSet->getPropertyValue("DefaultText");
auto pStr = o3tl::tryAccess<OUString>(aTmp);
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 1ccca8f8eb78..6108764e3353 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3248,7 +3248,7 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec
aEncryptionData.realloc( 0 );
}
- if ( !aEncryptionData.getLength() )
+ if ( !aEncryptionData.hasElements() )
{
// try to generate the encryption data based on password
const SfxStringItem* pPasswordItem = SfxItemSet::GetItem<SfxStringItem>(mpMedium->GetItemSet(), SID_PASSWORD, false);
@@ -3275,12 +3275,12 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec
}
}
- if ( aEncryptionData.getLength() )
+ if ( aEncryptionData.hasElements() )
mpMedium->GetItemSet()->ClearItem( SID_PASSWORD );
}
// nonempty encryption data means here that the codec was successfully initialized
- return ( aEncryptionData.getLength() != 0 );
+ return aEncryptionData.hasElements();
}
ErrCode WW8Export::ExportDocument_Impl()
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index e74e05ebb01f..cc200e3353e3 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5567,7 +5567,7 @@ namespace
if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) )
aEncryptionData.realloc( 0 );
- if ( !aEncryptionData.getLength() )
+ if ( !aEncryptionData.hasElements() )
{
OUString sUniPassword = QueryPasswordForMedium( rMedium );
@@ -5621,7 +5621,7 @@ namespace
if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) )
aEncryptionData.realloc( 0 );
- if ( !aEncryptionData.getLength() )
+ if ( !aEncryptionData.hasElements() )
{
OUString sUniPassword = QueryPasswordForMedium( rMedium );
@@ -5767,7 +5767,7 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss)
uno::Sequence< beans::NamedValue > aEncryptionData = InitXorWord95Codec(aCtx, *pMedium, m_xWwFib.get());
// if initialization has failed the EncryptionData should be empty
- if (aEncryptionData.getLength() && aCtx.VerifyKey(m_xWwFib->m_nKey, m_xWwFib->m_nHash))
+ if (aEncryptionData.hasElements() && aCtx.VerifyKey(m_xWwFib->m_nKey, m_xWwFib->m_nHash))
{
nErrRet = ERRCODE_NONE;
pTempMain = MakeTemp(aDecryptMain);
@@ -5833,7 +5833,7 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss)
aEncryptionData = Init97Codec(*xCtx, info.verifier.salt, *pMedium);
else
nErrRet = ERRCODE_SVX_READ_FILTER_CRYPT;
- if (aEncryptionData.getLength() && xCtx->VerifyKey(info.verifier.encryptedVerifier,
+ if (aEncryptionData.hasElements() && xCtx->VerifyKey(info.verifier.encryptedVerifier,
info.verifier.encryptedVerifierHash))
{
nErrRet = ERRCODE_NONE;
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index f01ce84a036d..25c415d65fcd 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -320,7 +320,7 @@ ErrCode ReadThroughComponent(
// set Base URL
uno::Reference< beans::XPropertySet > xInfoSet;
- if( rFilterArguments.getLength() > 0 )
+ if( rFilterArguments.hasElements() )
rFilterArguments.getConstArray()[0] >>= xInfoSet;
OSL_ENSURE( xInfoSet.is(), "missing property set" );
if( xInfoSet.is() )
@@ -903,7 +903,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
if ( *o3tl::doAccess<bool>(aAny) )
nRedlineFlags |= RedlineFlags::ShowDelete;
aAny = xInfoSet->getPropertyValue( sRecordChanges );
- if ( *o3tl::doAccess<bool>(aAny) || (aKey.getLength() > 0) )
+ if ( *o3tl::doAccess<bool>(aAny) || aKey.hasElements() )
nRedlineFlags |= RedlineFlags::On;
// ... restore redline mode
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index d69749c59718..abc190029a13 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -503,7 +503,7 @@ bool SwXMLWriter::WriteThroughComponent(
// set Base URL
uno::Reference< beans::XPropertySet > xInfoSet;
- if( rArguments.getLength() > 0 )
+ if( rArguments.hasElements() )
rArguments.getConstArray()[0] >>= xInfoSet;
OSL_ENSURE( xInfoSet.is(), "missing property set" );
if( xInfoSet.is() )