diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-17 12:35:27 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-17 17:18:47 +0100 |
commit | 95e70f71b951a91dcfa38e313b59cbe090db2ec1 (patch) | |
tree | 4b49d1bb6c7539fbfe26c2e821eda3c20490de99 /fpicker/source/office | |
parent | cui: Add tooltip to user-defined number format comment (diff) | |
download | core-95e70f71b951a91dcfa38e313b59cbe090db2ec1.tar.gz core-95e70f71b951a91dcfa38e313b59cbe090db2ec1.zip |
Use for-range loops in fpicker
Change-Id: I9bca308889c6e15ce9fcbc82f5c6c5e126b29022
Reviewed-on: https://gerrit.libreoffice.org/51460
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'fpicker/source/office')
-rw-r--r-- | fpicker/source/office/OfficeFilePicker.cxx | 85 | ||||
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 6 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 9 |
3 files changed, 40 insertions, 60 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx index 23aabac5962b..bdd55362b8c6 100644 --- a/fpicker/source/office/OfficeFilePicker.cxx +++ b/fpicker/source/office/OfficeFilePicker.cxx @@ -177,38 +177,32 @@ void SvtFilePicker::prepareExecute() { ::svt::OControlAccess aAccess( getDialog(), getDialog()->GetView() ); - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) + for (auto const& elem : *m_pElemList) { - ElementEntry_Impl& rEntry = *aListIter; - if ( rEntry.m_bHasValue ) - aAccess.setValue( rEntry.m_nElementID, rEntry.m_nControlAction, rEntry.m_aValue ); - if ( rEntry.m_bHasLabel ) - aAccess.setLabel( rEntry.m_nElementID, rEntry.m_aLabel ); - if ( rEntry.m_bHasEnabled ) - aAccess.enableControl( rEntry.m_nElementID, rEntry.m_bEnabled ); + if ( elem.m_bHasValue ) + aAccess.setValue( elem.m_nElementID, elem.m_nControlAction, elem.m_aValue ); + if ( elem.m_bHasLabel ) + aAccess.setLabel( elem.m_nElementID, elem.m_aLabel ); + if ( elem.m_bHasEnabled ) + aAccess.enableControl( elem.m_nElementID, elem.m_bEnabled ); } } if ( m_pFilterList && !m_pFilterList->empty() ) { - for ( FilterList::iterator aListIter = m_pFilterList->begin(); - aListIter != m_pFilterList->end(); - ++aListIter - ) + for (auto & elem : *m_pFilterList) { - if ( aListIter->hasSubFilters() ) + if ( elem.hasSubFilters() ) { // it's a filter group UnoFilterList aSubFilters; - aListIter->getSubFilters( aSubFilters ); + elem.getSubFilters( aSubFilters ); - getDialog()->AddFilterGroup( aListIter->getTitle(), aSubFilters ); + getDialog()->AddFilterGroup( elem.getTitle(), aSubFilters ); } else // it's a single filter - getDialog()->AddFilter( aListIter->getTitle(), aListIter->getFilter() ); + getDialog()->AddFilter( elem.getTitle(), elem.getFilter() ); } } @@ -623,17 +617,14 @@ void SAL_CALL SvtFilePicker::setValue( sal_Int16 nElementID, m_pElemList.reset( new ElementList ); bool bFound = false; - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) + for (auto & elem : *m_pElemList) { - ElementEntry_Impl& rEntry = *aListIter; - if ( ( rEntry.m_nElementID == nElementID ) && - ( !rEntry.m_bHasValue || ( rEntry.m_nControlAction == nControlAction ) ) ) + if ( ( elem.m_nElementID == nElementID ) && + ( !elem.m_bHasValue || ( elem.m_nControlAction == nControlAction ) ) ) { - rEntry.setAction( nControlAction ); - rEntry.setValue( rValue ); + elem.setAction( nControlAction ); + elem.setValue( rValue ); bFound = true; } } @@ -664,16 +655,13 @@ Any SAL_CALL SvtFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAc } else if ( m_pElemList && !m_pElemList->empty() ) { - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) + for (auto const& elem : *m_pElemList) { - ElementEntry_Impl& rEntry = *aListIter; - if ( ( rEntry.m_nElementID == nElementID ) && - ( rEntry.m_bHasValue ) && - ( rEntry.m_nControlAction == nControlAction ) ) + if ( ( elem.m_nElementID == nElementID ) && + ( elem.m_bHasValue ) && + ( elem.m_nControlAction == nControlAction ) ) { - aAny = rEntry.m_aValue; + aAny = elem.m_aValue; break; } } @@ -699,15 +687,12 @@ void SAL_CALL SvtFilePicker::setLabel( sal_Int16 nLabelID, const OUString& rValu m_pElemList.reset( new ElementList ); bool bFound = false; - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) + for (auto & elem : *m_pElemList) { - ElementEntry_Impl& rEntry = *aListIter; - if ( rEntry.m_nElementID == nLabelID ) + if ( elem.m_nElementID == nLabelID ) { - rEntry.setLabel( rValue ); + elem.setLabel( rValue ); bFound = true; } } @@ -736,15 +721,12 @@ OUString SAL_CALL SvtFilePicker::getLabel( sal_Int16 nLabelID ) } else if ( m_pElemList && !m_pElemList->empty() ) { - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) + for (auto const& elem : *m_pElemList) { - ElementEntry_Impl& rEntry = *aListIter; - if ( rEntry.m_nElementID == nLabelID ) + if ( elem.m_nElementID == nLabelID ) { - if ( rEntry.m_bHasLabel ) - aLabel = rEntry.m_aLabel; + if ( elem.m_bHasLabel ) + aLabel = elem.m_aLabel; break; } } @@ -770,15 +752,12 @@ void SAL_CALL SvtFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnab m_pElemList.reset( new ElementList ); bool bFound = false; - ElementList::iterator aListIter; - for ( aListIter = m_pElemList->begin(); - aListIter != m_pElemList->end(); ++aListIter ) + for (auto & elem : *m_pElemList) { - ElementEntry_Impl& rEntry = *aListIter; - if ( rEntry.m_nElementID == nElementID ) + if ( elem.m_nElementID == nElementID ) { - rEntry.setEnabled( bEnable ); + elem.setEnabled( bEnable ); bFound = true; } } diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index c37ccc998ff9..06eb31b10b3d 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -329,10 +329,10 @@ void RemoteFilesDialog::dispose() Sequence< OUString > placesNamesList( m_aServices.size() ); int i = 0; - for( std::vector< ServicePtr >::const_iterator it = m_aServices.begin(); it != m_aServices.end(); ++it ) + for (auto const& service : m_aServices) { - placesUrlsList[i] = ( *it )->GetUrl(); - placesNamesList[i] = ( *it )->GetName(); + placesUrlsList[i] = service->GetUrl(); + placesNamesList[i] = service->GetName(); ++i; } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 069877c4c1ea..a6503e680d31 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -502,10 +502,11 @@ void SvtFileDialog::dispose() Sequence< OUString > placesUrlsList(pImpl->_pPlaces->GetNbEditablePlaces()); Sequence< OUString > placesNamesList(pImpl->_pPlaces->GetNbEditablePlaces()); int i(0); - for(std::vector<PlacePtr>::const_iterator it = aPlaces.begin(); it != aPlaces.end(); ++it) { - if((*it)->IsEditable()) { - placesUrlsList[i] = (*it)->GetUrl(); - placesNamesList[i] = (*it)->GetName(); + for (auto const& place : aPlaces) + { + if(place->IsEditable()) { + placesUrlsList[i] = place->GetUrl(); + placesNamesList[i] = place->GetName(); ++i; } } |