diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-03 19:51:47 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-12 14:18:12 +0200 |
commit | 038e4b3b1e10d072b432cb06234521ae9a262a70 (patch) | |
tree | 6fb8087fd6a11fea6440dae91e8419043ad5f784 /sc/source | |
parent | 7bc6a7187c26690c64acb397e68d921be71e362e (diff) |
Use hasElements to check Sequence emptiness in sax..sdext
Similar to clang-tidy readability-container-size-empty
Change-Id: If6a567708d3c59355d54933fad23c85195846624
Reviewed-on: https://gerrit.libreoffice.org/71763
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
31 files changed, 53 insertions, 56 deletions
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 6a2b2a98a4f7..cb117b6a6f90 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -1342,7 +1342,7 @@ void ScDPOutput::GetPositionData(const ScAddress& rPos, DataPilotTablePositionDa break; const uno::Sequence<sheet::MemberResult> rSequence = pColFields[nField].maResult; - if (rSequence.getLength() == 0) + if (!rSequence.hasElements()) break; const sheet::MemberResult* pArray = rSequence.getConstArray(); @@ -1371,7 +1371,7 @@ void ScDPOutput::GetPositionData(const ScAddress& rPos, DataPilotTablePositionDa break; const uno::Sequence<sheet::MemberResult> rSequence = pRowFields[nField].maResult; - if (rSequence.getLength() == 0) + if (!rSequence.hasElements()) break; const sheet::MemberResult* pArray = rSequence.getConstArray(); diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 51c00020168d..8be7e52a27c4 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -1325,7 +1325,7 @@ void ScDPResultMember::FillMemberResults( // IsVisible() test is in ScDPResultDimension::FillMemberResults // (not on data layout dimension) - if (!pSequences->getLength()) + if (!pSequences->hasElements()) // empty sequence. Bail out. return; diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx index 7408cf4ab7a8..044b8e83d9ec 100644 --- a/sc/source/core/data/globalx.cxx +++ b/sc/source/core/data/globalx.cxx @@ -126,7 +126,7 @@ OUString ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber) } uno::Sequence< OUString > aSuffixes = xOrdinalSuffix->getOrdinalSuffix( nNumber, ScGlobal::pLocaleData->getLanguageTag().getLocale()); - if ( aSuffixes.getLength() > 0 ) + if ( aSuffixes.hasElements() ) return aSuffixes[0]; else return OUString(); diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx index 69fd340acedd..a3a4b777c33f 100644 --- a/sc/source/core/data/tabprotection.cxx +++ b/sc/source/core/data/tabprotection.cxx @@ -180,7 +180,7 @@ Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const OUString& aPassText Sequence<sal_Int8> ScTableProtectionImpl::hashPassword( const Sequence<sal_Int8>& rPassHash, ScPasswordHash eHash) { - if (!rPassHash.getLength() || eHash == PASSHASH_UNSPECIFIED) + if (!rPassHash.hasElements() || eHash == PASSHASH_UNSPECIFIED) return rPassHash; // TODO: Right now, we only support double-hash by SHA1. @@ -227,7 +227,7 @@ bool ScTableProtectionImpl::isProtectedWithPass() const if (!mbProtected) return false; - return !maPassText.isEmpty() || maPassHash.getLength() || maPasswordHash.hasPassword(); + return !maPassText.isEmpty() || maPassHash.hasElements() || maPasswordHash.hasPassword(); } void ScTableProtectionImpl::setProtected(bool bProtected) diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index 35e931f2d0b4..f4ae75ee844e 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -210,7 +210,7 @@ ScUserList::ScUserList() for ( sal_Int32 j = 0; j < xCalendars.getLength(); ++j ) { xCal = xCalendars[j].Days; - if ( xCal.getLength() ) + if ( xCal.hasElements() ) { OUStringBuffer aDayShortBuf, aDayLongBuf; sal_Int32 i; @@ -242,7 +242,7 @@ ScUserList::ScUserList() } xCal = xCalendars[j].Months; - if ( xCal.getLength() ) + if ( xCal.hasElements() ) { OUStringBuffer aMonthShortBuf, aMonthLongBuf; sal_Int32 i; diff --git a/sc/source/filter/excel/xechart.cxx b/sc/source/filter/excel/xechart.cxx index 017cde1e6093..c87d46dc928d 100644 --- a/sc/source/filter/excel/xechart.cxx +++ b/sc/source/filter/excel/xechart.cxx @@ -2749,7 +2749,7 @@ void XclExpChValueRange::Convert( const ScaleData& rScaleData ) // tdf#114168 If IntervalCount is 5, then enable automatic minor calculation. // During import, if minorUnit is set and majorUnit not, then it is impossible // to calculate IntervalCount. - const bool bAutoMinor = bLogScale || bAutoMajor || (rSubIncrementSeq.getLength() < 1) || + const bool bAutoMinor = bLogScale || bAutoMajor || !rSubIncrementSeq.hasElements() || lclIsAutoAnyOrGetValue( nCount, rSubIncrementSeq[ 0 ].IntervalCount ) || (nCount < 1) || (nCount == 5); if( maData.mfMajorStep && !bAutoMinor ) @@ -3090,7 +3090,7 @@ sal_uInt16 XclExpChAxesSet::Convert( Reference< XDiagram > const & xDiagram, sal if( xCoordSysCont.is() ) { Sequence< Reference< XCoordinateSystem > > aCoordSysSeq = xCoordSysCont->getCoordinateSystems(); - if( aCoordSysSeq.getLength() > 0 ) + if( aCoordSysSeq.hasElements() ) { /* Process first coordinate system only. Import filter puts all chart types into one coordinate system. */ diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 0c04cc5ea690..2500d75048fa 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -832,7 +832,7 @@ XclExpTbxControlObj::XclExpTbxControlObj( XclExpObjectManager& rRoot, Reference< OUString aDefText; if( aCtrlProp.GetProperty( aStringList, "StringItemList" ) && aCtrlProp.GetProperty( aDefText, "Text" ) && - aStringList.getLength() && !aDefText.isEmpty() ) + aStringList.hasElements() && !aDefText.isEmpty() ) { const OUString* pBegin = aStringList.getConstArray(); const OUString* pEnd = pBegin + aStringList.getLength(); diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index cdc562a40e59..4268bbd97830 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -301,11 +301,8 @@ bool XclExpRoot::IsDocumentEncrypted() const if (pDocProt && pDocProt->isProtected() && pDocProt->isOptionEnabled(ScDocProtection::STRUCTURE)) return true; - if ( GetEncryptionData().getLength() > 0 ) - // Password is entered directly into the save dialog. - return true; - - return false; + // Whether password is entered directly into the save dialog. + return GetEncryptionData().hasElements(); } uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const OUString& aPass ) diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 3954dccff2dd..bc86a848d8af 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -3643,7 +3643,7 @@ void XclImpChAxesSet::Convert( Reference< XDiagram > const & xDiagram ) const { Reference< XCoordinateSystemContainer > xCoordSystemCont( xDiagram, UNO_QUERY_THROW ); Sequence< Reference< XCoordinateSystem > > aCoordSystems = xCoordSystemCont->getCoordinateSystems(); - if( aCoordSystems.getLength() == 0 ) + if( !aCoordSystems.hasElements() ) xCoordSystemCont->addCoordinateSystem( xCoordSystem ); } catch( Exception& ) @@ -3730,7 +3730,7 @@ Reference< XCoordinateSystem > XclImpChAxesSet::CreateCoordSystem( Reference< XD { Sequence< Reference< XCoordinateSystem > > aCoordSystems = xCoordSystemCont->getCoordinateSystems(); OSL_ENSURE( aCoordSystems.getLength() <= 1, "XclImpChAxesSet::CreateCoordSystem - too many existing coordinate systems" ); - if( aCoordSystems.getLength() > 0 ) + if( aCoordSystems.hasElements() ) xCoordSystem = aCoordSystems[ 0 ]; } diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx index d5f8c1e70f15..a17170fdff26 100644 --- a/sc/source/filter/excel/xistream.cxx +++ b/sc/source/filter/excel/xistream.cxx @@ -64,8 +64,8 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const ::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) { o_rEncryptionData = OnVerifyPassword( rPassword ); - mnError = o_rEncryptionData.getLength() ? ERRCODE_NONE : ERRCODE_ABORT; - return o_rEncryptionData.getLength() ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword; + mnError = o_rEncryptionData.hasElements() ? ERRCODE_NONE : ERRCODE_ABORT; + return o_rEncryptionData.hasElements() ? ::comphelper::DocPasswordVerifierResult::OK : ::comphelper::DocPasswordVerifierResult::WrongPassword; } ::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyEncryptionData( const uno::Sequence< beans::NamedValue >& rEncryptionData ) @@ -173,7 +173,7 @@ bool XclImpBiff5Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N { maEncryptionData.realloc( 0 ); - if( rEncryptionData.getLength() ) + if( rEncryptionData.hasElements() ) { // init codec maCodec.InitCodec( rEncryptionData ); @@ -182,7 +182,7 @@ bool XclImpBiff5Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N maEncryptionData = rEncryptionData; } - return maEncryptionData.getLength(); + return maEncryptionData.hasElements(); } void XclImpBiff5Decrypter::OnUpdate( std::size_t /*nOldStrmPos*/, std::size_t nNewStrmPos, sal_uInt16 nRecSize ) @@ -273,7 +273,7 @@ bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N { maEncryptionData.realloc( 0 ); - if( rEncryptionData.getLength() ) + if( rEncryptionData.hasElements() ) { // init codec mpCodec->InitCodec( rEncryptionData ); @@ -282,7 +282,7 @@ bool XclImpBiff8Decrypter::OnVerifyEncryptionData( const uno::Sequence< beans::N maEncryptionData = rEncryptionData; } - return maEncryptionData.getLength(); + return maEncryptionData.hasElements(); } void XclImpBiff8Decrypter::OnUpdate( std::size_t nOldStrmPos, std::size_t nNewStrmPos, sal_uInt16 /*nRecSize*/ ) diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx index ca2aecfa499f..5e2ce066a286 100644 --- a/sc/source/filter/ftools/fapihelper.cxx +++ b/sc/source/filter/ftools/fapihelper.cxx @@ -119,7 +119,7 @@ uno::Sequence< beans::NamedValue > ScfApiHelper::QueryEncryptionDataForMedium( S rMedium.GetItemSet()->ClearItem( SID_PASSWORD ); rMedium.GetItemSet()->ClearItem( SID_ENCRYPTIONDATA ); - if( !bIsDefaultPassword && (aEncryptionData.getLength() > 0) ) + if( !bIsDefaultPassword && aEncryptionData.hasElements() ) rMedium.GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); return aEncryptionData; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index b605042e6259..1b82c93065b0 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -191,7 +191,7 @@ bool IsValidObject( const XclObj& rObj ) return false; uno::Sequence<uno::Reference<chart2::XCoordinateSystem> > xCooSysSeq = xCooSysContainer->getCoordinateSystems(); - if (!xCooSysSeq.getLength()) + if (!xCooSysSeq.hasElements()) return false; for (sal_Int32 nCooSys = 0; nCooSys < xCooSysSeq.getLength(); ++nCooSys) @@ -201,7 +201,7 @@ bool IsValidObject( const XclObj& rObj ) return false; uno::Sequence<uno::Reference<chart2::XChartType> > xChartTypeSeq = xChartTypeCont->getChartTypes(); - if (!xChartTypeSeq.getLength()) + if (!xChartTypeSeq.hasElements()) // No chart type. Not good. return false; } diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 35babb1de541..cf12913a17f9 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -802,7 +802,7 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc) SetNewCell(static_cast<ScMyContentAction*>(rxAction.get())); } aActions.clear(); - if (aProtect.getLength()) + if (aProtect.hasElements()) pTrack->SetProtection(aProtect); else if (pDoc->GetChangeTrack() && pDoc->GetChangeTrack()->IsProtected()) pTrack->SetProtection(pDoc->GetChangeTrack()->GetProtection()); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 828849f4ad7a..7a0c605cba00 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3414,7 +3414,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, uno::Sequence< OUString > aRepresentations( xReceiver->getUsedRangeRepresentations()); SvXMLAttributeList* pAttrList = nullptr; - if(aRepresentations.getLength()) + if(aRepresentations.hasElements()) { // add the ranges used by the chart to the shape // element to be able to start listening after diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index df3a83f63126..fb6c5aeb044c 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -1101,7 +1101,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa { uno::Sequence<sal_Int8> aPass; ::comphelper::Base64::decode(aPass, sKey); - if (aPass.getLength()) + if (aPass.hasElements()) { if (pDoc->GetChangeTrack()) pDoc->GetChangeTrack()->SetProtection(aPass); @@ -1371,7 +1371,7 @@ void ScXMLImport::SetStyleToRanges() // store first cell of first range for each style, once per sheet uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses()); pStyle->ApplyCondFormat(aAddresses); - if ( aAddresses.getLength() > 0 ) + if ( aAddresses.hasElements() ) { const table::CellRangeAddress& rRange = aAddresses[0]; if ( rRange.Sheet != pStyle->GetLastSheet() ) diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 8de761208428..0d5419c49e51 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -155,7 +155,7 @@ ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCompo // set Base URL uno::Reference< beans::XPropertySet > xInfoSet; - if( aArgs.getLength() > 0 ) + if( aArgs.hasElements() ) aArgs.getConstArray()[0] >>= xInfoSet; OSL_ENSURE( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) @@ -650,7 +650,7 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentC // set Base URL uno::Reference< beans::XPropertySet > xInfoSet; - if( aArgs.getLength() > 0 ) + if( aArgs.hasElements() ) aArgs.getConstArray()[0] >>= xInfoSet; OSL_ENSURE( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 9b20bfc1bb5a..f95028b5aca3 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -2318,7 +2318,7 @@ css::uno::Sequence< css::uno::Any > if ( bSuccess ) { uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence(); - if ( aSeq.getLength() ) + if ( aSeq.hasElements() ) { return aSeq; } diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 638b8a6365ae..4b872f0548de 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -124,7 +124,7 @@ void ScDocShell::InitItems() { // set forbidden characters if necessary uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales(); - if (aLocales.getLength()) + if (aLocales.hasElements()) { std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable( SvxForbiddenCharactersTable::makeForbiddenCharactersTable(comphelper::getProcessComponentContext())); diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index a5380399c49e..17b760d65a1f 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -337,7 +337,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos) // get available solver implementations //! sort by descriptions? ScSolverUtil::GetImplementations( maImplNames, maDescriptions ); - sal_Int32 nImplCount = maImplNames.getLength(); + bool bImplHasElements = maImplNames.hasElements(); const ScOptSolverSave* pOldData = mpDocShell->GetSolverSaveData(); if ( pOldData ) @@ -359,7 +359,7 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos) if ( !mrDoc.GetRangeAtBlock( ScRange(rCursorPos), &aCursorStr ) ) aCursorStr = rCursorPos.Format(ScRefFlags::ADDR_ABS, nullptr, mrDoc.GetAddressConvention()); m_xEdObjectiveCell->SetRefString( aCursorStr ); - if ( nImplCount > 0 ) + if ( bImplHasElements ) maEngine = maImplNames[0]; // use first implementation } ShowConditions(); @@ -769,7 +769,7 @@ bool ScOptSolverDlg::FindTimeout( sal_Int32& rTimeout ) { bool bFound = false; - if ( !maProperties.getLength() ) + if ( !maProperties.hasElements() ) maProperties = ScSolverUtil::GetDefaults( maEngine ); // get property defaults from component sal_Int32 nPropCount = maProperties.getLength(); diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 26ff15c2e2d2..e4b92356edcc 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -101,7 +101,7 @@ ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, if ( nSelect >= 0 ) // select in list box m_xLbEngine->set_active(nSelect); - if ( !maProperties.getLength() ) + if ( !maProperties.hasElements() ) ReadFromComponent(); // fill maProperties from component (using maEngine) FillListBox(); // using maProperties } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 0c726ab498af..c51eb115b0aa 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5051,7 +5051,7 @@ void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::Formula ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { - if ( rTokens.getLength() ) + if ( rTokens.hasElements() ) { if ( ScTableSheetObj::getImplementation( static_cast<cppu::OWeakObject*>(this) ) ) { diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index a7b20ce1e03c..ea575923bd68 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1521,7 +1521,7 @@ ScChart2DataProvider::createDataSource( } uno::Reference< chart2::data::XLabeledDataSequence > xChartSeries = lcl_createLabeledDataSequenceFromTokens( std::move(aValueTokens), std::move(aLabelTokens), m_pDocument, this, m_bIncludeHiddenCells ); //ownership of pointers is transferred! - if ( xChartSeries.is() && xChartSeries->getValues().is() && xChartSeries->getValues()->getData().getLength() ) + if ( xChartSeries.is() && xChartSeries->getValues().is() && xChartSeries->getValues()->getData().hasElements() ) { aSeqs.push_back( xChartSeries ); } @@ -2031,7 +2031,7 @@ uno::Reference< sheet::XRangeSelection > SAL_CALL ScChart2DataProvider::getRange sal_Bool SAL_CALL ScChart2DataProvider::createDataSequenceByFormulaTokensPossible( const Sequence<sheet::FormulaToken>& aTokens ) { - if (aTokens.getLength() <= 0) + if (!aTokens.hasElements()) return false; ScTokenArray aCode; @@ -2089,7 +2089,7 @@ ScChart2DataProvider::createDataSequenceByFormulaTokens( const Sequence<sheet::FormulaToken>& aTokens ) { uno::Reference<chart2::data::XDataSequence> xResult; - if (aTokens.getLength() <= 0) + if (!aTokens.hasElements()) return xResult; ScTokenArray aCode; @@ -2875,7 +2875,7 @@ uno::Sequence< uno::Any> SAL_CALL ScChart2DataSequence::getData() BuildDataCache(); - if (!m_aMixedDataCache.getLength()) + if (!m_aMixedDataCache.hasElements()) { // Build a cache for the 1st time... diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index ae2d063fcfcb..7443bf3ba018 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2886,7 +2886,7 @@ uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstanceWithArguments SolarMutexGuard aGuard; uno::Reference<uno::XInterface> xInt(create(ServiceSpecifier, &aArgs)); - if ( aArgs.getLength() ) + if ( aArgs.hasElements() ) { // used only for cell value binding so far - it can be initialized after creating diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 40af3ba2d59b..4cd31ca6aae9 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -214,14 +214,14 @@ void ScTableConditionalFormat::FillFormat( ScConditionalFormat& rFormat, if ( !aData.maPosStr.isEmpty() ) pCoreEntry->SetSrcString( aData.maPosStr ); - if ( aData.maTokens1.getLength() ) + if ( aData.maTokens1.hasElements() ) { ScTokenArray aTokenArray; if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens1) ) pCoreEntry->SetFormula1(aTokenArray); } - if ( aData.maTokens2.getLength() ) + if ( aData.maTokens2.hasElements() ) { ScTokenArray aTokenArray; if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aData.maTokens2) ) @@ -634,14 +634,14 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc, pRet->SetIgnoreBlank(bIgnoreBlank); pRet->SetListType(nShowList); - if ( aTokens1.getLength() ) + if ( aTokens1.hasElements() ) { ScTokenArray aTokenArray; if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens1) ) pRet->SetFormula1(aTokenArray); } - if ( aTokens2.getLength() ) + if ( aTokens2.hasElements() ) { ScTokenArray aTokenArray; if ( ScTokenConversion::ConvertToTokenArray(*pDoc, aTokenArray, aTokens2) ) diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index c4493df34536..eec400c28695 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -1592,7 +1592,7 @@ sal_Bool SAL_CALL ScExternalDocLinkObj::hasElements() SolarMutexGuard aGuard; // #i116940# be consistent with getByName: count only table names which have a cache already - return ( getElementNames().getLength() > 0 ); + return getElementNames().hasElements(); } sal_Int32 SAL_CALL ScExternalDocLinkObj::getTokenIndex() diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index aa660ae320e1..8dec1896e6a6 100644 --- a/sc/source/ui/vba/vbaeventshelper.cxx +++ b/sc/source/ui/vba/vbaeventshelper.cxx @@ -93,7 +93,7 @@ SCTAB lclGetTabFromArgs( const uno::Sequence< uno::Any >& rArgs, sal_Int32 nInde if( xRanges.is() ) { uno::Sequence< table::CellRangeAddress > aRangeAddresses = xRanges->getRangeAddresses(); - if( aRangeAddresses.getLength() > 0 ) + if( aRangeAddresses.hasElements() ) return aRangeAddresses[ 0 ].Sheet; } diff --git a/sc/source/ui/vba/vbaglobals.cxx b/sc/source/ui/vba/vbaglobals.cxx index 7343471af556..62ac352756c6 100644 --- a/sc/source/ui/vba/vbaglobals.cxx +++ b/sc/source/ui/vba/vbaglobals.cxx @@ -44,7 +44,7 @@ ScVbaGlobals::ScVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Referen 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 = "ExcelDocumentContext"; aInitArgs[ 1 ].Value <<= getXSomethingFromArgs< frame::XModel >( aArgs, 0 ); diff --git a/sc/source/ui/vba/vbatitle.hxx b/sc/source/ui/vba/vbatitle.hxx index 9b40f2a452d9..7777e66c84d7 100644 --- a/sc/source/ui/vba/vbatitle.hxx +++ b/sc/source/ui/vba/vbatitle.hxx @@ -135,7 +135,7 @@ public: css::uno::Sequence< OUString > getServiceNames() override { static css::uno::Sequence< OUString > aServiceNames; - if ( aServiceNames.getLength() == 0 ) + if ( !aServiceNames.hasElements() ) { aServiceNames.realloc( 1 ); aServiceNames[ 0 ] = "ooo.vba.excel.XTitle"; diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index 57dfaddeccda..cbb78bb0d2bd 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -198,7 +198,7 @@ ScVbaWorkbook::getFileFormat( ) void ScVbaWorkbook::init() { - if ( !ColorData.getLength() ) + if ( !ColorData.hasElements() ) ResetColors(); uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY ); if ( xModel.is() ) diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index e65148fbee37..77184add68a5 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -656,7 +656,7 @@ bool ScViewFunc::PasteLink( const uno::Reference<datatransfer::XTransferable>& r // so the source knows it will be used for a link uno::Sequence<sal_Int8> aSequence = aDataHelper.GetSequence(SotClipboardFormatId::LINK, OUString()); - if (!aSequence.getLength()) + if (!aSequence.hasElements()) { OSL_FAIL("DDE Data not found."); return false; diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 77f971b52236..bda40fb0ea79 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -186,7 +186,7 @@ void ScXMLSourceDlg::SelectSourceFile() return; uno::Sequence<OUString> aFiles = xFilePicker->getSelectedFiles(); - if (!aFiles.getLength()) + if (!aFiles.hasElements()) return; // There should only be one file returned from the file picker. |