diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-25 10:56:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-04-25 11:57:07 +0200 |
commit | a5810faae384f7f73e8e835c1f536785a60881d2 (patch) | |
tree | 32586f5af184c764d103e64c3c31b366f421c832 | |
parent | cafc53f8b4c08443524b1da6f4918d49afd45bb5 (diff) |
clang-tidy modernize-loop-convert in d*
Change-Id: I0830a41b48e884ef63d32b5873c7007195659bb9
39 files changed, 187 insertions, 196 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 42913cefdb1b..18a95db85ec2 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1746,11 +1746,11 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS OUString(PROPERTY_ALIGN), OUString(PROPERTY_RELATIVEPOSITION), OUString(PROPERTY_WIDTH), OUString(PROPERTY_HIDDEN), OUString(PROPERTY_CONTROLMODEL), OUString(PROPERTY_HELPTEXT), OUString(PROPERTY_CONTROLDEFAULT) }; - for ( size_t i=0; i<SAL_N_ELEMENTS( aPropertyNames ); ++i ) + for (const auto & aPropertyName : aPropertyNames) { - if ( xInfo->hasPropertyByName( aPropertyNames[i] ) ) + if ( xInfo->hasPropertyByName( aPropertyName ) ) { - _rxRowSetColumn->setPropertyValue( aPropertyNames[i], _rxTemplateColumn->getPropertyValue( aPropertyNames[i] ) ); + _rxRowSetColumn->setPropertyValue( aPropertyName, _rxTemplateColumn->getPropertyValue( aPropertyName ) ); bHaveAnyColumnSetting = true; } } diff --git a/dbaccess/source/core/api/columnsettings.cxx b/dbaccess/source/core/api/columnsettings.cxx index 7449c320500f..860ed7d36617 100644 --- a/dbaccess/source/core/api/columnsettings.cxx +++ b/dbaccess/source/core/api/columnsettings.cxx @@ -132,10 +132,10 @@ namespace dbaccess { OUString(PROPERTY_HIDDEN), PROPERTY_ID_HIDDEN } }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) + for (const auto & aProp : aProps) { - if ( xPSI->hasPropertyByName( aProps[i].sName ) ) - if ( !isDefaulted( aProps[i].nHandle, _rxColumn->getPropertyValue( aProps[i].sName ) ) ) + if ( xPSI->hasPropertyByName( aProp.sName ) ) + if ( !isDefaulted( aProp.nHandle, _rxColumn->getPropertyValue( aProp.sName ) ) ) return false; } } diff --git a/dbaccess/source/core/api/definitioncolumn.cxx b/dbaccess/source/core/api/definitioncolumn.cxx index 435e99576360..c8d7e9dc6e2f 100644 --- a/dbaccess/source/core/api/definitioncolumn.cxx +++ b/dbaccess/source/core/api/definitioncolumn.cxx @@ -200,10 +200,10 @@ OQueryColumn::OQueryColumn( const Reference< XPropertySet >& _rxParserColumn, co { OUString(PROPERTY_TABLENAME), PROPERTY_ID_TABLENAME }, { OUString(PROPERTY_REALNAME), PROPERTY_ID_REALNAME } }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aProps ); ++i ) + for (const auto & aProp : aProps) { - if ( xPSI->hasPropertyByName( aProps[i].sName ) ) - setFastPropertyValue_NoBroadcast( aProps[i].nHandle, _rxParserColumn->getPropertyValue( aProps[i].sName ) ); + if ( xPSI->hasPropertyByName( aProp.sName ) ) + setFastPropertyValue_NoBroadcast( aProp.nHandle, _rxParserColumn->getPropertyValue( aProp.sName ) ); } // determine the table column we're based on diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 9eefaffbd9b7..e421a2b71dd6 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1476,12 +1476,12 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property { "RecoveryStorage" }; - for ( size_t i=0; i < SAL_N_ELEMENTS( pObjectDescriptorArgs ); ++i ) + for (const char* pObjectDescriptorArg : pObjectDescriptorArgs) { - if ( aOpenCommandArguments.has( pObjectDescriptorArgs[i] ) ) + if ( aOpenCommandArguments.has( pObjectDescriptorArg ) ) { - o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArgs[i], aOpenCommandArguments.get( pObjectDescriptorArgs[i] ) ); - aOpenCommandArguments.remove( pObjectDescriptorArgs[i] ); + o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArg, aOpenCommandArguments.get( pObjectDescriptorArg ) ); + aOpenCommandArguments.remove( pObjectDescriptorArg ); } } diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index ebd05ab9203b..87b16061df8c 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -411,11 +411,11 @@ DATASOURCE_TYPE ODsnTypeCollection::determineType(const OUString& _rDsn) const KnownPrefix( "sdbc:address:macab", DST_MACAB, true ) }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aKnowPrefixes ); ++i ) + for (const auto & aKnowPrefixe : aKnowPrefixes) { - if( aKnowPrefixes[i].match(sDsn) ) + if( aKnowPrefixe.match(sDsn) ) { - return aKnowPrefixes[i].eType; + return aKnowPrefixe.eType; } } diff --git a/dbaccess/source/core/recovery/dbdocrecovery.cxx b/dbaccess/source/core/recovery/dbdocrecovery.cxx index 814a2504256c..b081b63547b6 100644 --- a/dbaccess/source/core/recovery/dbdocrecovery.cxx +++ b/dbaccess/source/core/recovery/dbdocrecovery.cxx @@ -291,14 +291,14 @@ namespace dbaccess // read the map from sub storages to object names MapCompTypeToCompDescs aMapCompDescs; const SubComponentType aKnownTypes[] = { TABLE, QUERY, FORM, REPORT, RELATION_DESIGN }; - for ( size_t i = 0; i < SAL_N_ELEMENTS( aKnownTypes ); ++i ) + for (SubComponentType aKnownType : aKnownTypes) { - if ( !xRecoveryStorage->hasByName( SubComponentRecovery::getComponentsStorageName( aKnownTypes[i] ) ) ) + if ( !xRecoveryStorage->hasByName( SubComponentRecovery::getComponentsStorageName( aKnownType ) ) ) continue; Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement( - SubComponentRecovery::getComponentsStorageName( aKnownTypes[i] ), ElementModes::READ ) ); - lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownTypes[i] ] ); + SubComponentRecovery::getComponentsStorageName( aKnownType ), ElementModes::READ ) ); + lcl_readObjectMap_throw( m_pData->aContext, xComponentsStor, aMapCompDescs[ aKnownType ] ); xComponentsStor->dispose(); } diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index 5564edcedda8..e2c09925293c 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -194,11 +194,11 @@ namespace dbmm LanguageMapping( "Python", ePython ), // TODO: is this correct? LanguageMapping( "Basic", eBasic ) }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aLanguageMapping ); ++i ) + for (const LanguageMapping& i : aLanguageMapping) { - if ( _rLanguage.equalsAscii( aLanguageMapping[i].pAsciiLanguage ) ) + if ( _rLanguage.equalsAscii( i.pAsciiLanguage ) ) { - _out_rScriptType = aLanguageMapping[i].eScriptType; + _out_rScriptType = i.eScriptType; return true; } } @@ -1195,8 +1195,8 @@ namespace dbmm const ScriptType aKnownStorageBasedTypes[] = { eBeanShell, eJavaScript, ePython, eJava }; - for ( size_t i=0; i<SAL_N_ELEMENTS( aKnownStorageBasedTypes ); ++i ) - aElementNames.erase( lcl_getScriptsSubStorageName( aKnownStorageBasedTypes[i] ) ); + for (ScriptType aKnownStorageBasedType : aKnownStorageBasedTypes) + aElementNames.erase( lcl_getScriptsSubStorageName( aKnownStorageBasedType ) ); if ( !aElementNames.empty() ) { diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 0de7d581fb7d..d1863990e9b7 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -364,14 +364,14 @@ void ODBExport::exportDataSource() }; bool bIsXMLDefault = false; - for ( size_t i=0; i < SAL_N_ELEMENTS( aTokens ); ++i ) + for (const auto & aToken : aTokens) { - if ( pProperties->Name == aTokens[i].sPropertyName ) + if ( pProperties->Name == aToken.sPropertyName ) { - eToken = aTokens[i].eAttributeToken; + eToken = aToken.eAttributeToken; - if ( !!aTokens[i].aXMLDefault - && ( sValue == *aTokens[i].aXMLDefault ) + if ( !!aToken.aXMLDefault + && ( sValue == *aToken.aXMLDefault ) ) { bIsXMLDefault = true; @@ -498,9 +498,9 @@ void ODBExport::exportApplicationConnectionSettings(const TSettingsMap& _aSettin ,XML_MAX_ROW_COUNT ,XML_SUPPRESS_VERSION_COLUMNS }; - for (size_t i = 0; i< SAL_N_ELEMENTS(pSettings); ++i) + for (::xmloff::token::XMLTokenEnum pSetting : pSettings) { - TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]); + TSettingsMap::const_iterator aFind = _aSettings.find(pSetting); if ( aFind != _aSettings.end() ) AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second); } @@ -531,9 +531,9 @@ void ODBExport::exportDriverSettings(const TSettingsMap& _aSettings) ,XML_IS_FIRST_ROW_HEADER_LINE ,XML_PARAMETER_NAME_SUBSTITUTION }; - for (size_t i = 0; i< SAL_N_ELEMENTS(pSettings); ++i) + for (::xmloff::token::XMLTokenEnum pSetting : pSettings) { - TSettingsMap::const_iterator aFind = _aSettings.find(pSettings[i]); + TSettingsMap::const_iterator aFind = _aSettings.find(pSetting); if ( aFind != _aSettings.end() ) AddAttribute(XML_NAMESPACE_DB, aFind->first,aFind->second); } @@ -1132,11 +1132,11 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) }; ::std::vector< XMLPropertyState > aPropertyStates; - for (size_t i = 0 ; i < SAL_N_ELEMENTS(pExportHelper); ++i) + for (const auto & i : pExportHelper) { - aPropertyStates = pExportHelper[i].first->Filter(_xProp); + aPropertyStates = i.first->Filter(_xProp); if ( !aPropertyStates.empty() ) - pExportHelper[i].second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( pExportHelper[i].second.second, aPropertyStates ))); + i.second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( i.second.second, aPropertyStates ))); } Reference< XNameAccess > xCollection; @@ -1177,14 +1177,14 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) TExportPropMapperPair(m_xColumnExportHelper,TEnumMapperPair(&m_aAutoStyleNames,XML_STYLE_FAMILY_TABLE_COLUMN )) ,TExportPropMapperPair(m_xCellExportHelper,TEnumMapperPair(&m_aCellAutoStyleNames,XML_STYLE_FAMILY_TABLE_CELL)) }; - for (size_t i = 0 ; i < SAL_N_ELEMENTS(pExportHelper); ++i) + for (const auto & i : pExportHelper) { - ::std::vector< XMLPropertyState > aPropStates = pExportHelper[i].first->Filter( _xProp ); + ::std::vector< XMLPropertyState > aPropStates = i.first->Filter( _xProp ); if ( !aPropStates.empty() ) { ::std::vector< XMLPropertyState >::iterator aItr = aPropStates.begin(); ::std::vector< XMLPropertyState >::const_iterator aEnd = aPropStates.end(); - const rtl::Reference < XMLPropertySetMapper >& pStyle = pExportHelper[i].first->getPropertySetMapper(); + const rtl::Reference < XMLPropertySetMapper >& pStyle = i.first->getPropertySetMapper(); while ( aItr != aEnd ) { if ( aItr->mnIndex != -1 ) @@ -1208,10 +1208,10 @@ void ODBExport::exportAutoStyle(XPropertySet* _xProp) } } - if ( XML_STYLE_FAMILY_TABLE_CELL == pExportHelper[i].second.second ) + if ( XML_STYLE_FAMILY_TABLE_CELL == i.second.second ) ::std::copy( m_aCurrentPropertyStates.begin(), m_aCurrentPropertyStates.end(), ::std::back_inserter( aPropStates )); if ( !aPropStates.empty() ) - pExportHelper[i].second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( pExportHelper[i].second.second, aPropStates ))); + i.second.first->insert( TPropertyStyleMap::value_type(_xProp,GetAutoStylePool()->Add( i.second.second, aPropStates ))); } } } diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 071cbab7713e..d6b962767077 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2646,9 +2646,9 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > { if ( m_xDataSource.is() ) { - for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i ) + for (const auto & aPropertyName : aPropertyNames) { - m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this ); + m_xDataSource->removePropertyChangeListener( aPropertyName, this ); } } @@ -2669,9 +2669,9 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > { if ( m_xDataSource.is() ) { - for ( size_t i=0; i < SAL_N_ELEMENTS( aPropertyNames ); ++i ) + for (const auto & aPropertyName : aPropertyNames) { - m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this ); + m_xDataSource->addPropertyChangeListener( aPropertyName, this ); } } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 3c96e67237ec..aaabfb2bb024 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -212,8 +212,8 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo m_xWindow = VCLUnoHelper::GetInterface( m_pTablePreview ); SetUniqueId(UID_APP_DETAILPAGE_HELPER); - for (int i=0; i < E_ELEMENT_TYPE_COUNT; ++i) - m_pLists[i] = nullptr; + for (VclPtr<DBTreeListBox> & m_pList : m_pLists) + m_pList = nullptr; ImplInitSettings(); } @@ -235,14 +235,14 @@ void OAppDetailPageHelper::dispose() OSL_FAIL("Exception thrown while disposing preview frame!"); } - for (int i=0; i < E_ELEMENT_TYPE_COUNT; ++i) + for (VclPtr<DBTreeListBox> & m_pList : m_pLists) { - if ( m_pLists[i] ) + if ( m_pList ) { - m_pLists[i]->clearCurrentSelection(); - m_pLists[i]->Hide(); - m_pLists[i]->clearCurrentSelection(); // why a second time? - m_pLists[i].disposeAndClear(); + m_pList->clearCurrentSelection(); + m_pList->Hide(); + m_pList->clearCurrentSelection(); // why a second time? + m_pList.disposeAndClear(); } } m_aMenu.reset(); @@ -764,10 +764,10 @@ DBTreeListBox* OAppDetailPageHelper::createTree( DBTreeListBox* _pTreeView, cons void OAppDetailPageHelper::clearPages() { showPreview(nullptr); - for (size_t i=0; i < E_ELEMENT_TYPE_COUNT; ++i) + for (VclPtr<DBTreeListBox> & m_pList : m_pLists) { - if ( m_pLists[i] ) - m_pLists[i]->Clear(); + if ( m_pList ) + m_pList->Clear(); } } @@ -1156,9 +1156,9 @@ IMPL_LINK_NOARG_TYPED(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, void) , SID_DB_APP_VIEW_DOCINFO_PREVIEW }; - for(size_t i=0; i < SAL_N_ELEMENTS(pActions);++i) + for(unsigned short pAction : pActions) { - aMenu->CheckItem(pActions[i],m_aMenu->IsItemChecked(pActions[i])); + aMenu->CheckItem(pAction,m_aMenu->IsItemChecked(pAction)); } aMenu->EnableItem( SID_DB_APP_VIEW_DOCINFO_PREVIEW, getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) ); diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx index d0c0fde00dd5..078b2245bce3 100644 --- a/dbaccess/source/ui/app/AppIconControl.cxx +++ b/dbaccess/source/ui/app/AppIconControl.cxx @@ -47,13 +47,13 @@ OApplicationIconControl::OApplicationIconControl(vcl::Window* _pParent) { RID_STR_FORMS_CONTAINER, E_FORM, IMG_FORMFOLDER_TREE_L }, { RID_STR_REPORTS_CONTAINER, E_REPORT, IMG_REPORTFOLDER_TREE_L } }; - for ( size_t i=0; i < SAL_N_ELEMENTS(aCategories); ++i) + for (const CategoryDescriptor& aCategorie : aCategories) { SvxIconChoiceCtrlEntry* pEntry = InsertEntry( - OUString( ModuleRes( aCategories[i].nLabelResId ) ) , - Image( ModuleRes( aCategories[i].nImageResId ) ) ); + OUString( ModuleRes( aCategorie.nLabelResId ) ) , + Image( ModuleRes( aCategorie.nImageResId ) ) ); if ( pEntry ) - pEntry->SetUserData( new ElementType( aCategories[i].eType ) ); + pEntry->SetUserData( new ElementType( aCategorie.eType ) ); } SetChoiceWithCursor(); diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx index cb2f0526295a..7c89754c0da0 100644 --- a/dbaccess/source/ui/app/AppTitleWindow.cxx +++ b/dbaccess/source/ui/app/AppTitleWindow.cxx @@ -41,14 +41,14 @@ OTitleWindow::OTitleWindow(vcl::Window* _pParent,sal_uInt16 _nTitleId,WinBits _n const StyleSettings& rStyle = Application::GetSettings().GetStyleSettings(); vcl::Window* pWindows[] = { m_aSpace1.get(), m_aSpace2.get(), m_aTitle.get() }; - for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i) + for (vcl::Window* pWindow : pWindows) { - vcl::Font aFont = pWindows[i]->GetControlFont(); + vcl::Font aFont = pWindow->GetControlFont(); aFont.SetWeight(WEIGHT_BOLD); - pWindows[i]->SetControlFont(aFont); - pWindows[i]->SetControlForeground(rStyle.GetLightColor()); - pWindows[i]->SetControlBackground(rStyle.GetShadowColor()); - pWindows[i]->Show(); + pWindow->SetControlFont(aFont); + pWindow->SetControlForeground(rStyle.GetLightColor()); + pWindow->SetControlBackground(rStyle.GetShadowColor()); + pWindow->Show(); } } diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 2d74d33f3945..d8efde54c7f2 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -174,12 +174,12 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU Reference< XController2 > xController; const OUString sComponentURL( aParser.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); - for ( size_t i=0; i < SAL_N_ELEMENTS( aImplementations ); ++i ) + for (const ServiceNameToImplName& aImplementation : aImplementations) { - if ( sComponentURL.equalsAscii( aImplementations[i].pAsciiServiceName ) ) + if ( sComponentURL.equalsAscii( aImplementation.pAsciiServiceName ) ) { xController.set( m_xContext->getServiceManager()-> - createInstanceWithContext( OUString::createFromAscii( aImplementations[i].pAsciiImplementationName ), m_xContext), UNO_QUERY_THROW ); + createInstanceWithContext( OUString::createFromAscii( aImplementation.pAsciiImplementationName ), m_xContext), UNO_QUERY_THROW ); break; } } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 7005c727c2d2..e33ada455982 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -542,11 +542,11 @@ bool SbaTableQueryBrowser::InitializeForm( const Reference< XPropertySet > & i_f OUString(PROPERTY_HAVING_CLAUSE), OUString(PROPERTY_ORDER) }; - for (size_t i = 0; i < SAL_N_ELEMENTS(aTransferProperties); ++i) + for (const auto & aTransferPropertie : aTransferProperties) { - if ( !xPSI->hasPropertyByName( aTransferProperties[i] ) ) + if ( !xPSI->hasPropertyByName( aTransferPropertie ) ) continue; - aPropertyValues.put( aTransferProperties[i], pData->xObjectProperties->getPropertyValue( aTransferProperties[i] ) ); + aPropertyValues.put( aTransferPropertie, pData->xObjectProperties->getPropertyValue( aTransferPropertie ) ); } ::std::vector< OUString > aNames( aPropertyValues.getNames() ); diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 20e1d9180969..dbd43d7ff597 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -275,8 +275,8 @@ void OFieldDescControl::CheckScrollBars() // horizontal : long lMaxXPosition = 0; Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(ppAggregates); ++i) - getMaxXPosition(ppAggregates[i],lMaxXPosition); + for (Control* ppAggregate : ppAggregates) + getMaxXPosition(ppAggregate,lMaxXPosition); lMaxXPosition += m_pHorzScroll->GetThumbPos() * HSCROLL_STEP; @@ -399,8 +399,8 @@ sal_uInt16 OFieldDescControl::CountActiveAggregates() const { Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; sal_uInt16 nVisibleAggregates = 0; - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(ppAggregates); ++i) - if (ppAggregates[i]) + for (Control* pAggregate : ppAggregates) + if (pAggregate) ++nVisibleAggregates; return nVisibleAggregates; } @@ -409,11 +409,11 @@ sal_Int32 OFieldDescControl::GetMaxControlHeight() const { Size aHeight; Control* ppAggregates[] = { pRequired, pNumType, pAutoIncrement, pDefault, pTextLen, pLength, pScale, pFormat, m_pColumnName, m_pType,m_pAutoIncrementValue}; - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(ppAggregates); ++i) + for (Control* pAggregate : ppAggregates) { - if ( ppAggregates[i] ) + if ( pAggregate ) { - const Size aTemp(ppAggregates[i]->GetOptimalSize()); + const Size aTemp(pAggregate->GetOptimalSize()); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); } @@ -662,11 +662,11 @@ void OFieldDescControl::ArrangeAggregates() }; long nMaxWidth = 0; - for (size_t i=0; i<SAL_N_ELEMENTS(adAggregates); i++) + for (const AGGREGATE_DESCRIPTION & adAggregate : adAggregates) { - if (adAggregates[i].pctrlTextControl) + if (adAggregate.pctrlTextControl) { - nMaxWidth = ::std::max<long>(OutputDevice::GetTextWidth(adAggregates[i].pctrlTextControl->GetText()),nMaxWidth); + nMaxWidth = ::std::max<long>(OutputDevice::GetTextWidth(adAggregate.pctrlTextControl->GetText()),nMaxWidth); } } @@ -675,19 +675,19 @@ void OFieldDescControl::ArrangeAggregates() // And go ... int nCurrentControlPos = 0; Control* pZOrderPredecessor = nullptr; - for (size_t i=0; i<SAL_N_ELEMENTS(adAggregates); i++) + for (AGGREGATE_DESCRIPTION & adAggregate : adAggregates) { - if (adAggregates[i].pctrlInputControl) + if (adAggregate.pctrlInputControl) { - SetPosSize(adAggregates[i].pctrlTextControl, nCurrentControlPos, 0); - SetPosSize(adAggregates[i].pctrlInputControl, nCurrentControlPos, adAggregates[i].nPosSizeArgument); + SetPosSize(adAggregate.pctrlTextControl, nCurrentControlPos, 0); + SetPosSize(adAggregate.pctrlInputControl, nCurrentControlPos, adAggregate.nPosSizeArgument); // Set the z-order in a way such that the Controls can be traversed in the same sequence in which they have been arranged here - adAggregates[i].pctrlTextControl->SetZOrder(pZOrderPredecessor, pZOrderPredecessor ? ZOrderFlags::Behind : ZOrderFlags::First); - adAggregates[i].pctrlInputControl->SetZOrder(adAggregates[i].pctrlTextControl, ZOrderFlags::Behind ); - pZOrderPredecessor = adAggregates[i].pctrlInputControl; + adAggregate.pctrlTextControl->SetZOrder(pZOrderPredecessor, pZOrderPredecessor ? ZOrderFlags::Behind : ZOrderFlags::First); + adAggregate.pctrlInputControl->SetZOrder(adAggregate.pctrlTextControl, ZOrderFlags::Behind ); + pZOrderPredecessor = adAggregate.pctrlInputControl; - if (adAggregates[i].pctrlInputControl == pFormatSample) + if (adAggregate.pctrlInputControl == pFormatSample) { pFormat->SetZOrder(pZOrderPredecessor, ZOrderFlags::Behind); pZOrderPredecessor = pFormat; diff --git a/dbaccess/source/ui/dlg/queryorder.cxx b/dbaccess/source/ui/dlg/queryorder.cxx index 13fb716b4296..7d7828f17a01 100644 --- a/dbaccess/source/ui/dlg/queryorder.cxx +++ b/dbaccess/source/ui/dlg/queryorder.cxx @@ -76,9 +76,9 @@ DlgOrderCrit::DlgOrderCrit(vcl::Window * pParent, m_aValueList[1] = m_pLB_ORDERVALUE2; m_aValueList[2] = m_pLB_ORDERVALUE3; - for (int j=0; j < DOG_ROWS; ++j) + for (VclPtr<ListBox> & j : m_aColumnList) { - m_aColumnList[j]->InsertEntry( aSTR_NOENTRY ); + j->InsertEntry( aSTR_NOENTRY ); } for (int j=0; j < DOG_ROWS; ++j) @@ -104,9 +104,9 @@ DlgOrderCrit::DlgOrderCrit(vcl::Window * pParent, sal_Int32 eColumnSearch = dbtools::getSearchColumnFlag(m_xConnection,nDataType); if(eColumnSearch != ColumnSearch::NONE) { - for (int j=0; j < DOG_ROWS; ++j) + for (VclPtr<ListBox> & j : m_aColumnList) { - m_aColumnList[j]->InsertEntry(*pIter); + j->InsertEntry(*pIter); } } } diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 09740afd0a51..d3504b4b3f18 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -112,8 +112,8 @@ ODatabaseExport::ODatabaseExport(sal_Int32 nRows, { m_nRows += nRows; sal_Int32 nCount = 0; - for(sal_Int32 j=0;j < (sal_Int32)m_vColumns.size();++j) - if ( m_vColumns[j].first != COLUMN_POSITION_NOT_FOUND ) + for(const std::pair<sal_Int32,sal_Int32> & rPair : m_vColumns) + if ( rPair.first != COLUMN_POSITION_NOT_FOUND ) ++nCount; m_vColumnSize.resize(nCount); @@ -345,11 +345,11 @@ void ODatabaseExport::insertValueIntoColumn() ,NumberFormat::NUMBER ,NumberFormat::LOGICAL }; - for (size_t i = 0; i < SAL_N_ELEMENTS(nFormats); ++i) + for (short nFormat : nFormats) { try { - nNumberFormat = m_xFormatter->detectNumberFormat(xNumType->getStandardFormat(nFormats[i],m_aLocale),m_sTextToken); + nNumberFormat = m_xFormatter->detectNumberFormat(xNumType->getStandardFormat(nFormat,m_aLocale),m_sTextToken); break; } catch(Exception&) diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx index 2cf1497bff1f..9442f8125c69 100644 --- a/dbaccess/source/ui/misc/HtmlReader.cxx +++ b/dbaccess/source/ui/misc/HtmlReader.cxx @@ -134,9 +134,8 @@ void OHTMLReader::NextToken( int nToken ) ++m_nTableCount; { // can also be TD or TH, if there was no TABLE before const HTMLOptions& rHtmlOptions = GetOptions(); - for (size_t i = 0, n = rHtmlOptions.size(); i < n; ++i) + for (const auto & rOption : rHtmlOptions) { - const HTMLOption& rOption = rHtmlOptions[i]; switch( rOption.GetToken() ) { case HTML_O_WIDTH: @@ -291,9 +290,8 @@ void OHTMLReader::fetchOptions() { m_bInTbl = true; const HTMLOptions& options = GetOptions(); - for (size_t i = 0, n = options.size(); i < n; ++i) + for (const auto & rOption : options) { - const HTMLOption& rOption = options[i]; switch( rOption.GetToken() ) { case HTML_O_SDVAL: @@ -312,9 +310,8 @@ void OHTMLReader::fetchOptions() void OHTMLReader::TableDataOn(SvxCellHorJustify& eVal) { const HTMLOptions& rHtmlOptions = GetOptions(); - for (size_t i = 0, n = rHtmlOptions.size(); i < n; ++i) + for (const auto & rOption : rHtmlOptions) { - const HTMLOption& rOption = rHtmlOptions[i]; switch( rOption.GetToken() ) { case HTML_O_ALIGN: @@ -340,9 +337,8 @@ void OHTMLReader::TableDataOn(SvxCellHorJustify& eVal) void OHTMLReader::TableFontOn(FontDescriptor& _rFont,sal_Int32 &_rTextColor) { const HTMLOptions& rHtmlOptions = GetOptions(); - for (size_t i = 0, n = rHtmlOptions.size(); i < n; ++i) + for (const auto & rOption : rHtmlOptions) { - const HTMLOption& rOption = rHtmlOptions[i]; switch( rOption.GetToken() ) { case HTML_O_COLOR: diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index cf4cabdec2ab..abde97068c2a 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -891,8 +891,8 @@ bool callColumnFormatDialog(vcl::Window* _pParent, pFormatDescriptor.reset(); SfxItemPool::Free(pPool); - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(pDefaults); ++i) - delete pDefaults[i]; + for (SfxPoolItem* pDefault : pDefaults) + delete pDefault; return bRet; } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 169a0b8d8d89..44ae24f14928 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -143,10 +143,10 @@ void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObj const OUString aCopyProperties[] = { OUString(PROPERTY_FONT), OUString(PROPERTY_ROW_HEIGHT), OUString(PROPERTY_TEXTCOLOR),OUString(PROPERTY_TEXTLINECOLOR),OUString(PROPERTY_TEXTEMPHASIS),OUString(PROPERTY_TEXTRELIEF) }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aCopyProperties ); ++i ) + for (const auto & aCopyPropertie : aCopyProperties) { - if ( m_xObjectPSI->hasPropertyByName( aCopyProperties[i] ) ) - _rxObject->setPropertyValue( aCopyProperties[i], m_xObject->getPropertyValue( aCopyProperties[i] ) ); + if ( m_xObjectPSI->hasPropertyByName( aCopyPropertie ) ) + _rxObject->setPropertyValue( aCopyPropertie, m_xObject->getPropertyValue( aCopyPropertie ) ); } } @@ -165,19 +165,19 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _ OUString sStatement = "SELECT * FROM " + sTargetName + " WHERE 0=1"; - for ( size_t i=0; i < SAL_N_ELEMENTS(aProperties); ++i ) + for (const std::pair<OUString,OUString> & aPropertie : aProperties) { - if ( m_xObjectPSI->hasPropertyByName( aProperties[i].first ) ) + if ( m_xObjectPSI->hasPropertyByName( aPropertie.first ) ) { OUString sFilter; - m_xObject->getPropertyValue( aProperties[i].first ) >>= sFilter; + m_xObject->getPropertyValue( aPropertie.first ) >>= sFilter; if ( !sFilter.isEmpty() ) { - sStatement += aProperties[i].second; + sStatement += aPropertie.second; OUString sReplace = sFilter; sReplace = sReplace.replaceFirst(sSourceName,sTargetNameTemp); sFilter = sReplace; - _rxObject->setPropertyValue( aProperties[i].first, makeAny(sFilter) ); + _rxObject->setPropertyValue( aPropertie.first, makeAny(sFilter) ); sStatement += sFilter; } } diff --git a/dbaccess/source/ui/querydesign/LimitBox.cxx b/dbaccess/source/ui/querydesign/LimitBox.cxx index a5047cf6abcd..6575ad19b4fb 100644 --- a/dbaccess/source/ui/querydesign/LimitBox.cxx +++ b/dbaccess/source/ui/querydesign/LimitBox.cxx @@ -100,10 +100,9 @@ void LimitBox::LoadDefaultLimits() { InsertValue( ALL_INT ); - const unsigned nSize = SAL_N_ELEMENTS(global::aDefLimitAry); - for( unsigned nIndex = 0; nIndex< nSize; ++nIndex) + for(long nIndex : global::aDefLimitAry) { - InsertValue( global::aDefLimitAry[nIndex] ); + InsertValue( nIndex ); } } diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index ed085e4a5099..c5399b965c16 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -190,10 +190,10 @@ void OSelectionBrowseBox::initialize() OUString sGroup = m_aFunctionStrings.getToken(comphelper::string::getTokenCount(m_aFunctionStrings, ';') - 1, ';'); m_aFunctionStrings = m_aFunctionStrings.getToken(0, ';'); - for (size_t i = 0; i < SAL_N_ELEMENTS(eFunctions); ++i) + for (IParseContext::InternationalKeyCode eFunction : eFunctions) { m_aFunctionStrings += ";"; - m_aFunctionStrings += OStringToOUString(rContext.getIntlKeywordAscii(eFunctions[i]), + m_aFunctionStrings += OStringToOUString(rContext.getIntlKeywordAscii(eFunction), RTL_TEXTENCODING_UTF8); } m_aFunctionStrings += ";"; @@ -341,9 +341,9 @@ void OSelectionBrowseBox::Init() Size aHeight; const Control* pControls[] = { m_pTextCell,m_pVisibleCell,m_pTableCell,m_pFieldCell }; - for (sal_Size i = 0; i < SAL_N_ELEMENTS(pControls); ++i) + for (const Control* pControl : pControls) { - const Size aTemp(pControls[i]->GetOptimalSize()); + const Size aTemp(pControl->GetOptimalSize()); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 55e8042767e8..c4b4fd621651 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -234,9 +234,9 @@ void OTableEditorCtrl::InitCellController() Size aHeight; const Control* pControls[] = { pTypeCell,pDescrCell,pNameCell,pHelpTextCell}; - for(sal_Size i= 0; i < SAL_N_ELEMENTS(pControls); ++i) + for(const Control* pControl : pControls) { - const Size aTemp(pControls[i]->GetOptimalSize()); + const Size aTemp(pControl->GetOptimalSize()); if ( aTemp.Height() > aHeight.Height() ) aHeight.Height() = aTemp.Height(); } diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index b708ebc0fbae..4f977ea6bb02 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -686,11 +686,11 @@ void CopyTableWizard::impl_checkForUnsupportedSettings_throw( const Reference< X const OUString aSettings[] = { OUString(PROPERTY_FILTER), OUString(PROPERTY_ORDER), OUString(PROPERTY_HAVING_CLAUSE), OUString(PROPERTY_GROUP_BY) }; - for ( size_t i=0; i < SAL_N_ELEMENTS( aSettings ); ++i ) + for (const auto & aSetting : aSettings) { - if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSettings[i] ) ) + if ( lcl_hasNonEmptyStringValue_throw( _rxSourceDescriptor, xPSI, aSetting ) ) { - sUnsupportedSetting = aSettings[i]; + sUnsupportedSetting = aSetting; break; } } diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 257b5a6d94b8..bf7ef5931ee7 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -676,18 +676,18 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest aArgs[1].Name = "SynchronMode"; aArgs[1].Value <<= true; - for ( size_t n = 0; n < aDispatches.size(); n++ ) + for (DispatchHolder & aDispatche : aDispatches) { - Reference< XDispatch > xDispatch = aDispatches[n].xDispatch; + Reference< XDispatch > xDispatch = aDispatche.xDispatch; Reference < XNotifyingDispatch > xDisp( xDispatch, UNO_QUERY ); if ( xDisp.is() ) - xDisp->dispatchWithNotification( aDispatches[n].aURL, aArgs, this ); + xDisp->dispatchWithNotification( aDispatche.aURL, aArgs, this ); else { ::osl::ClearableMutexGuard aGuard(m_mutex); m_nRequestCount--; aGuard.clear(); - xDispatch->dispatch( aDispatches[n].aURL, aArgs ); + xDispatch->dispatch( aDispatche.aURL, aArgs ); } } } diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 32240d02349b..a8309e5987ba 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -61,8 +61,7 @@ OUString getInstalledLocale( } } ::std::vector<OUString> fallbacks( LanguageTag( locale).getFallbackStrings( false)); - for (size_t f=0; f < fallbacks.size(); ++f) { - const OUString& rf = fallbacks[f]; + for (OUString & rf : fallbacks) { for (sal_Int32 i = 0; i != installed.getLength(); ++i) { if (installed[i] == rf) { return installed[i]; diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 864d852c0a58..d86f02a663f1 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -211,9 +211,8 @@ void PackageManagerImpl::initActivationLayer( } bool bShared = (m_context == "shared"); - for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos ) + for (OUString & tempEntry : tempEntries) { - OUString const & tempEntry = tempEntries[ pos ]; const MatchTempDir match( tempEntry ); if (::std::none_of( id2temp.begin(), id2temp.end(), match )) { diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index e02b84d87bd7..ccf8e964d135 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -432,8 +432,8 @@ OUString generateRandomPipeId() throw RuntimeException( "random pool error!?", nullptr ); } OUStringBuffer buf; - for ( sal_uInt32 i = 0; i < ARLEN(bytes); ++i ) { - buf.append( static_cast<sal_Int32>(bytes[ i ]), 0x10 ); + for (unsigned char byte : bytes) { + buf.append( static_cast<sal_Int32>(byte), 0x10 ); } return buf.makeStringAndClear(); } diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 4e3e2aeeb987..a7ca243e3d89 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -282,12 +282,12 @@ void PackageRegistryBackend::deleteUnusedFolders( makeURLAppendSysPathSegment(sDataFolder, title)); } - for ( ::std::size_t pos = 0; pos < tempEntries.size(); ++pos ) + for (OUString & tempEntrie : tempEntries) { - if (::std::find( usedFolders.begin(), usedFolders.end(), tempEntries[pos] ) == + if (::std::find( usedFolders.begin(), usedFolders.end(), tempEntrie ) == usedFolders.end()) { - deleteTempFolder(tempEntries[pos]); + deleteTempFolder(tempEntrie); } } } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ceb7f9063309..20c48fd5a74b 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -783,11 +783,11 @@ static void doc_iniUnoCommands () SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame); uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext)); - for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++) + for (const auto & sUnoCommand : sUnoCommands) { const SfxSlot* pSlot = nullptr; - aCommandURL.Complete = sUnoCommands[nIterator]; + aCommandURL.Complete = sUnoCommand; xParser->parseStrict(aCommandURL); pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path); diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index c2f81bcb8b22..b8e933341141 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -241,14 +241,14 @@ bool MigrationImpl::doMigration() const OUString sMenubarResourceURL("private:resource/menubar/menubar"); const OUString sToolbarResourcePre("private:resource/toolbar/"); - for (size_t i=0; i<vModulesInfo.size(); ++i) { - OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName); + for (MigrationModuleInfo & i : vModulesInfo) { + OUString sModuleIdentifier = mapModuleShortNameToIdentifier(i.sModuleShortName); if (sModuleIdentifier.isEmpty()) continue; uno::Sequence< uno::Any > lArgs(2); OUString aOldCfgDataPath = m_aInfo.userdata + "/user/config/soffice.cfg/modules/"; - lArgs[0] <<= aOldCfgDataPath + vModulesInfo[i].sModuleShortName; + lArgs[0] <<= aOldCfgDataPath + i.sModuleShortName; lArgs[1] <<= embed::ElementModes::READ; uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); @@ -261,24 +261,24 @@ bool MigrationImpl::doMigration() xOldCfgManager->reload(); } - uno::Reference< ui::XUIConfigurationManager > xCfgManager = aNewVersionUIInfo.getConfigManager(vModulesInfo[i].sModuleShortName); + uno::Reference< ui::XUIConfigurationManager > xCfgManager = aNewVersionUIInfo.getConfigManager(i.sModuleShortName); - if (vModulesInfo[i].bHasMenubar) { + if (i.bHasMenubar) { uno::Reference< container::XIndexContainer > xOldVersionMenuSettings(xOldCfgManager->getSettings(sMenubarResourceURL, true), uno::UNO_QUERY); - uno::Reference< container::XIndexContainer > xNewVersionMenuSettings = aNewVersionUIInfo.getNewMenubarSettings(vModulesInfo[i].sModuleShortName); + uno::Reference< container::XIndexContainer > xNewVersionMenuSettings = aNewVersionUIInfo.getNewMenubarSettings(i.sModuleShortName); OUString sParent; compareOldAndNewConfig(sParent, xOldVersionMenuSettings, xNewVersionMenuSettings, sMenubarResourceURL); mergeOldToNewVersion(xCfgManager, xNewVersionMenuSettings, sModuleIdentifier, sMenubarResourceURL); } - sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size(); + sal_Int32 nToolbars = i.m_vToolbars.size(); if (nToolbars >0) { for (sal_Int32 j=0; j<nToolbars; ++j) { - OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; + OUString sToolbarName = i.m_vToolbars[j]; OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; uno::Reference< container::XIndexContainer > xOldVersionToolbarSettings(xOldCfgManager->getSettings(sToolbarResourceURL, true), uno::UNO_QUERY); - uno::Reference< container::XIndexContainer > xNewVersionToolbarSettings = aNewVersionUIInfo.getNewToolbarSettings(vModulesInfo[i].sModuleShortName, sToolbarName); + uno::Reference< container::XIndexContainer > xNewVersionToolbarSettings = aNewVersionUIInfo.getNewToolbarSettings(i.sModuleShortName, sToolbarName); OUString sParent; compareOldAndNewConfig(sParent, xOldVersionToolbarSettings, xNewVersionToolbarSettings, sToolbarResourceURL); mergeOldToNewVersion(xCfgManager, xNewVersionToolbarSettings, sModuleIdentifier, sToolbarResourceURL); diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 414df39f06f9..b8b067735f68 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -225,9 +225,9 @@ bool OO3ExtensionMigration::scanDescriptionXml( const OUString& sDescriptionXmlU if ( !aExtIdentifier.isEmpty() ) { // scan extension identifier and try to match with our black list entries - for ( size_t i = 0; i < m_aBlackList.size(); i++ ) + for (OUString & i : m_aBlackList) { - utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); + utl::SearchParam param(i, utl::SearchParam::SRCH_REGEXP); utl::TextSearch ts(param, LANGUAGE_DONTKNOW); sal_Int32 start = 0; @@ -250,9 +250,9 @@ bool OO3ExtensionMigration::scanDescriptionXml( const OUString& sDescriptionXmlU // Try to use the folder name to match our black list // as some extensions don't provide an identifier in the // description.xml! - for ( size_t i = 0; i < m_aBlackList.size(); i++ ) + for (OUString & i : m_aBlackList) { - utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); + utl::SearchParam param(i, utl::SearchParam::SRCH_REGEXP); utl::TextSearch ts(param, LANGUAGE_DONTKNOW); sal_Int32 start = 0; diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 93fa127fbba7..822a1b9c4276 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -364,9 +364,8 @@ extern "C" int unopkg_main() if ( subcmd_add || subCommand == "remove" ) { - for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos ) + for (OUString & cmdPackage : cmdPackages) { - OUString const & cmdPackage = cmdPackages[ pos ]; if (subcmd_add) { beans::NamedValue nvSuppress( @@ -449,18 +448,18 @@ extern "C" int unopkg_main() { //The user provided the names (ids or file names) of the extensions //which shall be listed - for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos ) + for (OUString & cmdPackage : cmdPackages) { Reference<deployment::XPackage> extension; try { extension = xExtensionManager->getDeployedExtension( - repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv ); + repository, cmdPackage, cmdPackage, xCmdEnv ); } catch (const lang::IllegalArgumentException &) { extension = findPackage(repository, - xExtensionManager, xCmdEnv, cmdPackages[ pos ] ); + xExtensionManager, xCmdEnv, cmdPackage ); } //Now look if the requested extension has an unaccepted license @@ -470,7 +469,7 @@ extern "C" int unopkg_main() ::std::vector<Reference<deployment::XPackage> >::const_iterator i = ::std::find_if( vecExtUnaccepted.begin(), - vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos])); + vecExtUnaccepted.end(), ExtensionName(cmdPackage)); if (i != vecExtUnaccepted.end()) { extension = *i; @@ -487,7 +486,7 @@ extern "C" int unopkg_main() else throw lang::IllegalArgumentException( "There is no such extension deployed: " + - cmdPackages[pos],nullptr,-1); + cmdPackage,nullptr,-1); } } @@ -501,18 +500,18 @@ extern "C" int unopkg_main() vecExtUnaccepted, xExtensionManager->getExtensionsWithUnacceptedLicenses( repository, xCmdEnv)); - for ( ::std::size_t pos = 0; pos < cmdPackages.size(); ++pos ) + for (OUString & cmdPackage : cmdPackages) { Reference<deployment::XPackage> extension; try { extension = xExtensionManager->getDeployedExtension( - repository, cmdPackages[ pos ], cmdPackages[ pos ], xCmdEnv ); + repository, cmdPackage, cmdPackage, xCmdEnv ); } catch (const lang::IllegalArgumentException &) { extension = findPackage( - repository, xExtensionManager, xCmdEnv, cmdPackages[ pos ] ); + repository, xExtensionManager, xCmdEnv, cmdPackage ); } if (!extension.is()) @@ -520,7 +519,7 @@ extern "C" int unopkg_main() ::std::vector<Reference<deployment::XPackage> >::const_iterator i = ::std::find_if( vecExtUnaccepted.begin(), - vecExtUnaccepted.end(), ExtensionName(cmdPackages[pos])); + vecExtUnaccepted.end(), ExtensionName(cmdPackage)); if (i != vecExtUnaccepted.end()) { extension = *i; diff --git a/drawinglayer/source/animation/animationtiming.cxx b/drawinglayer/source/animation/animationtiming.cxx index fb415b1c0bf9..3d6b432c05a2 100644 --- a/drawinglayer/source/animation/animationtiming.cxx +++ b/drawinglayer/source/animation/animationtiming.cxx @@ -178,9 +178,9 @@ namespace drawinglayer AnimationEntryList::~AnimationEntryList() { - for(size_t a(0); a < maEntries.size(); a++) + for(AnimationEntry* maEntrie : maEntries) { - delete maEntries[a]; + delete maEntrie; } } @@ -188,9 +188,9 @@ namespace drawinglayer { AnimationEntryList* pNew = new AnimationEntryList(); - for(size_t a(0); a < maEntries.size(); a++) + for(AnimationEntry* maEntrie : maEntries) { - pNew->append(*maEntries[a]); + pNew->append(*maEntrie); } return pNew; @@ -281,9 +281,9 @@ namespace drawinglayer { AnimationEntryLoop* pNew = new AnimationEntryLoop(mnRepeat); - for(size_t a(0); a < maEntries.size(); a++) + for(AnimationEntry* maEntrie : maEntries) { - pNew->append(*maEntries[a]); + pNew->append(*maEntrie); } return pNew; diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 26875142fcf7..094e186f283c 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -602,9 +602,9 @@ namespace { std::vector< basegfx::B2DPoint > aPositions(rPositions); - for(size_t a(0); a < aPositions.size(); a++) + for(basegfx::B2DPoint & aPosition : aPositions) { - aPositions[a] = rProperties.getTransformation() * aPositions[a]; + aPosition = rProperties.getTransformation() * aPosition; } rTarget.append( @@ -1557,9 +1557,9 @@ namespace // add created text primitive to target if(rProperty.getTransformation().isIdentity()) { - for(size_t a(0); a < aTargetVector.size(); a++) + for(drawinglayer::primitive2d::BasePrimitive2D* a : aTargetVector) { - rTarget.append(aTargetVector[a]); + rTarget.append(a); } } else @@ -2055,9 +2055,9 @@ namespace { // when derivation is more than 3,5% from default text size, // scale the DXArray - for(size_t a(0); a < aTextArray.size(); a++) + for(double & a : aTextArray) { - aTextArray[a] *= fRelative; + a *= fRelative; } } } diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index ed1a40f0d32d..11bbc23ebeb1 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -127,9 +127,9 @@ namespace drawinglayer ::std::vector< double > aScaledDXArray = getDXArray(); const double fDXArrayScale(1.0 / aScale.getX()); - for(size_t a(0); a < aScaledDXArray.size(); a++) + for(double & a : aScaledDXArray) { - aScaledDXArray[a] *= fDXArrayScale; + a *= fDXArrayScale; } // get the text outlines diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx index ae60358e065d..489680a223ac 100644 --- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx @@ -181,9 +181,8 @@ namespace drawinglayer a2DUnitLine.append(basegfx::B2DPoint(0.0, 0.0)); a2DUnitLine.append(basegfx::B2DPoint(1.0, 0.0)); - for(size_t c(0); c < aMatrices.size(); c++) + for(basegfx::B2DHomMatrix & rMatrix : aMatrices) { - const basegfx::B2DHomMatrix& rMatrix = aMatrices[c]; basegfx::B2DPolygon aNewLine(a2DUnitLine); aNewLine.transform(rMatrix); a2DHatchLines.append(aNewLine); diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index c75c4fa487c6..bf593985b94b 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -49,9 +49,9 @@ namespace drawinglayer { basegfx::B3DRange aRetval; - for(size_t a(0); a < rFill.size(); a++) + for(basegfx::B3DPolyPolygon & a : rFill) { - aRetval.expand(basegfx::tools::getRange(rFill[a])); + aRetval.expand(basegfx::tools::getRange(a)); } return aRetval; @@ -62,26 +62,26 @@ namespace drawinglayer // create sphere normals const basegfx::B3DPoint aCenter(rRange.getCenter()); - for(size_t a(0); a < rFill.size(); a++) + for(basegfx::B3DPolyPolygon & a : rFill) { - rFill[a] = basegfx::tools::applyDefaultNormalsSphere(rFill[a], aCenter); + a = basegfx::tools::applyDefaultNormalsSphere(a, aCenter); } } void applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) { - for(size_t a(0); a < rFill.size(); a++) + for(basegfx::B3DPolyPolygon & a : rFill) { - rFill[a].clearNormals(); + a.clearNormals(); } } void applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill) { // invert normals - for(size_t a(0); a < rFill.size(); a++) + for(basegfx::B3DPolyPolygon & a : rFill) { - rFill[a] = basegfx::tools::invertNormals(rFill[a]); + a = basegfx::tools::invertNormals(a); } } diff --git a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx index 0778f8782014..298b58410041 100644 --- a/drawinglayer/source/primitive3d/sdrprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/sdrprimitive3d.cxx @@ -55,9 +55,9 @@ namespace drawinglayer if(!rSlices.empty()) { - for(size_t a(0); a < rSlices.size(); a++) + for(const auto & rSlice : rSlices) { - aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon())); + aRetval.expand(basegfx::tools::getRange(rSlice.getB3DPolyPolygon())); } aRetval.transform(getTransform()); |