sw/inc/PostItMgr.hxx | 4 ++-- sw/source/core/access/accpara.cxx | 10 +++++----- sw/source/core/crsr/DropDownFormFieldButton.cxx | 2 +- sw/source/core/doc/docedt.cxx | 8 ++++---- sw/source/core/edit/edlingu.cxx | 6 +++--- sw/source/core/tox/txmsrt.cxx | 2 +- sw/source/core/unocore/unochart.cxx | 4 ++-- sw/source/core/unocore/unocrsrhelper.cxx | 4 ++-- sw/source/core/unocore/unofield.cxx | 2 +- sw/source/core/unocore/unoobj.cxx | 8 ++++---- sw/source/core/unocore/unosect.cxx | 2 +- sw/source/core/unocore/unosett.cxx | 2 +- sw/source/core/unocore/unotext.cxx | 2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- sw/source/filter/ww8/docxexport.cxx | 2 +- sw/source/filter/ww8/docxtablestyleexport.cxx | 2 +- sw/source/filter/ww8/rtfattributeoutput.cxx | 4 ++-- sw/source/filter/ww8/wrtw8esh.cxx | 3 +-- sw/source/filter/ww8/wrtww8.cxx | 6 +++--- sw/source/filter/ww8/ww8par.cxx | 8 ++++---- sw/source/filter/xml/swxml.cxx | 4 ++-- sw/source/filter/xml/wrtxml.cxx | 2 +- sw/source/ui/dbui/addresslistdialog.cxx | 4 ++-- sw/source/ui/dbui/dbinsdlg.cxx | 2 +- sw/source/ui/dbui/mmdocselectpage.cxx | 2 +- sw/source/ui/dialog/uiregionsw.cxx | 12 ++++++------ sw/source/ui/envelp/mailmrge.cxx | 4 ++-- sw/source/ui/fldui/flddinf.cxx | 2 +- sw/source/ui/vba/vbaglobals.cxx | 2 +- sw/source/uibase/app/docsh.cxx | 8 ++++---- sw/source/uibase/app/docshini.cxx | 2 +- sw/source/uibase/dbui/dbmgr.cxx | 10 +++++----- sw/source/uibase/dbui/mmconfigitem.cxx | 5 ++--- sw/source/uibase/envelp/labelcfg.cxx | 2 +- sw/source/uibase/lingu/olmenu.cxx | 2 +- sw/source/uibase/misc/redlndlg.cxx | 4 ++-- sw/source/uibase/sidebar/PageMarginControl.cxx | 10 +++++----- sw/source/uibase/uiview/uivwimp.cxx | 4 ++-- sw/source/uibase/uiview/view2.cxx | 10 +++++----- sw/source/uibase/uiview/viewling.cxx | 6 +++--- sw/source/uibase/uiview/viewstat.cxx | 2 +- sw/source/uibase/uno/SwXDocumentSettings.cxx | 2 +- sw/source/uibase/uno/unomailmerge.cxx | 2 +- sw/source/uibase/uno/unotxdoc.cxx | 4 ++-- sw/source/uibase/uno/unotxvw.cxx | 2 +- 45 files changed, 95 insertions(+), 97 deletions(-)
New commits: commit 2ddc66e6981a7d819cd6196a7ccbc811ca213be2 Author: Arkadiy Illarionov <qar...@gmail.com> AuthorDate: Thu May 2 17:53:27 2019 +0300 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat May 4 13:57:07 2019 +0200 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.gran...@collabora.co.uk> diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx index d34ae3f34b72..19ba52b7aa18 100644 --- a/sw/inc/PostItMgr.hxx +++ b/sw/inc/PostItMgr.hxx @@ -101,7 +101,7 @@ class SwNoteProps: public utl::ConfigItem css::uno::Sequence< css::uno::Any > aValues = GetProperties(rNames); const css::uno::Any* pValues = aValues.getConstArray(); SAL_WARN_IF(aValues.getLength() != rNames.getLength(), "sw", "GetProperties failed"); - if (aValues.getLength()) + if (aValues.hasElements()) pValues[0]>>=m_bIsShowAnchor; } @@ -112,7 +112,7 @@ class SwNoteProps: public utl::ConfigItem static css::uno::Sequence< OUString >& GetPropertyNames() { static css::uno::Sequence< OUString > aNames; - if(!aNames.getLength()) + if(!aNames.hasElements()) { aNames.realloc(1); OUString* pNames = aNames.getArray(); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index dc2938ab286b..30d28c9c2183 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1359,7 +1359,7 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes( bool bSupplementalMode = false; uno::Sequence< OUString > aNames = aRequestedAttributes; - if (aNames.getLength() == 0) + if (!aNames.hasElements()) { bSupplementalMode = true; aNames = getAttributeNames(); @@ -1392,7 +1392,7 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes( if( bSupplementalMode ) { uno::Sequence< OUString > aSupplementalNames = aRequestedAttributes; - if (aSupplementalNames.getLength() == 0) + if (!aSupplementalNames.hasElements()) aSupplementalNames = getSupplementalAttributeNames(); tAccParaPropValMap aSupplementalAttrSeq; @@ -1586,7 +1586,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( } } - if ( aRequestedAttributes.getLength() == 0 ) + if ( !aRequestedAttributes.hasElements() ) { rDefAttrSeq = aDefAttrSeq; } @@ -1619,7 +1619,7 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getDefaultAttributes( static const char sMMToPixelRatio[] = "MMToPixelRatio"; bool bProvideMMToPixelRatio( false ); { - if ( aRequestedAttributes.getLength() == 0 ) + if ( !aRequestedAttributes.hasElements() ) { bProvideMMToPixelRatio = true; } @@ -1742,7 +1742,7 @@ void SwAccessibleParagraph::_getRunAttributesImpl( } } - if ( aRequestedAttributes.getLength() == 0 ) + if ( !aRequestedAttributes.hasElements() ) { rRunAttrSeq = aRunAttrSeq; } diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx index 49cebffed0fa..dca183199b9a 100644 --- a/sw/source/core/crsr/DropDownFormFieldButton.cxx +++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx @@ -61,7 +61,7 @@ SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, l aListBox->InsertEntry(i); } - if (vListEntries.getLength() == 0) + if (!vListEntries.hasElements()) { aListBox->InsertEntry(SwResId(STR_DROP_DOWN_EMPTY_LIST)); } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 542ff303216e..ab84f48b4361 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -610,7 +610,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, // get error position of cursor in XFlatParagraph linguistic2::ProofreadingResult aResult; - sal_Int32 nGrammarErrors; + bool bGrammarErrors; do { aConversionMap.ConvertToViewPosition( nBeginGrammarCheck ); @@ -620,16 +620,16 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, lcl_syncGrammarError( *pNd->GetTextNode(), aResult, aConversionMap ); // get suggestions to use for the specific error position - nGrammarErrors = aResult.aErrors.getLength(); + bGrammarErrors = aResult.aErrors.hasElements(); // if grammar checking doesn't have any progress then quit if( aResult.nStartOfNextSentencePosition <= nBeginGrammarCheck ) break; // prepare next iteration nBeginGrammarCheck = aResult.nStartOfNextSentencePosition; } - while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !nGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck ); + while( nSpellErrorPosition > aResult.nBehindEndOfSentencePosition && !bGrammarErrors && aResult.nBehindEndOfSentencePosition < nEndGrammarCheck ); - if( nGrammarErrors > 0 && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition ) + if( bGrammarErrors && nSpellErrorPosition >= aResult.nBehindEndOfSentencePosition ) { aRet <<= aResult; //put the cursor to the current error diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index ee2f62b0fa2d..c533e8013575 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -1016,7 +1016,7 @@ bool SwEditShell::GetGrammarCorrection( } } - if (rResult.aErrors.getLength() > 0) // error found? + if (rResult.aErrors.hasElements()) // error found? { HandleCorrectionError( aText, aPos, nBegin, nLen, pPt, rSelectRect ); } @@ -1323,7 +1323,7 @@ bool SwSpellIter::SpellSentence(svx::SpellPortions& rPortions, bool bIsGrammarCh aSpellRet >>= xSpellRet; aSpellRet >>= aGrammarResult; bGoOn = GetCursorCnt() > 1; - bGrammarErrorFound = aGrammarResult.aErrors.getLength() > 0; + bGrammarErrorFound = aGrammarResult.aErrors.hasElements(); if( xSpellRet.is() || bGrammarErrorFound ) { bGoOn = false; @@ -1528,7 +1528,7 @@ void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives > const & xAl else if(pGrammarResult) { aPortion.bIsGrammarError = true; - if(pGrammarResult->aErrors.getLength()) + if(pGrammarResult->aErrors.hasElements()) { aPortion.aGrammarError = pGrammarResult->aErrors[0]; aPortion.sText = pGrammarResult->aText.copy( aPortion.aGrammarError.nErrorStart, aPortion.aGrammarError.nErrorLength ); diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index b394ee4bd688..765d9023978f 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -80,7 +80,7 @@ void SwTOXInternational::Init() if(m_sSortAlgorithm.isEmpty()) { Sequence < OUString > aSeq( m_pIndexWrapper->GetAlgorithmList( aLcl )); - if(aSeq.getLength()) + if(aSeq.hasElements()) m_sSortAlgorithm = aSeq.getConstArray()[0]; } diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 85db6dbcca90..d2dc97d216f5 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -647,7 +647,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData // get table format for that single table from above SwFrameFormat *pTableFormat = nullptr; // pointer to table format std::shared_ptr<SwUnoCursor> pUnoCursor; // here required to check if the cells in the range do actually exist - if (aSubRanges.getLength() > 0) + if (aSubRanges.hasElements()) GetFormatAndCreateCursorFromRangeRep( pDoc, pSubRanges[0], &pTableFormat, pUnoCursor ); if (!pTableFormat || !pUnoCursor) @@ -1297,7 +1297,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwChartDataProvider::detectArgume aResult[nProps ].Name = "DataRowSource"; aResult[nProps++].Value <<= eDataRowSource; - if (aSequenceMapping.getLength() != 0) + if (aSequenceMapping.hasElements()) { aResult[nProps ].Name = "SequenceMapping"; aResult[nProps++].Value <<= aSequenceMapping; diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index b02320be05d0..c0d70801e691 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -731,7 +731,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry } eNewState = - aCharStyles.getLength() ? + aCharStyles.hasElements() ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE; if(pAny) (*pAny) <<= aCharStyles; @@ -1215,7 +1215,7 @@ void makeRedline( SwPaM const & rPaM, SfxItemPropertySet const& rPropSet = *aSwMapProvider.GetPropertySet(nMap); // Check if there are any properties - if (aRevertProperties.getLength()) + if (aRevertProperties.hasElements()) { SwDoc *const pDoc = rPaM.GetDoc(); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 4bb314c5a4bd..14f8f3ca0b98 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1916,7 +1916,7 @@ void SAL_CALL SwXTextField::attach( xField.reset(new SwAuthorityField(static_cast<SwAuthorityFieldType*>( pDoc->getIDocumentFieldsAccess().InsertFieldType(type)), OUString())); - if (m_pImpl->m_pProps->aPropSeq.getLength()) + if (m_pImpl->m_pProps->aPropSeq.hasElements()) { uno::Any aVal; aVal <<= m_pImpl->m_pProps->aPropSeq; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 288df1033005..913151c84710 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1782,7 +1782,7 @@ void SwUnoCursorHelper::SetPropertyValues( const uno::Sequence< beans::PropertyValue > &rPropertyValues, const SetAttrMode nAttrMode) { - if (!rPropertyValues.getLength()) + if (!rPropertyValues.hasElements()) return; SwDoc *const pDoc = rPaM.GetDoc(); @@ -2543,10 +2543,10 @@ SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable) // get collator algorithm to be used for the locale uno::Sequence< OUString > aSeq( GetAppCollator().listCollatorAlgorithms( aLang ) ); - const sal_Int32 nLen = aSeq.getLength(); - OSL_ENSURE( nLen > 0, "list of collator algorithms is empty!"); + const bool bHasElements = aSeq.hasElements(); + OSL_ENSURE( bHasElements, "list of collator algorithms is empty!"); OUString aCollAlg; - if (nLen > 0) + if (bHasElements) { aCollAlg = aSeq.getConstArray()[0]; } diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 2a2869a1717c..44041c62a013 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -399,7 +399,7 @@ SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange) aSet.Put(*m_pImpl->m_pProps->m_pLRSpaceItem); } // section password - if (m_pImpl->m_pProps->m_Password.getLength() > 0) + if (m_pImpl->m_pProps->m_Password.hasElements()) { aSect.SetPassword(m_pImpl->m_pProps->m_Password); } diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index ebaf24260187..5c4a3f5623b1 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -2322,7 +2322,7 @@ SwXTextColumns::SwXTextColumns(const SwFormatCol& rFormatCol) : pColumns[i].LeftMargin = convertTwipToMm100(pCol->GetLeft ()); pColumns[i].RightMargin = convertTwipToMm100(pCol->GetRight()); } - if(!m_aTextColumns.getLength()) + if(!m_aTextColumns.hasElements()) m_nReference = USHRT_MAX; m_nSepLineWidth = rFormatCol.GetLineWidth(); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index e7a9a336cb53..727d6ec7aacf 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1444,7 +1444,7 @@ SwXText::insertTextContentWithProperties( // now attach the text content here insertTextContent( xInsertPosition, xTextContent, false ); // now apply the properties to the anchor - if (rCharacterAndParagraphProperties.getLength()) + if (rCharacterAndParagraphProperties.hasElements()) { try { 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() ) diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 83b3d6293cc8..93446315ee55 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -95,7 +95,7 @@ static OUString lcl_getFlatURL( uno::Reference<beans::XPropertySet> const & xSou xSourceProperties->getPropertyValue("TableFilter") >>= aFilters; uno::Sequence<PropertyValue> aInfo; xSourceProperties->getPropertyValue("Info") >>= aInfo; - if(aFilters.getLength() == 1 && aInfo.getLength() ) + if(aFilters.getLength() == 1 && aInfo.hasElements() ) { OUString sExtension; OUString sCharSet; @@ -490,7 +490,7 @@ void SwAddressListDialog::DetectTablesAndQueries( } else if(nTables == 1) { - if(aTables.getLength()) + if(aTables.hasElements()) { m_aDBData.sCommand = aTables[0]; m_aDBData.nCommandType = CommandType::TABLE; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 51d02dcd5026..91f33643289b 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -921,7 +921,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, { auto xResultSet = xResultSet_in; - const Any* pSelection = rSelection.getLength() ? rSelection.getConstArray() : nullptr; + const Any* pSelection = rSelection.hasElements() ? rSelection.getConstArray() : nullptr; SwWrtShell& rSh = pView->GetWrtShell(); //with the drag and drop interface no result set is initially available diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index cf3fc454829b..1991a7d4b2ef 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -76,7 +76,7 @@ SwMailMergeDocSelectPage::SwMailMergeDocSelectPage(SwMailMergeWizard* pWizard, T m_xRecentDocLB->insert_text(0, rDocs[nDoc]); } m_xRecentDocLB->set_active(0); - if(!rDocs.getLength()) + if(!rDocs.hasElements()) { m_xRecentDocRB->set_sensitive(false); } diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 1dff89e08cb1..ded18b7fffea 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -408,8 +408,8 @@ bool SwEditRegionDlg::CheckPasswd(weld::ToggleButton* pBox) m_xTree->selected_foreach([this, &bRet](weld::TreeIter& rEntry){ SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64()); - if (!pRepr->GetTempPasswd().getLength() - && pRepr->GetSectionData().GetPassword().getLength()) + if (!pRepr->GetTempPasswd().hasElements() + && pRepr->GetSectionData().GetPassword().hasElements()) { SfxPasswordDialog aPasswdDlg(m_xDialog.get()); bRet = false; @@ -661,7 +661,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void) return; } else - m_xPasswdCB->set_active(aCurPasswd.getLength() > 0); + m_xPasswdCB->set_active(aCurPasswd.hasElements()); } else if (bEntry ) { @@ -675,7 +675,7 @@ IMPL_LINK(SwEditRegionDlg, GetFirstEntryHdl, weld::TreeView&, rBox, void) bool bHide = TRISTATE_TRUE == m_xHideCB->get_state(); m_xConditionED->set_sensitive(bHide); m_xConditionFT->set_sensitive(bHide); - m_xPasswdCB->set_active(rData.GetPassword().getLength() > 0); + m_xPasswdCB->set_active(rData.GetPassword().hasElements()); m_xOK->set_sensitive(true); m_xPasswdCB->set_sensitive(true); @@ -1218,7 +1218,7 @@ void SwEditRegionDlg::ChangePasswd(bool bChange) SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64()); if(bSet) { - if(!pRepr->GetTempPasswd().getLength() || bChange) + if(!pRepr->GetTempPasswd().hasElements() || bChange) { SfxPasswordDialog aPasswdDlg(m_xDialog.get()); aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); @@ -1638,7 +1638,7 @@ void SwInsertSectionTabPage::ChangePasswd(bool bChange) bool bSet = bChange ? bChange : m_xPasswdCB->get_active(); if (bSet) { - if(!m_aNewPasswd.getLength() || bChange) + if(!m_aNewPasswd.hasElements() || bChange) { SfxPasswordDialog aPasswdDlg(GetDialogFrameWeld()); aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 1e8a91eba344..e7769feb7c14 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -103,7 +103,7 @@ void SwXSelChgLstnr_Impl::selectionChanged( const EventObject& ) if(rParent.pImpl->xSelSupp.is()) rParent.pImpl->xSelSupp->getSelection() >>= aSelection; - bool bEnable = aSelection.getLength() > 0; + bool bEnable = aSelection.hasElements(); rParent.m_pMarkedRB->Enable(bEnable); if(bEnable) rParent.m_pMarkedRB->Check(); @@ -309,7 +309,7 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell, if (m_pColumnLB->GetSelectedEntryCount() == 0) m_pColumnLB->SelectEntryPos(0); - const bool bEnable = m_aSelection.getLength() != 0; + const bool bEnable = m_aSelection.hasElements(); m_pMarkedRB->Enable(bEnable); if (bEnable) m_pMarkedRB->Check(); diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index dfc841ac3942..6ec3db4e8cf8 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -138,7 +138,7 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* ) uno::Reference< beans::XPropertySetInfo > xSetInfo = xCustomPropertySet->getPropertySetInfo(); const uno::Sequence< beans::Property > rProperties = xSetInfo->getProperties(); - if( rProperties.getLength() ) + if( rProperties.hasElements() ) { std::unique_ptr<weld::TreeIter> xInfo(m_xTypeTLB->make_iterator()); diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx index d6b89abf4448..233e77799735 100644 --- a/sw/source/ui/vba/vbaglobals.cxx +++ b/sw/source/ui/vba/vbaglobals.cxx @@ -39,7 +39,7 @@ SwVbaGlobals::SwVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Refere uno::Sequence< beans::PropertyValue > aInitArgs( aArgs.getLength() + 1 ); aInitArgs[ 0 ].Name = "Application"; aInitArgs[ 0 ].Value <<= getApplication(); - if ( aArgs.getLength() > 0 ) + if ( aArgs.hasElements() ) { aInitArgs[ 1 ].Name = "WordDocumentContext"; aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 ); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 7f13bbbfb63b..1486916cd181 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -659,7 +659,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if(xLib.is()) { Sequence<OUString> aModNames = xLib->getElementNames(); - if(aModNames.getLength()) + if(aModNames.hasElements()) { SetError(WARN_SWG_HTML_NO_MACROS); break; @@ -1362,7 +1362,7 @@ bool SwDocShell::HasChangeRecordProtection() const { if (!m_pWrtShell) return false; - return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength() > 0; + return m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); } void SwDocShell::SetChangeRecording( bool bActivate ) @@ -1380,7 +1380,7 @@ void SwDocShell::SetProtectionPassword( const OUString &rNewPassword ) IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); Sequence< sal_Int8 > aPasswd = rIDRA.GetRedlinePassword(); if (SfxItemState::SET == aSet.GetItemState(FN_REDLINE_PROTECT, false, &pItem) - && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswd.getLength() > 0)) + && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements()) return; if (!rNewPassword.isEmpty()) @@ -1408,7 +1408,7 @@ bool SwDocShell::GetProtectionHash( /*out*/ css::uno::Sequence< sal_Int8 > &rPas IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); const Sequence< sal_Int8 >& aPasswdHash( rIDRA.GetRedlinePassword() ); if (SfxItemState::SET == aSet.GetItemState(FN_REDLINE_PROTECT, false, &pItem) - && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0)) + && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswdHash.hasElements()) return false; rPasswordHash = aPasswdHash; bRes = true; diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index d181b485602f..7428887c51b6 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -126,7 +126,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) { SvxAsianConfig aAsian; Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales(); - if (aLocales.getLength()) + if (aLocales.hasElements()) { const lang::Locale* pLocales = aLocales.getConstArray(); for(sal_Int32 i = 0; i < aLocales.getLength(); i++) diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 508c2760807d..99f24e7ca948 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -358,7 +358,7 @@ static bool lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos) bool bRet = false; try { - if(pParam->aSelection.getLength()) + if(pParam->aSelection.hasElements()) { if(pParam->aSelection.getLength() <= nAbsPos) { @@ -939,7 +939,7 @@ static bool lcl_SaveDoc( if( pStoreToFilterOptions ) pDstMed->GetItemSet()->Put( SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions)); - if( pSaveToFilterData->getLength() ) + if( pSaveToFilterData->hasElements() ) pDstMed->GetItemSet()->Put( SfxUnoAnyItem(SID_FILTER_DATA, uno::makeAny(*pSaveToFilterData))); } @@ -2139,7 +2139,7 @@ bool SwDBManager::GetColumnCnt(const OUString& rSourceName, const OUString& rTab if (!pFound) return false; //check validity of supplied record Id - if(pFound->aSelection.getLength()) + if(pFound->aSelection.hasElements()) { //the destination has to be an element of the selection const uno::Any* pSelection = pFound->aSelection.getConstArray(); @@ -2303,7 +2303,7 @@ static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action ) try { - if( pParam->aSelection.getLength() ) + if( pParam->aSelection.hasElements() ) { if( pParam->nSelectionIndex >= pParam->aSelection.getLength() ) pParam->bEndOfDB = true; @@ -2479,7 +2479,7 @@ sal_uInt32 SwDBManager::GetSelectedRecordId( { try { //if a selection array is set the current row at the result set may not be set yet - if(pFound->aSelection.getLength()) + if(pFound->aSelection.hasElements()) { sal_Int32 nSelIndex = pFound->nSelectionIndex; if(nSelIndex >= pFound->aSelection.getLength()) diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 416b68b8dae8..41aa414233b8 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -291,7 +291,7 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() : } //read the list of data base assignments Sequence<OUString> aAssignments = GetNodeNames(cAddressDataAssignments); - if(aAssignments.getLength()) + if(aAssignments.hasElements()) { //create a list of property names to load the URLs of all data bases const OUString* pAssignments = aAssignments.getConstArray(); @@ -327,7 +327,7 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() : } } //check if the saved documents still exist - if(m_aSavedDocuments.getLength()) + if(m_aSavedDocuments.hasElements()) { uno::Sequence< OUString > aTempDocuments(m_aSavedDocuments.getLength()); OUString* pTempDocuments = aTempDocuments.getArray(); @@ -345,7 +345,6 @@ SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() : m_aSavedDocuments.realloc(nIndex); } } - } void SwMailMergeConfigItem_Impl::SetCurrentAddressBlockIndex( sal_Int32 nSet ) diff --git a/sw/source/uibase/envelp/labelcfg.cxx b/sw/source/uibase/envelp/labelcfg.cxx index f18d781fd08a..70e3cc8b54c5 100644 --- a/sw/source/uibase/envelp/labelcfg.cxx +++ b/sw/source/uibase/envelp/labelcfg.cxx @@ -282,7 +282,7 @@ void SwLabelConfig::SaveLabel( const OUString& rManufacturer, OUString sFoundNode; bool bManufacturerNodeFound; if ( m_aLabels.find( rManufacturer ) == m_aLabels.end() || - GetNodeNames( rManufacturer ).getLength() == 0 ) + !GetNodeNames( rManufacturer ).hasElements() ) { bManufacturerNodeFound = false; // manufacturer node does not exist, add (and also to m_aManufacturers) diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 7f6be927500a..16a2920a6d77 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -174,7 +174,7 @@ void SwSpellPopup::fillLangPopupMenu( if (xDocumentLanguages.is()) { uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ) ); - if (rLocales.getLength() > 0) + if (rLocales.hasElements()) { for (sal_Int32 i = 0; i < rLocales.getLength(); ++i) { diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 1861bc292057..ddae90fd36a3 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -274,7 +274,7 @@ void SwRedlineAcceptDlg::InitAuthors() pFilterPage->SelectAuthor(aStrings[0]); weld::TreeView& rTreeView = m_pTable->GetWidget(); - bool bEnable = rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); + bool bEnable = rTreeView.n_children() != 0 && !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); bool bSel = rTreeView.get_selected(nullptr); rTreeView.selected_foreach([this, pSh, &bIsNotFormated](weld::TreeIter& rEntry){ @@ -978,7 +978,7 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void) } } - bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().getLength(); + bool bEnable = !pSh->getIDocumentRedlineAccess().GetRedlinePassword().hasElements(); m_pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ ); m_pTPView->EnableReject( bEnable && bSel /*&& !bReadonlySel*/ ); m_pTPView->EnableClearFormat( bEnable && bSel && !bIsNotFormated /*&& !bReadonlySel*/ ); diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index 9b0e66da58dc..eae043554484 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -513,7 +513,7 @@ bool PageMarginControl::GetUserCustomValues() { css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt.GetUserData(); OUString aTmp; - if ( aSeq.getLength()) + if ( aSeq.hasElements()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); m_nUserCustomPageLeftMargin = aWinData.toInt32(); @@ -525,7 +525,7 @@ bool PageMarginControl::GetUserCustomValues() { css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt2.GetUserData(); OUString aTmp; - if ( aSeq.getLength()) + if ( aSeq.hasElements()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); m_nUserCustomPageRightMargin = aWinData.toInt32(); @@ -537,7 +537,7 @@ bool PageMarginControl::GetUserCustomValues() { css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt3.GetUserData(); OUString aTmp; - if ( aSeq.getLength() ) + if ( aSeq.hasElements() ) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); m_nUserCustomPageTopMargin = aWinData.toInt32(); @@ -549,7 +549,7 @@ bool PageMarginControl::GetUserCustomValues() { css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt4.GetUserData(); OUString aTmp; - if ( aSeq.getLength()) + if ( aSeq.hasElements()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); m_nUserCustomPageBottomMargin = aWinData.toInt32(); @@ -561,7 +561,7 @@ bool PageMarginControl::GetUserCustomValues() { css::uno::Sequence < css::beans::NamedValue > aSeq = aWinOpt5.GetUserData(); OUString aTmp; - if ( aSeq.getLength()) + if ( aSeq.hasElements()) aSeq[0].Value >>= aTmp; OUString aWinData( aTmp ); m_bUserCustomMirrored = aWinData.toInt32() != 0; diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index f2d9fdcf420f..737839eedeb9 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -123,7 +123,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) const Sequence< ScannerContext > aContexts( xScanMgr->getAvailableScanners() ); - if( aContexts.getLength() ) + if( aContexts.hasElements() ) { Reference< XEventListener > xLstner = &rListener; ScannerContext aContext( aContexts.getConstArray()[ 0 ] ); @@ -155,7 +155,7 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) try { const Sequence< scanner::ScannerContext >aContexts( xScanMgr->getAvailableScanners() ); - if( aContexts.getLength() ) + if( aContexts.hasElements() ) { Reference< XEventListener > xLstner = &rListener; xScanMgr->startScan( aContexts.getConstArray()[ 0 ], xLstner ); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index a4b5cd620fbe..7590d5e8b857 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -573,7 +573,7 @@ void SwView::Execute(SfxRequest &rReq) { IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); - if( aPasswd.getLength() ) + if( aPasswd.hasElements() ) { OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set an redlining off doesn't match!" ); // xmlsec05: new password dialog @@ -612,14 +612,14 @@ void SwView::Execute(SfxRequest &rReq) IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess(); Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword(); if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ) - && static_cast<const SfxBoolItem*>(pItem)->GetValue() == ( aPasswd.getLength() != 0 ) ) + && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements() ) break; // xmlsec05: new password dialog // message box for wrong password SfxPasswordDialog aPasswdDlg(GetFrameWeld()); aPasswdDlg.SetMinLen(1); - if (!aPasswd.getLength()) + if (!aPasswd.hasElements()) aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM); if (aPasswdDlg.run()) { @@ -628,7 +628,7 @@ void SwView::Execute(SfxRequest &rReq) Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); - if(!aPasswd.getLength()) + if(!aPasswd.hasElements()) { rIDRA.SetRedlinePassword(aNewPasswd); } @@ -2291,7 +2291,7 @@ namespace { Sequence < OUString > aNames = _rDatasourceContext->getElementNames(); - return ( !aNames.getLength() + return ( !aNames.hasElements() || ( ( 1 == aNames.getLength() ) && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource ) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 72a68784be73..6d627a74fbac 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -679,7 +679,7 @@ bool SwView::ExecSpellPopup(const Point& rPt) sal_Int32 nErrorInResult = -1; uno::Sequence< OUString > aSuggestions; bool bCorrectionRes = false; - if (!xAlt.is() || xAlt->getAlternatives().getLength() == 0) + if (!xAlt.is() || !xAlt->getAlternatives().hasElements()) { sal_Int32 nErrorPosInText = -1; bCorrectionRes = m_pWrtShell->GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, &rPt, aToFill ); @@ -689,12 +689,12 @@ bool SwView::ExecSpellPopup(const Point& rPt) // we like to use the grammar checking context menu if we either get // some suggestions or at least a comment about the error found... bUseGrammarContext = bCorrectionRes && - (aSuggestions.getLength() > 0 || !aMessageText.isEmpty()); + (aSuggestions.hasElements() || !aMessageText.isEmpty()); } // open respective context menu for spell check or grammar errors with correction suggestions... if ((!bUseGrammarContext && xAlt.is()) || - (bUseGrammarContext && bCorrectionRes && aGrammarCheckRes.aErrors.getLength() > 0)) + (bUseGrammarContext && bCorrectionRes && aGrammarCheckRes.aErrors.hasElements())) { // get paragraph text OUString aParaText; diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 909ba9a67225..bc771162bea2 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -404,7 +404,7 @@ void SwView::GetState(SfxItemSet &rSet) case SID_DOCUMENT_COMPARE: case SID_DOCUMENT_MERGE: if( dynamic_cast<const SwGlobalDocShell* >(GetDocShell()) != nullptr|| - (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().getLength())) + (SID_DOCUMENT_MERGE == nWhich && m_pWrtShell->getIDocumentRedlineAccess().GetRedlinePassword().hasElements())) rSet.DisableItem(nWhich); break; case SID_VIEW_DATA_SOURCE_BROWSER: diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 1e7bb75f04a5..924db95bb73e 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -641,7 +641,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf if(rValue >>= aNew) { mpDoc->getIDocumentRedlineAccess().SetRedlinePassword(aNew); - if(aNew.getLength()) + if(aNew.hasElements()) { RedlineFlags eMode = mpDoc->getIDocumentRedlineAccess().GetRedlineFlags(); eMode |= RedlineFlags::On; diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index f38cfba8782c..128b9a25765c 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -550,7 +550,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( // need to translate the selection: the API here requires a sequence of bookmarks, but the Merge // method we will call below requires a sequence of indices. - if ( aCurSelection.getLength() ) + if ( aCurSelection.hasElements() ) { Sequence< Any > aTranslated( aCurSelection.getLength() ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 5b95045842a3..28b3958fc55f 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1764,7 +1764,7 @@ Reference< XInterface > SwXTextDocument::createInstanceWithArguments( Sequence< OUString > SwXTextDocument::getAvailableServiceNames() { static Sequence< OUString > aServices; - if ( aServices.getLength() == 0 ) + if ( !aServices.hasElements() ) { Sequence< OUString > aRet = SvxFmMSFactory::getAvailableServiceNames(); OUString* pRet = aRet.getArray(); @@ -1896,7 +1896,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any& { SwDoc* pDoc = pDocShell->GetDoc(); pDoc->getIDocumentRedlineAccess().SetRedlinePassword(aNew); - if(aNew.getLength()) + if(aNew.hasElements()) { RedlineFlags eMode = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); eMode |= RedlineFlags::On; diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 2be21959a05a..12bc55ac579e 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -581,7 +581,7 @@ void SAL_CALL SwXTextView::setRubyList( { SolarMutexGuard aGuard; - if(!GetView() || !rRubyList.getLength()) + if(!GetView() || !rRubyList.hasElements()) throw RuntimeException(); SwWrtShell& rSh = m_pView->GetWrtShell(); ShellMode eSelMode = m_pView->GetShellMode(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits