diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-04 17:06:38 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-31 16:10:17 +0200 |
commit | 966f40eecfc60f20c309bc2477149442d753763a (patch) | |
tree | ed72f7b3d2fe609696834d47da120eeb4bd1460c | |
parent | 4830a1bae89a8ed60696503e315ffd42c70dff74 (diff) |
Use hasElements to check Sequence emptiness in [e-i]*
Similar to clang-tidy readability-container-size-empty
Change-Id: I79e31919db8f4132216f09a7868d18835eeb154b
Reviewed-on: https://gerrit.libreoffice.org/71795
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
59 files changed, 114 insertions, 115 deletions
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 14d67b5c2ccc..7914e65383a5 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1208,7 +1208,7 @@ namespace accessibility bool bSupplementalMode = false; uno::Sequence< OUString > aPropertyNames = rRequestedAttributes; - if (aPropertyNames.getLength() == 0) + if (!aPropertyNames.hasElements()) { bSupplementalMode = true; aPropertyNames = getAttributeNames(); diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index c8333fa5220d..0bdbb50d33ee 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -541,7 +541,7 @@ namespace editeng if (!m_bIsInteractive) { // silent conversion (e.g. for simplified/traditional Chinese)... - if(m_aCurrentSuggestions.getLength()>0) + if(m_aCurrentSuggestions.hasElements()) implChange( m_aCurrentSuggestions.getConstArray()[0] ); } else if (bAutoChange) diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index dbae6e36ccd3..5e0eae732fd3 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -577,7 +577,7 @@ uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const uno::Type & rType ) uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes() { - if( maTypeSequence.getLength() == 0 ) + if( !maTypeSequence.hasElements() ) { maTypeSequence = comphelper::concatSequences( OComponentHelper::getTypes(), diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index b0decc28bd6a..cba1be7c4d19 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -1760,7 +1760,7 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::isStored() if (!xNA.is()) return false; - return xNA->getElementNames().getLength() > 0; + return xNA->getElementNames().hasElements(); } diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx index 2bac339a7651..ce36832027ba 100644 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx @@ -115,7 +115,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta if (!aObject.hasElements() && aMediaType == MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII) aObject = m_aConfigHelper.GetObjectPropsByMediaType(MIMETYPE_VND_SUN_XML_BASE_ASCII); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage xResult.set(static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( @@ -164,7 +164,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta throw io::IOException(); // TODO: } uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName ); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage @@ -204,7 +204,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta 4 ); uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID ); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage xResult.set( static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject( @@ -245,7 +245,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta 2 ); uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID ); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments ); @@ -302,7 +302,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta throw io::IOException(); // TODO: } uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName ); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage @@ -350,7 +350,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta 3 ); uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID ); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject ); @@ -415,7 +415,7 @@ uno::Reference< uno::XInterface > SAL_CALL OOoSpecialEmbeddedObjectFactory::crea const uno::Sequence< beans::PropertyValue >& /*lObjArgs*/ ) { uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID ); - if ( !aObject.getLength() ) + if ( !aObject.hasElements() ) throw io::IOException(); // unexpected mimetype of the storage uno::Reference< uno::XInterface > xResult( diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 6eebdc26a188..e73b92b3d6ba 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -135,7 +135,7 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, Reference< XIdlClass > xReturnType = xMethod->getReturnType(); Sequence< Reference< XIdlClass > > aExceptionSeq = xMethod->getExceptionTypes(); if( ( xReturnType.is() && xReturnType->getTypeClass() != TypeClass_VOID ) || - aExceptionSeq.getLength() > 0 ) + aExceptionSeq.hasElements() ) { bApproveFiring = true; } diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 262d0cd8c763..daaa3702b03b 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -300,7 +300,7 @@ DBChangeDialogConfig_Impl::~DBChangeDialogConfig_Impl() const Sequence<OUString>& DBChangeDialogConfig_Impl::GetDataSourceNames() { - if(!aSourceNames.getLength()) + if(!aSourceNames.hasElements()) { Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext); diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 12af26f4cede..757cd195f61b 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -259,7 +259,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, { DBChangeDialogConfig_Impl aConfig; const Sequence<OUString> aSources = aConfig.GetDataSourceNames(); - if(aSources.getLength()) + if(aSources.hasElements()) aBibDesc.sDataSource = aSources.getConstArray()[0]; } @@ -564,7 +564,7 @@ sal_Bool BibliographyLoader::hasElements() { Reference< XResultSet > xCursor = GetDataCursor(); Reference< XNameAccess > xColumns = GetDataColumns(); - return xColumns.is() && (xColumns->getElementNames().getLength() != 0); + return xColumns.is() && xColumns->getElementNames().hasElements(); } Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo() diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 52720123935a..ad8215500d9a 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -148,7 +148,7 @@ static Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm) if (xSupplyCols.is()) xReturn = xSupplyCols->getColumns(); - if (!xReturn.is() || (xReturn->getElementNames().getLength() == 0)) + if (!xReturn.is() || !xReturn->getElementNames().hasElements()) { // no .... xReturn = nullptr; // -> get the table the form is bound to and ask it for their columns @@ -706,7 +706,7 @@ Reference< XForm > BibDataManager::createDatabaseForm(BibDBDescriptor& rDesc) if (xTables.is()) aTableNameSeq = xTables->getElementNames(); - if(aTableNameSeq.getLength() > 0) + if(aTableNameSeq.hasElements()) { if(!rDesc.sTableOrQuery.isEmpty()) aActiveDataTable = rDesc.sTableOrQuery; @@ -830,7 +830,7 @@ OUString BibDataManager::getQueryField() if(aFieldString.isEmpty()) { const Sequence< OUString > aSeq = getQueryFields(); - if(aSeq.getLength()>0) + if(aSeq.hasElements()) { aFieldString=aSeq[0]; } @@ -892,7 +892,7 @@ void BibDataManager::setActiveDataSource(const OUString& rURL) Reference< XNameAccess > xAccess = xSupplyTables->getTables(); aTableNameSeq = xAccess->getElementNames(); } - if(aTableNameSeq.getLength() > 0) + if(aTableNameSeq.hasElements()) { aActiveDataTable = aTableNameSeq[0]; aVal <<= aActiveDataTable; diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 9c8a00ee21d8..4453b72f95f0 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -625,7 +625,7 @@ namespace dbp return false; } - return 0 != m_aContext.aFieldNames.getLength(); + return m_aContext.aFieldNames.hasElements(); } @@ -683,7 +683,7 @@ namespace dbp bool OControlWizard::needDatasourceSelection() { // lemme see ... - return (0 == getContext().aFieldNames.getLength()); + return !getContext().aFieldNames.hasElements(); // if we got fields, the data source is valid ... } diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index af4751428cf1..f8ee3b2129b5 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -100,7 +100,7 @@ namespace dbp return GBW_STATE_OPTIONVALUES; case GBW_STATE_OPTIONVALUES: - if (getContext().aFieldNames.getLength()) + if (getContext().aFieldNames.hasElements()) return GBW_STATE_DBFIELD; else return GBW_STATE_FINALIZE; @@ -131,7 +131,7 @@ namespace dbp if (!m_bVisitedDB) { // try to generate a default for the DB field // (simply use the first field in the DB names collection) - if (getContext().aFieldNames.getLength()) + if (getContext().aFieldNames.hasElements()) m_aSettings.sDBField = getContext().aFieldNames[0]; } m_bVisitedDB = true; @@ -180,7 +180,7 @@ namespace dbp get(m_pMoveLeft, "toleft"); get(m_pExistingRadios, "radiobuttons"); - if (getContext().aFieldNames.getLength()) + if (getContext().aFieldNames.hasElements()) { enableFormDatasourceDisplay(); } diff --git a/extensions/source/logging/consolehandler.cxx b/extensions/source/logging/consolehandler.cxx index e20350d5629c..346880936e3f 100644 --- a/extensions/source/logging/consolehandler.cxx +++ b/extensions/source/logging/consolehandler.cxx @@ -99,7 +99,7 @@ namespace logging { ::osl::MutexGuard aGuard( m_aMutex ); - if ( arguments.getLength() == 0 ) + if ( !arguments.hasElements() ) { // create() - nothing to init m_aHandlerHelper.setIsInitialized(); return; diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index b6cdfa1d0c01..9d04e98715bb 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -196,7 +196,7 @@ namespace logging if ( !sServiceName.isEmpty() ) { bool bSuccess = false; - if ( aSettings.getLength() ) + if ( aSettings.hasElements() ) { Sequence< Any > aConstructionArgs(1); aConstructionArgs[0] <<= aSettings; diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index edfb90cfa5f3..ed7348bfaa5d 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -226,7 +226,7 @@ namespace pcr { xStringResourceResolver.set( _xComponent->getPropertyValue( "ResourceResolver" ),UNO_QUERY); if( xStringResourceResolver.is() && - xStringResourceResolver->getLocales().getLength() > 0 ) + xStringResourceResolver->getLocales().hasElements() ) { xRet = xStringResourceResolver; } @@ -1806,7 +1806,7 @@ namespace pcr Any aListSourceValue( impl_getPropertyValue_throw( PROPERTY_LISTSOURCE ) ); if ( aListSourceValue >>= aListSource ) { - if ( aListSource.getLength() ) + if ( aListSource.hasElements() ) sListSource = aListSource[0]; } else @@ -1888,7 +1888,7 @@ namespace pcr { Sequence< OUString > aEntries; impl_getPropertyValue_throw( PROPERTY_STRINGITEMLIST ) >>= aEntries; - bool isEnabled = aEntries.getLength() != 0; + bool isEnabled = aEntries.hasElements(); if ( ( m_nClassId == FormComponentType::LISTBOX ) && ( m_eComponentClass == eFormControl ) ) { @@ -3103,7 +3103,7 @@ namespace pcr if ( aValue >>= aValueList ) { m_bPropertyValueIsList = true; - if ( aValueList.getLength() ) + if ( aValueList.hasElements() ) sValue = aValueList[0]; return sValue; } diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 7e91a0b79d51..267ab9bc6c78 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -468,7 +468,7 @@ namespace pcr Sequence< Property > aProperties; if ( xPSI.is() ) aProperties = xPSI->getProperties(); - DBG_ASSERT( aProperties.getLength(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); + DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); for ( auto const & property : aProperties ) { diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index 5f2a3a694248..f210b848df6a 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -113,7 +113,7 @@ namespace pcr void SAL_CALL ObjectInspectorModel::initialize( const Sequence< Any >& _arguments ) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_aFactories.getLength() ) + if ( m_aFactories.hasElements() ) throw AlreadyInitializedException(); StlSyntaxSequence< Any > arguments( _arguments ); @@ -185,14 +185,14 @@ namespace pcr void ObjectInspectorModel::createWithHandlerFactories( const Sequence< Any >& _rFactories ) { - impl_verifyArgument_throw( _rFactories.getLength() > 0, 1 ); + impl_verifyArgument_throw( _rFactories.hasElements(), 1 ); m_aFactories = _rFactories; } void ObjectInspectorModel::createWithHandlerFactoriesAndHelpSection( const Sequence< Any >& _rFactories, sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ) { - impl_verifyArgument_throw( _rFactories.getLength() > 0, 1 ); + impl_verifyArgument_throw( _rFactories.hasElements(), 1 ); impl_verifyArgument_throw( _nMinHelpTextLines >= 1, 2 ); impl_verifyArgument_throw( _nMaxHelpTextLines >= 1, 3 ); impl_verifyArgument_throw( _nMinHelpTextLines <= _nMaxHelpTextLines, 2 ); diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx index 9a596611330b..e200396a6c7e 100644 --- a/extensions/source/propctrlr/pcrcommon.hxx +++ b/extensions/source/propctrlr/pcrcommon.hxx @@ -93,7 +93,7 @@ namespace pcr iterator end() { return UnoBase::getArray() + UnoBase::getLength(); } sal_Int32 size() const { return UnoBase::getLength(); } - bool empty() const { return UnoBase::getLength() == 0; } + bool empty() const { return !UnoBase::hasElements(); } }; diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 1e45e28fe190..ca78d761124e 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -1218,7 +1218,7 @@ namespace pcr if ( !m_aPageIds.empty() ) { Sequence< PropertyCategoryDescriptor > aCategories( m_xModel->describeCategories() ); - if ( aCategories.getLength() ) + if ( aCategories.hasElements() ) m_pView->activatePage( m_aPageIds[ aCategories[0].ProgrammaticName ] ); else // allowed: if we default-created the pages ... diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index b28df28c0e0e..3d2fc67e0efb 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -280,7 +280,7 @@ OUString StringRepresentation::convertSimpleToString( const uno::Any& _rValue ) { try { - if ( m_aConstants.getLength() ) + if ( m_aConstants.hasElements() ) { sal_Int16 nConstantValue = 0; if ( _rValue >>= nConstantValue ) @@ -479,7 +479,7 @@ uno::Any StringRepresentation::convertStringToSimple( const OUString& _rValue,co { try { - if ( m_aConstants.getLength() && m_aValues.getLength() ) + if ( m_aConstants.hasElements() && m_aValues.hasElements() ) { const OUString* pIter = m_aValues.getConstArray(); const OUString* pEnd = pIter + m_aValues.getLength(); diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index 29c717491588..a1ae51b1f04c 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -1570,7 +1570,7 @@ CacheItem FilterCache::impl_loadItem(const css::uno::Reference< css::container:: css::uno::Sequence< OUString > &rNames = m_aTypeProps[eOption]; // read standard properties of a filter - if (rNames.getLength() > 0) + if (rNames.hasElements()) { css::uno::Reference< css::beans::XMultiPropertySet > xPropSet( xItem, css::uno::UNO_QUERY_THROW); @@ -1594,7 +1594,7 @@ CacheItem FilterCache::impl_loadItem(const css::uno::Reference< css::container:: css::uno::Sequence< OUString > &rNames = m_aStandardProps[eOption]; // read standard properties of a filter - if (rNames.getLength() > 0) + if (rNames.hasElements()) { css::uno::Reference< css::beans::XMultiPropertySet > xPropSet( xItem, css::uno::UNO_QUERY_THROW); diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index ed0246fcdf7c..0a9b2a4adf64 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -3068,7 +3068,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( rrProp.Value >>= aSegments ) { // creating seginfo - if ( static_cast<sal_uInt16>(aSegments.getLength()) ) + if ( aSegments.hasElements() ) { sal_uInt16 j, nElements = static_cast<sal_uInt16>(aSegments.getLength()); sal_uInt16 nElementSize = 2; @@ -3205,7 +3205,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT uno::Sequence<drawing::EnhancedCustomShapeTextFrame> aPathTextFrames; if ( rrProp.Value >>= aPathTextFrames ) { - if ( static_cast<sal_uInt16>(aPathTextFrames.getLength()) ) + if ( aPathTextFrames.hasElements() ) { sal_uInt16 j, nElements = static_cast<sal_uInt16>(aPathTextFrames.getLength()); sal_uInt16 nElementSize = 16; @@ -3657,7 +3657,7 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT if ( aPathCoordinatesProp >>= aCoordinates ) { // creating the vertices - if (aCoordinates.getLength() > 0) + if (aCoordinates.hasElements()) { sal_uInt16 j, nElements = static_cast<sal_uInt16>(aCoordinates.getLength()); sal_uInt16 nElementSize = 8; diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx index d36469fabf0d..ed49bff15a35 100644 --- a/filter/source/msfilter/mstoolbar.cxx +++ b/filter/source/msfilter/mstoolbar.cxx @@ -324,7 +324,7 @@ void TBCData::ImportToolBarControl( CustomToolBarImportHelper& helper, std::vect uno::Reference< ui::XImageManager > xImageManager( helper.getAppCfgManager()->getImageManager(), uno::UNO_QUERY_THROW ); // 0 = default image size uno::Sequence< uno::Reference< graphic::XGraphic > > sImages = xImageManager->getImages( 0, sCmds ); - if ( sImages.getLength() && sImages[0].is() ) + if ( sImages.hasElements() && sImages[0].is() ) helper.addIcon( sImages[0], sCommand ); } } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 9753f208b9c4..bae05fe1c394 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -301,11 +301,11 @@ void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) Reference< css::frame::XStorable > xStore( m_xSrcDoc, UNO_QUERY ); if( xStore.is() ) { - Sequence< beans::PropertyValue > aArgs( 2 + ((m_aPreparedPassword.getLength() > 0) ? 1 : 0) ); + Sequence< beans::PropertyValue > aArgs( 2 + (m_aPreparedPassword.hasElements() ? 1 : 0) ); aArgs.getArray()[0].Name = "FilterName"; aArgs.getArray()[1].Name = "OutputStream"; aArgs.getArray()[1].Value <<= xStream; - if( m_aPreparedPassword.getLength() ) + if( m_aPreparedPassword.hasElements() ) { aArgs.getArray()[2].Name = "EncryptionData"; aArgs.getArray()[2].Value <<= m_aPreparedPassword; @@ -740,7 +740,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aContext.Encryption.CanExtractForAccessibility = mbCanExtractForAccessibility; if( mbEncrypt && ! xEnc.is() ) xEnc = vcl::PDFWriter::InitEncryption( aPermissionPassword, aOpenPassword ); - if( mbEncrypt && !aPermissionPassword.isEmpty() && ! aPreparedPermissionPassword.getLength() ) + if( mbEncrypt && !aPermissionPassword.isEmpty() && ! aPreparedPermissionPassword.hasElements() ) aPreparedPermissionPassword = comphelper::OStorageHelper::CreatePackageEncryptionData( aPermissionPassword ); } // after this point we don't need the legacy clear passwords anymore diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index 872c515e0543..f7bed8855d72 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -71,7 +71,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) /* we don't get FilterData if we are exporting directly to pdf, but we have to use the last user settings (especially for the CompressMode) */ - if ( !aFilterData.getLength() ) + if ( !aFilterData.hasElements() ) { FilterConfigItem aCfgItem( "Office.Common/Filter/PDF/Export/" ); aCfgItem.ReadBool( "UseLosslessCompression", false ); diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index 4d0667e463e8..71d202d2eb24 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -335,8 +335,7 @@ void SAL_CALL XmlFilterAdaptor::setTargetDocument( const Reference< css::lang::X void SAL_CALL XmlFilterAdaptor::initialize( const Sequence< Any >& aArguments ) { Sequence < PropertyValue > aAnySeq; - sal_Int32 nLength = aArguments.getLength(); - if ( nLength && ( aArguments[0] >>= aAnySeq ) ) + if ( aArguments.hasElements() && ( aArguments[0] >>= aAnySeq ) ) { comphelper::SequenceAsHashMap aMap(aAnySeq); msFilterName = aMap.getUnpackedValueOrDefault( diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index a92913889217..2367a06b5441 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -1978,7 +1978,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners) if ( xParentColSupp.is() ) xParentCols = xParentColSupp->getColumns(); - if ( xParentCols.is() && xParentCols->hasElements() && m_aMasterFields.getLength() ) + if ( xParentCols.is() && xParentCols->hasElements() && m_aMasterFields.hasElements() ) { try { @@ -2211,7 +2211,7 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const css::a SolarMutexGuard aGuard; aData = GetDataMultiPartEncoded(Control, MouseEvt, aContentType); } - if (!aData.getLength()) + if (!aData.hasElements()) return; Sequence<PropertyValue> aArgs(3); diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 9194f846692f..9fd4406e7ded 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1133,7 +1133,7 @@ namespace frm Sequence< sal_Int16 > aSelectedIndices; OSL_VERIFY( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) >>= aSelectedIndices ); - if ( !aSelectedIndices.getLength() ) + if ( !aSelectedIndices.hasElements() ) // nothing selected at all return s_aEmptyValue; @@ -1276,7 +1276,7 @@ namespace frm Any OListBoxModel::getDefaultForReset() const { Any aValue; - if (m_aDefaultSelectSeq.getLength()) + if (m_aDefaultSelectSeq.hasElements()) aValue <<= m_aDefaultSelectSeq; else if (m_nNULLPos != -1) // bound Listbox { @@ -1755,7 +1755,7 @@ namespace frm } else { - if ( m_aDefaultSelectSeq.getLength() ) + if ( m_aDefaultSelectSeq.hasElements() ) setControlValue( makeAny( m_aDefaultSelectSeq ), eOther ); } } diff --git a/forms/source/component/entrylisthelper.cxx b/forms/source/component/entrylisthelper.cxx index fcb66644d6ca..a9c844e9a1e4 100644 --- a/forms/source/component/entrylisthelper.cxx +++ b/forms/source/component/entrylisthelper.cxx @@ -89,11 +89,11 @@ namespace frm if ( ( _rEvent.Position >= 0 ) && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) - && ( _rEvent.Entries.getLength() > 0 ) + && _rEvent.Entries.hasElements() ) { m_aStringItems[ _rEvent.Position ] = _rEvent.Entries[ 0 ]; - if (m_aTypedItems.getLength()) + if (m_aTypedItems.hasElements()) m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( aLock ); } @@ -106,16 +106,16 @@ namespace frm OSL_ENSURE( _rEvent.Source == m_xListSource, "OEntryListHelper::entryRangeInserted: where did this come from?" ); - OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) && ( _rEvent.Entries.getLength() > 0 ), + OSL_ENSURE( ( _rEvent.Position > 0 ) && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) && _rEvent.Entries.hasElements(), "OEntryListHelper::entryRangeRemoved: invalid count and/or position!" ); if ( ( _rEvent.Position > 0 ) && ( _rEvent.Position < static_cast<sal_Int32>(m_aStringItems.size()) ) - && ( _rEvent.Entries.getLength() > 0 ) + && _rEvent.Entries.hasElements() ) { m_aStringItems.insert(m_aStringItems.begin() + _rEvent.Position, _rEvent.Entries.begin(), _rEvent.Entries.end()); - if (m_aTypedItems.getLength()) + if (m_aTypedItems.hasElements()) m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( aLock ); } @@ -154,7 +154,7 @@ namespace frm } m_aTypedItems = aTmp; } - else if (m_aTypedItems.getLength()) + else if (m_aTypedItems.hasElements()) { m_aTypedItems = Sequence<Any>(); // doesn't match anymore } @@ -273,7 +273,7 @@ namespace frm else { comphelper::sequenceToContainer( m_aStringItems, m_xListSource->getAllListEntries()); - if (m_aTypedItems.getLength()) + if (m_aTypedItems.hasElements()) m_aTypedItems = Sequence<Any>(); } stringItemListChanged( _rInstanceLock ); @@ -297,7 +297,7 @@ namespace frm css::uno::Sequence<OUString> aTmp; OSL_VERIFY( _rValue >>= aTmp ); comphelper::sequenceToContainer(m_aStringItems, aTmp); - if (m_aTypedItems.getLength()) + if (m_aTypedItems.hasElements()) m_aTypedItems = Sequence<Any>(); // doesn't match anymore stringItemListChanged( _rInstanceLock ); } @@ -309,7 +309,7 @@ namespace frm if (!(_rValue >>= m_aTypedItems )) { OSL_VERIFY(false); - if (m_aTypedItems.getLength()) + if (m_aTypedItems.hasElements()) m_aTypedItems = Sequence<Any>(); // doesn't match anymore } // Sets both properties, assuming that TypedItemList belongs to StringItemList. diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index e4ddc4265113..d7ef5363cbe6 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -388,7 +388,7 @@ void OInterfaceContainer::transformEvents() // get the script events for this object aChildEvents = m_xEventAttacher->getScriptEvents( i ); - if ( aChildEvents.getLength() ) + if ( aChildEvents.hasElements() ) { // do the transformation ::std::for_each( aChildEvents.begin(), aChildEvents.end(), TransformEventTo52Format() ); diff --git a/forms/source/richtext/attributedispatcher.cxx b/forms/source/richtext/attributedispatcher.cxx index 98c9acf2b6c6..dd81f3129cc7 100644 --- a/forms/source/richtext/attributedispatcher.cxx +++ b/forms/source/richtext/attributedispatcher.cxx @@ -89,7 +89,7 @@ namespace frm checkDisposed(); OSL_ENSURE( _rURL.Complete == getFeatureURL().Complete, "OAttributeDispatcher::dispatch: invalid URL!" ); - SAL_WARN_IF( _rArguments.getLength(), "forms.richtext", + SAL_WARN_IF( _rArguments.hasElements(), "forms.richtext", "OAttributeDispatcher::dispatch: found arguments, but can't handle arguments at all" " (URL: " << _rURL.Complete << ")"); diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 889f21d8d724..269b4c301c41 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -989,7 +989,7 @@ OUString FormulaDlg_Impl::RepairFormula(const OUString& aFormula) { UpdateTokenArray(aFormula); - if ( m_aTokenList.getLength() ) + if ( m_aTokenList.hasElements() ) { const table::CellAddress aRefPos(m_pHelper->getReferencePosition()); const OUString sFormula( m_pHelper->getFormulaParser()->printFormula( m_aTokenList, aRefPos)); diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index baf8f20f3b23..723d8d3268c5 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -509,7 +509,7 @@ namespace svt Sequence < OUString > aTemplateList; _rValue >>= aTemplateList; - if ( aTemplateList.getLength() ) + if ( aTemplateList.hasElements() ) { for ( long i=0; i < aTemplateList.getLength(); i++ ) _pListbox->InsertEntry( aTemplateList[i] ); diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 8271b9a302c8..dddd0b8164fc 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -93,7 +93,7 @@ FilterEntry::FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFil bool FilterEntry::hasSubFilters( ) const { - return ( 0 < m_aSubFilters.getLength() ); + return m_aSubFilters.hasElements(); } @@ -910,7 +910,7 @@ void SAL_CALL SvtFilePicker::appendFilterGroup( const OUString& sGroupTitle, // ensure that we have a filter list OUString sInitialCurrentFilter; - if ( aFilters.getLength() ) + if ( aFilters.hasElements() ) sInitialCurrentFilter = aFilters[0].First; ensureFilterList( sInitialCurrentFilter ); @@ -978,7 +978,7 @@ void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments ) m_nServiceType = TemplateDescription::FILEOPEN_SIMPLE; - if ( _rArguments.getLength() >= 1 ) + if ( _rArguments.hasElements() ) { // compatibility: one argument, type sal_Int16 , specifies the service type int index = 0; diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index f0491762dde8..c22ebcbf9b3f 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -652,7 +652,7 @@ void RemoteFilesDialog::EnableControls() UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, Reference< XInteractionHandler>() ); - if( aURLEntries.UserList.getLength() ) + if( aURLEntries.UserList.hasElements() ) { m_pAddMenu->EnableItem( "change_password" ); } @@ -872,7 +872,7 @@ IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler ); - if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() ) + if( aURLEntries.Url == sUrl && aURLEntries.UserList.hasElements() ) { OUString sUserName = aURLEntries.UserList[0].UserName; @@ -914,7 +914,7 @@ IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, MenuButton *, pButton, void ) UrlRecord aURLEntries = m_xMasterPasswd->find( sUrl, xInteractionHandler ); - if( aURLEntries.Url == sUrl && aURLEntries.UserList.getLength() ) + if( aURLEntries.Url == sUrl && aURLEntries.UserList.hasElements() ) { OUString sUserName = aURLEntries.UserList[0].UserName; diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 1b9af10a8afc..09023554928e 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -290,7 +290,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) // NOTE: There is a race between checking this and connections being created/destroyed before // we close the frame / terminate the app. css::uno::Reference<css::bridge::XBridgeFactory2> bridgeFac( css::bridge::BridgeFactory::create(xContext) ); - bool bHasActiveConnections = bridgeFac->getExistingBridges().getLength() > 0; + bool bHasActiveConnections = bridgeFac->getExistingBridges().hasElements(); // a) If the current frame (where the close dispatch was requested for) does not have // any parent frame ... it will close this frame only. Such frame isn't part of the diff --git a/framework/source/dispatch/dispatchdisabler.cxx b/framework/source/dispatch/dispatchdisabler.cxx index 0ad5932c0251..76fe27d8cf4a 100644 --- a/framework/source/dispatch/dispatchdisabler.cxx +++ b/framework/source/dispatch/dispatchdisabler.cxx @@ -25,7 +25,7 @@ DispatchDisabler::DispatchDisabler(const uno::Reference< uno::XComponentContext void SAL_CALL DispatchDisabler::initialize( const uno::Sequence< uno::Any >& aArguments ) { uno::Sequence< OUString > aDisabledURLs; - if( aArguments.getLength() > 0 && + if( aArguments.hasElements() && ( aArguments[0] >>= aDisabledURLs ) ) { for( sal_Int32 i = 0; i < aDisabledURLs.getLength(); ++i ) diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index bca143bc92a3..c1ef179b0e69 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -57,7 +57,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL InterceptionHelper::queryD { for (auto const& lInterceptionReg : m_lInterceptionRegs) { - if (!lInterceptionReg.lURLPattern.getLength()) + if (!lInterceptionReg.lURLPattern.hasElements()) { // no pattern -> need to ask this guy! xInterceptor = lInterceptionReg.xInterceptor; diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index ebaf190b9a4d..1857d0480ff7 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -56,7 +56,7 @@ VclPtr<PopupMenu> AddonMenuManager::CreateAddonMenu( const Reference< XFrame >& sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START; const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aOptions.GetAddonsMenu(); - if ( rAddonMenuEntries.getLength() > 0 ) + if ( rAddonMenuEntries.hasElements() ) { pAddonMenu = VclPtr<PopupMenu>::Create(); OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier( rFrame ); @@ -170,7 +170,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, aAddonSubMenu ); if ( !aTitle.isEmpty() && !aURL.isEmpty() && - aAddonSubMenu.getLength() > 0 && + aAddonSubMenu.hasElements() && AddonMenuManager::IsCorrectContext( aModuleIdentifier, aContext )) { sal_uInt16 nId = nUniqueMenuId++; @@ -226,7 +226,7 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent else { VclPtr<PopupMenu> pSubMenu; - if ( aAddonSubMenu.getLength() > 0 ) + if ( aAddonSubMenu.hasElements() ) { pSubMenu = VclPtr<PopupMenu>::Create(); AddonMenuManager::BuildMenu( pSubMenu, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, rModuleIdentifier ); diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index f8f23ac94853..cab3879b2a90 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -430,7 +430,7 @@ void AddonsOptions_Impl::ImplCommit() bool AddonsOptions_Impl::HasAddonsMenu() const { - return ( m_aCachedMenuProperties.getLength() > 0 ); + return m_aCachedMenuProperties.hasElements(); } // public method @@ -1070,7 +1070,7 @@ bool AddonsOptions_Impl::ReadMenuItem( const OUString& aMenuNodeName, Sequence< OUString aRootSubMenuName( aAddonMenuItemTreeNode + m_aPropNames[ INDEX_SUBMENU ] ); Sequence< OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName ); - if ( aRootSubMenuNodeNames.getLength() > 0 && !bIgnoreSubMenu ) + if ( aRootSubMenuNodeNames.hasElements() && !bIgnoreSubMenu ) { // Set a unique prefixed Add-On popup menu URL so it can be identified later OUString aPopupMenuURL = GeneratePrefixURL(); @@ -1141,7 +1141,7 @@ bool AddonsOptions_Impl::ReadPopupMenu( const OUString& aPopupMenuNodeName, Sequ OUString aRootSubMenuName( aAddonPopupMenuTreeNode + m_aPropNames[ INDEX_SUBMENU ] ); Sequence< OUString > aRootSubMenuNodeNames = GetNodeNames( aRootSubMenuName ); - if ( aRootSubMenuNodeNames.getLength() > 0 ) + if ( aRootSubMenuNodeNames.hasElements() ) { // A top-level popup menu needs a title // Set a unique prefixed Add-On popup menu URL so it can be identified later @@ -1344,7 +1344,7 @@ std::unique_ptr<AddonsOptions_Impl::ImageEntry> AddonsOptions_Impl::ReadImageDat // Extract image data from the embedded hex binary sequence Image aImage; if (( aPropertyData[i] >>= aImageDataSeq ) && - aImageDataSeq.getLength() > 0 && + aImageDataSeq.hasElements() && ( CreateImageFromSequence( aImage, aImageDataSeq ) ) ) { if ( !pEntry ) @@ -1374,7 +1374,7 @@ bool AddonsOptions_Impl::CreateImageFromSequence( Image& rImage, Sequence< sal_I { bool bResult = false; - if ( rBitmapDataSeq.getLength() > 0 ) + if ( rBitmapDataSeq.hasElements() ) { SvMemoryStream aMemStream( rBitmapDataSeq.getArray(), rBitmapDataSeq.getLength(), StreamMode::STD_READ ); BitmapEx aBitmapEx; diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index 0a9bc906c5be..ed700fdced20 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -183,7 +183,7 @@ static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Refer } aDIBSeq = xBitmap->getMaskDIB(); - if ( aDIBSeq.getLength() > 0 ) + if ( aDIBSeq.hasElements() ) { Bitmap aMaskBitmap; SvMemoryStream aMem( const_cast<sal_Int8 *>(aDIBSeq.getConstArray()), aDIBSeq.getLength(), StreamMode::READ ); diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx index c991a8cc0774..f551aa40af7c 100644 --- a/framework/source/fwi/helper/mischelper.cxx +++ b/framework/source/fwi/helper/mischelper.cxx @@ -124,7 +124,7 @@ void FillLangItems( std::set< OUString > &rLangItems, if ( xDocumentLanguages.is() ) { Sequence< 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/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index ecec7f39d63c..aad137074d98 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -50,7 +50,7 @@ void SAL_CALL PersistentWindowState::initialize(const css::uno::Sequence< css::u { // check arguments css::uno::Reference< css::frame::XFrame > xFrame; - if (lArguments.getLength() < 1) + if (!lArguments.hasElements()) throw css::lang::IllegalArgumentException( "Empty argument list!", static_cast< ::cppu::OWeakObject* >(this), diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 540cc3d4ade5..ee33a646cadd 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -69,7 +69,7 @@ StatusIndicatorFactory::~StatusIndicatorFactory() void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::uno::Any >& lArguments) { - if (lArguments.getLength() > 0) { + if (lArguments.hasElements()) { osl::MutexGuard g(m_mutex); css::uno::Reference< css::frame::XFrame > xTmpFrame; diff --git a/framework/source/helper/tagwindowasmodified.cxx b/framework/source/helper/tagwindowasmodified.cxx index bb2f3958cae8..3c40842dd6fa 100644 --- a/framework/source/helper/tagwindowasmodified.cxx +++ b/framework/source/helper/tagwindowasmodified.cxx @@ -49,7 +49,7 @@ void SAL_CALL TagWindowAsModified::initialize(const css::uno::Sequence< css::uno { css::uno::Reference< css::frame::XFrame > xFrame; - if (lArguments.getLength() > 0) + if (lArguments.hasElements()) lArguments[0] >>= xFrame; if ( ! xFrame.is ()) diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 0ab7dee17235..9536485f66d5 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -63,7 +63,7 @@ void SAL_CALL TitleBarUpdate::initialize(const css::uno::Sequence< css::uno::Any { // check arguments css::uno::Reference< css::frame::XFrame > xFrame; - if (lArguments.getLength() < 1) + if (!lArguments.hasElements()) throw css::lang::IllegalArgumentException( "Empty argument list!", static_cast< ::cppu::OWeakObject* >(this), diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 6a801850b375..e693c6eff38b 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -378,7 +378,7 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c /* } SAFE */ // Add all valid (not empty) lists to the return list - if (lConfigArgs.getLength()>0) + if (lConfigArgs.hasElements()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); @@ -392,14 +392,14 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c lAllArgs[nLength].Name = "JobConfig"; lAllArgs[nLength].Value <<= comphelper::containerToSequence(lJobConfigArgs); } - if (lEnvArgs.getLength()>0) + if (lEnvArgs.hasElements()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); lAllArgs[nLength].Name = "Environment"; lAllArgs[nLength].Value <<= lEnvArgs; } - if (lDynamicArgs.getLength()>0) + if (lDynamicArgs.hasElements()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index d5708db9e895..493278ddf3ad 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1233,7 +1233,7 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() { uno::Sequence< OUString > aToolbarNames = xPersistentWindowState->getElementNames(); - if ( aToolbarNames.getLength() > 0 ) + if ( aToolbarNames.hasElements() ) { OUString aElementType; OUString aElementName; diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index a5a0e93ee292..d58883e83fe3 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -1903,7 +1903,7 @@ void AutoRecovery::implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocume OUString sTypeRegistration = lFilterProps.getUnpackedValueOrDefault(FILTER_PROP_TYPE, OUString()); ::comphelper::SequenceAsHashMap lTypeProps (xTypeCFG->getByName(sTypeRegistration)); css::uno::Sequence< OUString > lExtensions = lTypeProps.getUnpackedValueOrDefault(TYPE_PROP_EXTENSIONS, css::uno::Sequence< OUString >()); - if (lExtensions.getLength()) + if (lExtensions.hasElements()) { rInfo.Extension = "." + lExtensions[0]; } @@ -2997,7 +2997,7 @@ void AutoRecovery::implts_saveOneDoc(const OUString& css::uno::Sequence< css::beans::NamedValue > aEncryptionData = lOldArgs.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ENCRYPTIONDATA(), css::uno::Sequence< css::beans::NamedValue >()); - if (aEncryptionData.getLength() > 0) + if (aEncryptionData.hasElements()) lNewArgs[utl::MediaDescriptor::PROP_ENCRYPTIONDATA()] <<= aEncryptionData; // Further it must be saved using the default file format of that application. @@ -3355,7 +3355,7 @@ void AutoRecovery::implts_openOneDoc(const OUString& sURL , // re-create all the views ::std::vector< OUString > aViewsToRestore( rInfo.ViewNames.getLength() ); - if ( rInfo.ViewNames.getLength() ) + if ( rInfo.ViewNames.hasElements() ) ::std::copy( rInfo.ViewNames.begin(), rInfo.ViewNames.end(), aViewsToRestore.begin() ); // if we don't have views for whatever reason, then create a default-view, at least if ( aViewsToRestore.empty() ) diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index 6fa345c339cd..b1be64620b0f 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -234,7 +234,7 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any >& args) OUString aSMgr("com.sun.star.frame.SessionManagerClient"); if ( (args.getLength() == 1) && (args[0] >>= m_bAllowUserInteractionOnQuit) ) ;// do nothing - else if (args.getLength() > 0) + else if (args.hasElements()) { NamedValue v; for (int i = 0; i < args.getLength(); i++) diff --git a/framework/source/uiconfiguration/graphicnameaccess.cxx b/framework/source/uiconfiguration/graphicnameaccess.cxx index fbc1d8ed43f2..809cc88b877c 100644 --- a/framework/source/uiconfiguration/graphicnameaccess.cxx +++ b/framework/source/uiconfiguration/graphicnameaccess.cxx @@ -50,7 +50,7 @@ uno::Any SAL_CALL GraphicNameAccess::getByName( const OUString& aName ) uno::Sequence< OUString > SAL_CALL GraphicNameAccess::getElementNames() { - if ( m_aSeq.getLength() == 0 ) + if ( !m_aSeq.hasElements() ) { m_aSeq = comphelper::mapKeysToSequence(m_aNameToElementMap); } diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index 379f2a4d16be..1e9d37e6ce1c 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -101,7 +101,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument } Reference< XFrame > xFrame( m_xWeakFrame ); - if ( xFrame.is() && m_aConfigData.getLength() > 0 ) + if ( xFrame.is() && m_aConfigData.hasElements() ) { // Create VCL based toolbar which will be filled with settings data VclPtr<ToolBox> pToolBar; @@ -122,7 +122,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument try { - if (( m_aConfigData.getLength() > 0 ) && pToolBar && pToolBarManager ) + if ( m_aConfigData.hasElements() && pToolBar && pToolBarManager ) { // Fill toolbar with container contents pToolBarManager->FillToolbar( m_aConfigData ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index e64eb89944ce..16502d124de6 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1254,7 +1254,7 @@ void ToolBarManager::RequestImages() while ( pIter != pEnd ) { Image aImage; - if ( aDocGraphicSeq.getLength() > 0 ) + if ( aDocGraphicSeq.hasElements() ) aImage = Image( aDocGraphicSeq[i] ); if ( !aImage ) { diff --git a/framework/source/uifactory/addonstoolbarfactory.cxx b/framework/source/uifactory/addonstoolbarfactory.cxx index 4f97fa4ebcb8..a9b895589202 100644 --- a/framework/source/uifactory/addonstoolbarfactory.cxx +++ b/framework/source/uifactory/addonstoolbarfactory.cxx @@ -181,7 +181,7 @@ Reference< XUIElement > SAL_CALL AddonsToolBarFactory::createUIElement( // Identify frame and determine module identifier to look for context based buttons Reference< css::ui::XUIElement > xToolBar; if ( xFrame.is() && - ( aConfigData.getLength()> 0 ) && + aConfigData.hasElements() && hasButtonsInContext( aConfigData, xFrame )) { PropertyValue aPropValue; diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index 5bf55607ab5d..3660c89e6e46 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -166,7 +166,7 @@ OUString SAL_CALL IndexEntrySupplier::getIndexFollowPageWord( sal_Bool bMorePage Sequence< OUString > aFollowPageWords = LocaleDataImpl::get()->getFollowPageWords(rLocale); return (bMorePages && aFollowPageWords.getLength() > 1) ? - aFollowPageWords[1] : (aFollowPageWords.getLength() > 0 ? + aFollowPageWords[1] : (aFollowPageWords.hasElements() ? aFollowPageWords[0] : OUString()); } diff --git a/i18npool/source/indexentry/indexentrysupplier_default.cxx b/i18npool/source/indexentry/indexentrysupplier_default.cxx index 2dc123822e07..186f3a511f59 100644 --- a/i18npool/source/indexentry/indexentrysupplier_default.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_default.cxx @@ -258,9 +258,9 @@ void Index::init(const lang::Locale &rLocale, const OUString& algorithm) Sequence< UnicodeScript > scriptList = LocaleDataImpl::get()->getUnicodeScripts( rLocale ); - if (scriptList.getLength() == 0) { + if (!scriptList.hasElements()) { scriptList = LocaleDataImpl::get()->getUnicodeScripts(LOCALE_EN); - if (scriptList.getLength() == 0) + if (!scriptList.hasElements()) throw RuntimeException(); } diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 454c4045ddef..91808eebdb77 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -673,7 +673,7 @@ Sequence< CalendarItem2 > &LocaleDataImpl::getCalendarItemByName(const OUString& // Referred locale not found, return name for en_US locale. if (index == cals.getLength()) { cals = getAllCalendars2( Locale("en", "US", OUString()) ); - if (cals.getLength() <= 0) + if (!cals.hasElements()) throw RuntimeException(); ref_cal = cals[0]; } diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx index c9ca672edd3d..3f7ff96d8a15 100644 --- a/i18npool/source/textconversion/textconversion_zh.cxx +++ b/i18npool/source/textconversion/textconversion_zh.cxx @@ -193,8 +193,8 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, // catch all other exceptions to allow // querying the system dictionary in the next line } - if (conversions.getLength() > 0) { - if (offset.getLength() > 0) { + if (conversions.hasElements()) { + if (offset.hasElements()) { if (word.getLength() != conversions[0].getLength()) one2one=false; while (current < conversions[0].getLength()) { @@ -229,7 +229,7 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, else // Simplified/Traditionary conversion, forwards search for next word current = entry[current] + word.getLength() + 1; sal_Int32 start=current; - if (offset.getLength() > 0) { + if (offset.hasElements()) { if (word.getLength() != OUString(&wordData[current]).getLength()) one2one=false; sal_Int32 convertedLength=OUString(&wordData[current]).getLength(); @@ -250,14 +250,14 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, } } if (!found) { - if (offset.getLength() > 0) + if (offset.hasElements()) offset[count]=nStartPos+currPos; newStr[count++] = getOneCharConversion(aText[nStartPos+currPos], charData, charIndex); currPos++; } } - if (offset.getLength() > 0) + if (offset.hasElements()) offset.realloc(one2one ? 0 : count); OUString aRet(newStr.get(), count); return aRet; diff --git a/include/comphelper/proparrhlp.hxx b/include/comphelper/proparrhlp.hxx index 5d9cb97f9c11..1c755188ef6e 100644 --- a/include/comphelper/proparrhlp.hxx +++ b/include/comphelper/proparrhlp.hxx @@ -130,7 +130,7 @@ template <class TYPE> inline css::uno::Sequence< css::beans::Property > aProps; css::uno::Sequence< css::beans::Property > aAggregateProps; fillProperties(aProps, aAggregateProps); - OSL_ENSURE(aProps.getLength(), "OAggregationArrayUsageHelper::createArrayHelper : fillProperties returned nonsense !"); + OSL_ENSURE(aProps.hasElements(), "OAggregationArrayUsageHelper::createArrayHelper : fillProperties returned nonsense !"); return new OPropertyArrayAggregationHelper(aProps, aAggregateProps, nullptr, DEFAULT_AGGREGATE_PROPERTY_ID); } diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 744be743c7d5..b03a7a242a92 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -99,7 +99,7 @@ public: const css::uno::Reference< css::document::XDocumentProperties> & i_xDocProps, bool i_bDoNotUpdateUserDefined = false) const; - bool isCmisDocument() const { return m_aCmisProperties.getLength() > 0;} + bool isCmisDocument() const { return m_aCmisProperties.hasElements();} bool isAutoloadEnabled() const { return m_isAutoloadEnabled; } void setAutoloadEnabled(bool i_val) { m_isAutoloadEnabled = i_val; } |