diff options
43 files changed, 220 insertions, 358 deletions
diff --git a/UnoControls/source/base/basecontainercontrol.cxx b/UnoControls/source/base/basecontainercontrol.cxx index 766b5fa75e6d..2a34e16d1fa1 100644 --- a/UnoControls/source/base/basecontainercontrol.cxx +++ b/UnoControls/source/base/basecontainercontrol.cxx @@ -166,21 +166,15 @@ void SAL_CALL BaseContainerControl::dispose() // remove controls Sequence< Reference< XControl > > seqCtrls = getControls(); - Reference< XControl > * pCtrls = seqCtrls.getArray(); - sal_uInt32 nCtrls = seqCtrls.getLength(); - size_t nMaxCount = maControlInfoList.size(); - size_t nCount = 0; - for ( nCount = 0; nCount < nMaxCount; ++nCount ) - { - delete maControlInfoList[ nCount ]; - } + for ( auto & i : maControlInfoList ) + delete i; maControlInfoList.clear(); - for ( nCount = 0; nCount < nCtrls; ++nCount ) + for ( Reference< XControl > const & control : seqCtrls ) { - pCtrls [ nCount ] -> removeEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ); - pCtrls [ nCount ] -> dispose ( ); + control->removeEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) ); + control->dispose ( ); } // call baseclass diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index c76ef479dd6a..d80334a9abb7 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -309,17 +309,14 @@ typedef uno::Reference< beans::XPropertySet > lcl_tSubGridType; void lcl_CloneSubGrids( const uno::Sequence< lcl_tSubGridType > & rSource, uno::Sequence< lcl_tSubGridType > & rDestination ) { - const lcl_tSubGridType * pBegin = rSource.getConstArray(); - const lcl_tSubGridType * pEnd = pBegin + rSource.getLength(); - rDestination.realloc( rSource.getLength()); lcl_tSubGridType * pDestBegin = rDestination.getArray(); lcl_tSubGridType * pDestEnd = pDestBegin + rDestination.getLength(); lcl_tSubGridType * pDestIt = pDestBegin; - for( const lcl_tSubGridType * pIt = pBegin; pIt != pEnd; ++pIt ) + for( Reference< beans::XPropertySet > const & i : rSource ) { - Reference< beans::XPropertySet > xSubGrid( *pIt ); + Reference< beans::XPropertySet > xSubGrid( i ); if( xSubGrid.is()) { Reference< util::XCloneable > xCloneable( xSubGrid, uno::UNO_QUERY ); diff --git a/connectivity/source/commontools/ConnectionWrapper.cxx b/connectivity/source/commontools/ConnectionWrapper.cxx index 2ca1e2993ffb..7ac9ed6dc1c2 100644 --- a/connectivity/source/commontools/ConnectionWrapper.cxx +++ b/connectivity/source/commontools/ConnectionWrapper.cxx @@ -202,32 +202,26 @@ void OConnectionWrapper::createUniqueId( const OUString& _rURL if ( !_rPassword.isEmpty() ) rtl_digest_update(aDigest,_rPassword.getStr(),_rPassword.getLength()*sizeof(sal_Unicode)); // now we need to sort the properties - PropertyValue* pBegin = _rInfo.getArray(); - PropertyValue* pEnd = pBegin + _rInfo.getLength(); - std::sort(pBegin,pEnd,TPropertyValueLessFunctor()); + std::sort(_rInfo.begin(),_rInfo.end(),TPropertyValueLessFunctor()); - pBegin = _rInfo.getArray(); - pEnd = pBegin + _rInfo.getLength(); - for (; pBegin != pEnd; ++pBegin) + for (PropertyValue const & prop : _rInfo) { // we only include strings an integer values OUString sValue; - if ( pBegin->Value >>= sValue ) + if ( prop.Value >>= sValue ) ; else { sal_Int32 nValue = 0; - if ( pBegin->Value >>= nValue ) + if ( prop.Value >>= nValue ) sValue = OUString::number(nValue); else { Sequence< OUString> aSeq; - if ( pBegin->Value >>= aSeq ) + if ( prop.Value >>= aSeq ) { - const OUString* pSBegin = aSeq.getConstArray(); - const OUString* pSEnd = pSBegin + aSeq.getLength(); - for(;pSBegin != pSEnd;++pSBegin) - rtl_digest_update(aDigest,pSBegin->getStr(),pSBegin->getLength()*sizeof(sal_Unicode)); + for(OUString const & s : aSeq) + rtl_digest_update(aDigest,s.getStr(),s.getLength()*sizeof(sal_Unicode)); } } } diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index 6b81ac0da090..649024f667d8 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -766,9 +766,8 @@ Sequence< OUString > ORegistryFactoryHelper::getSupportedServiceNames() // Full qualified names like "IMPLEMENTATIONS/TEST/UNO/SERVICES/com.sun.star..." Sequence<OUString> seqKeys = xKey->getKeyNames(); - OUString* pKeys = seqKeys.getArray(); - for( sal_Int32 i = 0; i < seqKeys.getLength(); i++ ) - pKeys[i] = pKeys[i].copy(nPrefixLen); + for( OUString & key : seqKeys ) + key = key.copy(nPrefixLen); aServiceNames = seqKeys; } diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index d80677ecb746..cf8c115bf028 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -315,22 +315,20 @@ void ODBTableDecorator::construct() Reference<XPropertySetInfo> xInfo = xProp->getPropertySetInfo(); Sequence< Property > aTableProps = xInfo->getProperties(); - Property* pIter = aTableProps.getArray(); - Property* pEnd = pIter + aTableProps.getLength(); - for (;pIter != pEnd ; ++pIter) + for (Property & prop : aTableProps) { - if (pIter->Name == PROPERTY_CATALOGNAME) - pIter->Handle = PROPERTY_ID_CATALOGNAME; - else if (pIter->Name == PROPERTY_SCHEMANAME) - pIter->Handle = PROPERTY_ID_SCHEMANAME; - else if (pIter->Name == PROPERTY_NAME) - pIter->Handle = PROPERTY_ID_NAME; - else if (pIter->Name == PROPERTY_DESCRIPTION) - pIter->Handle = PROPERTY_ID_DESCRIPTION; - else if (pIter->Name == PROPERTY_TYPE) - pIter->Handle = PROPERTY_ID_TYPE; - else if (pIter->Name == PROPERTY_PRIVILEGES) - pIter->Handle = PROPERTY_ID_PRIVILEGES; + if (prop.Name == PROPERTY_CATALOGNAME) + prop.Handle = PROPERTY_ID_CATALOGNAME; + else if (prop.Name == PROPERTY_SCHEMANAME) + prop.Handle = PROPERTY_ID_SCHEMANAME; + else if (prop.Name == PROPERTY_NAME) + prop.Handle = PROPERTY_ID_NAME; + else if (prop.Name == PROPERTY_DESCRIPTION) + prop.Handle = PROPERTY_ID_DESCRIPTION; + else if (prop.Name == PROPERTY_TYPE) + prop.Handle = PROPERTY_ID_TYPE; + else if (prop.Name == PROPERTY_PRIVILEGES) + prop.Handle = PROPERTY_ID_PRIVILEGES; } describeProperties(aTableProps); diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index f426b9d992cd..291f597fb7db 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -220,18 +220,16 @@ void ODBTable::construct() describeProperties(aProps); if(!_nId) { - Property* pIter = aProps.getArray(); - Property* pEnd = pIter + aProps.getLength(); - for(;pIter != pEnd;++pIter) + for(Property & prop : aProps) { - if (pIter->Name == PROPERTY_CATALOGNAME) - pIter->Attributes = PropertyAttribute::READONLY; - else if (pIter->Name == PROPERTY_SCHEMANAME) - pIter->Attributes = PropertyAttribute::READONLY; - else if (pIter->Name == PROPERTY_DESCRIPTION) - pIter->Attributes = PropertyAttribute::READONLY; - else if (pIter->Name == PROPERTY_NAME) - pIter->Attributes = PropertyAttribute::READONLY; + if (prop.Name == PROPERTY_CATALOGNAME) + prop.Attributes = PropertyAttribute::READONLY; + else if (prop.Name == PROPERTY_SCHEMANAME) + prop.Attributes = PropertyAttribute::READONLY; + else if (prop.Name == PROPERTY_DESCRIPTION) + prop.Attributes = PropertyAttribute::READONLY; + else if (prop.Name == PROPERTY_NAME) + prop.Attributes = PropertyAttribute::READONLY; } } diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx index cd1477fcc1a2..8b0b7a3c8a5f 100644 --- a/dbaccess/source/ext/macromigration/migrationengine.cxx +++ b/dbaccess/source/ext/macromigration/migrationengine.cxx @@ -1664,18 +1664,15 @@ namespace dbmm Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); Sequence< OUString > aEventNames( xEvents->getElementNames() ); - const OUString* eventName = aEventNames.getArray(); - const OUString* eventNamesEnd = eventName + aEventNames.getLength(); - ScriptEventDescriptor aScriptEvent; - for ( ; eventName != eventNamesEnd; ++eventName ) + for ( OUString const & eventName : aEventNames ) { - OSL_VERIFY( xEvents->getByName( *eventName ) >>= aScriptEvent ); + OSL_VERIFY( xEvents->getByName( eventName ) >>= aScriptEvent ); if ( !impl_adjustScriptLibrary_nothrow( aScriptEvent ) ) continue; - xEvents->replaceByName( *eventName, makeAny( aScriptEvent ) ); + xEvents->replaceByName( eventName, makeAny( aScriptEvent ) ); } } @@ -1731,12 +1728,9 @@ namespace dbmm Sequence< ScriptEventDescriptor > aEvents( aComponent.getEvents() ); bool bChangedComponentEvents = false; - for ( ScriptEventDescriptor* scriptEvent = aEvents.getArray(); - scriptEvent != aEvents.getArray() + aEvents.getLength(); - ++scriptEvent - ) + for ( ScriptEventDescriptor & scriptEvent : aEvents ) { - if ( !impl_adjustScriptLibrary_nothrow( *scriptEvent ) ) + if ( !impl_adjustScriptLibrary_nothrow( scriptEvent ) ) continue; bChangedComponentEvents = true; diff --git a/dbaccess/source/ui/browser/sbamultiplex.cxx b/dbaccess/source/ui/browser/sbamultiplex.cxx index f6ae47d866a8..459b743a37a1 100644 --- a/dbaccess/source/ui/browser/sbamultiplex.cxx +++ b/dbaccess/source/ui/browser/sbamultiplex.cxx @@ -85,9 +85,8 @@ void SbaXPropertiesChangeMultiplexer::propertiesChange(const css::uno::Sequence< // forwards _all_ changes to _all_ listeners css::uno::Sequence< css::beans::PropertyChangeEvent> aMulti(aEvts); - css::beans::PropertyChangeEvent* pMulti = aMulti.getArray(); - for (sal_Int32 i=0; i<aMulti.getLength(); ++i, ++pMulti) - pMulti->Source = &m_rParent; + for (css::beans::PropertyChangeEvent & rEvent : aMulti) + rEvent.Source = &m_rParent; ::comphelper::OInterfaceIteratorHelper2 aIt(*this); while (aIt.hasMoreElements()) diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index fefcf1173935..c88d994093ed 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -831,14 +831,12 @@ namespace pcr PropertyId nPropId( 0 ); OUString sDisplayName; - Property* pProperty = aAllProperties.getArray(); - Property* pPropertiesEnd = pProperty + aAllProperties.getLength(); - for ( ; pProperty != pPropertiesEnd; ++pProperty ) + for ( Property & rProperty : aAllProperties ) { - nPropId = m_pInfoService->getPropertyId( pProperty->Name ); + nPropId = m_pInfoService->getPropertyId( rProperty.Name ); if ( nPropId == -1 ) continue; - pProperty->Handle = nPropId; + rProperty.Handle = nPropId; sDisplayName = m_pInfoService->getPropertyTranslation( nPropId ); if ( sDisplayName.isEmpty() ) @@ -856,7 +854,7 @@ namespace pcr continue; // some generic sanity checks - if ( impl_shouldExcludeProperty_nothrow( *pProperty ) ) + if ( impl_shouldExcludeProperty_nothrow( rProperty ) ) continue; switch ( nPropId ) @@ -865,7 +863,7 @@ namespace pcr case PROPERTY_ID_TABSTOP: // BORDER and TABSTOP are normalized (see impl_normalizePropertyValue_nothrow) // to not allow VOID values - pProperty->Attributes &= ~PropertyAttribute::MAYBEVOID; + rProperty.Attributes &= ~PropertyAttribute::MAYBEVOID; break; case PROPERTY_ID_LISTSOURCE: @@ -881,7 +879,7 @@ namespace pcr break; } // switch ( nPropId ) - aProperties.push_back( *pProperty ); + aProperties.push_back( rProperty ); } if ( aProperties.empty() ) diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 09850c095b04..1abaf3c1b3ac 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -388,15 +388,11 @@ OUString XMLFilterSettingsDialog::createUniqueInterfaceName( const OUString& rIn try { Sequence< OUString > aFilterNames( mxFilterContainer->getElementNames() ); - OUString* pFilterName = aFilterNames.getArray(); - - const sal_Int32 nCount = aFilterNames.getLength(); - sal_Int32 nFilter; Sequence< PropertyValue > aValues; - for( nFilter = 0; (nFilter < nCount); nFilter++, pFilterName++ ) + for( OUString const & filterName : aFilterNames) { - Any aAny( mxFilterContainer->getByName( *pFilterName ) ); + Any aAny( mxFilterContainer->getByName( filterName ) ); if( !(aAny >>= aValues) ) continue; @@ -1042,28 +1038,24 @@ void XMLFilterSettingsDialog::initFilterList() if( mxFilterContainer.is() ) { Sequence< OUString > aFilterNames( mxFilterContainer->getElementNames() ); - OUString* pFilterName = aFilterNames.getArray(); - - const sal_Int32 nCount = aFilterNames.getLength(); - sal_Int32 nFilter; Sequence< PropertyValue > aValues; std::unique_ptr<filter_info_impl> pTempFilter( new filter_info_impl ); Sequence< OUString > aUserData; - for( nFilter = 0; nFilter < nCount; nFilter++, pFilterName++ ) + for( OUString const & filterName : aFilterNames ) { aUserData.realloc(0); try { - Any aAny( mxFilterContainer->getByName( *pFilterName ) ); + Any aAny( mxFilterContainer->getByName( filterName ) ); if( !(aAny >>= aValues) ) continue; OUString aFilterService; - pTempFilter->maFilterName = *pFilterName; + pTempFilter->maFilterName = filterName; const sal_Int32 nValueCount( aValues.getLength() ); PropertyValue* pValues = aValues.getArray(); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 23348fdd68b4..3cf1f5abd618 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -315,13 +315,12 @@ void XMLFilterTestDialog::onExportBrowse() if( xFilterContainer.is() && xTypeDetection.is() ) { Sequence< OUString > aFilterNames( xFilterContainer->getElementNames() ); - OUString* pFilterName = aFilterNames.getArray(); - for( sal_Int32 nFilter = 0; nFilter < aFilterNames.getLength(); nFilter++, pFilterName++ ) + for( OUString const & filterName : aFilterNames ) { Sequence< PropertyValue > aValues; - Any aAny( xFilterContainer->getByName( *pFilterName ) ); + Any aAny( xFilterContainer->getByName( filterName ) ); if( !(aAny >>= aValues) ) continue; diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index a5e6d61125ca..dd53979ebbc1 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -1425,18 +1425,15 @@ namespace frm ::std::set< sal_Int16 > aSelectionSet; // find the selection entries in our item list - const OUString* pSelectEntries = aSelectEntries.getArray(); - const OUString* pSelectEntriesEnd = pSelectEntries + aSelectEntries.getLength(); - while ( pSelectEntries != pSelectEntriesEnd ) + for ( OUString const & selectEntry : aSelectEntries ) { int idx = 0; for(const OUString& s : getStringItemList()) { - if (s==*pSelectEntries) + if (s==selectEntry) aSelectionSet.insert(idx); ++idx; } - ++pSelectEntries; } // copy the indexes to the sequence diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index c251c17d3587..2d7430ed6cfb 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -398,12 +398,8 @@ void OInterfaceContainer::transformEvents() if ( aChildEvents.getLength() ) { - // the "iterators" for the events for this child - ScriptEventDescriptor* pChildEvents = aChildEvents.getArray(); - ScriptEventDescriptor* pChildEventsEnd = pChildEvents + aChildEvents.getLength(); - // do the transformation - ::std::for_each( pChildEvents, pChildEventsEnd, TransformEventTo52Format() ); + ::std::for_each( aChildEvents.begin(), aChildEvents.end(), TransformEventTo52Format() ); // revoke the script events m_xEventAttacher->revokeScriptEvents( i ); diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 8555605a3673..5e7776b62827 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -530,17 +530,16 @@ std::vector< OUString > JobData::getEnabledJobsForEvent( const css::uno::Referen // step over all job entries ... check her time stamps ... and put only job names to the // destination list, which represent an enabled job. css::uno::Sequence< OUString > lAllJobs = xJobList->getElementNames(); - OUString* pAllJobs = lAllJobs.getArray(); sal_Int32 c = lAllJobs.getLength(); std::vector< OUString > lEnabledJobs(c); sal_Int32 d = 0; - for (sal_Int32 s=0; s<c; ++s) + for (OUString const & jobName : lAllJobs) { css::uno::Reference< css::beans::XPropertySet > xJob; if ( - !(xJobList->getByName(pAllJobs[s]) >>= xJob) || + !(xJobList->getByName(jobName) >>= xJob) || !(xJob.is() ) ) { @@ -556,7 +555,7 @@ std::vector< OUString > JobData::getEnabledJobsForEvent( const css::uno::Referen if (!isEnabled(sAdminTime, sUserTime)) continue; - lEnabledJobs[d] = pAllJobs[s]; + lEnabledJobs[d] = jobName; ++d; } lEnabledJobs.resize(d); diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index 7b5478186671..cadc35d1504c 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -304,10 +304,8 @@ TransliterationImpl::transliterate( const OUString& inStr, sal_Int32 startPos, s tmpStr = bodyCascade[0]->transliterate(tmpStr, 0, nCount, offset); if ( startPos ) { - sal_Int32 * pArr = offset.getArray(); - nCount = offset.getLength(); - for (sal_Int32 j = 0; j < nCount; j++) - pArr[j] += startPos; + for (sal_Int32 & j : offset) + j += startPos; } return tmpStr; } @@ -319,7 +317,7 @@ TransliterationImpl::transliterate( const OUString& inStr, sal_Int32 startPos, s for (sal_Int32 j = 0; j < nCount; j++) pArr[j] = startPos + j; - sal_Int16 from = 0, to = 1, tmp; + sal_Int16 from = 0, to = 1; Sequence<sal_Int32> off[2]; off[to] = offset; @@ -330,7 +328,7 @@ TransliterationImpl::transliterate( const OUString& inStr, sal_Int32 startPos, s nCount = tmpStr.getLength(); assert(off[from].getLength() == nCount); - tmp = from; from = to; to = tmp; + std::swap(from, to); // tdf#89665: don't use operator[] to write - too slow! // interestingly gcc 4.9 -Os won't even inline the const operator[] sal_Int32 const*const pFrom(off[from].getConstArray()); @@ -366,10 +364,8 @@ TransliterationImpl::folding( const OUString& inStr, sal_Int32 startPos, sal_Int tmpStr = bodyCascade[0]->folding(tmpStr, 0, nCount, offset); if ( startPos ) { - sal_Int32 * pArr = offset.getArray(); - nCount = offset.getLength(); - for (sal_Int32 j = 0; j < nCount; j++) - pArr[j] += startPos; + for (sal_Int32 & j : offset) + j += startPos; } return tmpStr; } diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index e3f91af32ff2..1f62ca871a81 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -576,9 +576,7 @@ namespace if (bFound) { - Sequence< OUString > aNames(1); - OUString &rNodeName = aNames.getArray()[0]; - rNodeName = rLastFoundList + "/" + rCfgLocaleStr; + Sequence< OUString > aNames { rLastFoundList + "/" + rCfgLocaleStr }; Sequence< Any > aValues( rCfg.GetProperties( aNames ) ); if (aValues.getLength()) { @@ -604,12 +602,10 @@ namespace OUString *pRes = aRes.getArray(); sal_Int32 nCnt = 0; - sal_Int32 nEntries = rCfgSvcs.getLength(); - const OUString *pEntry = rCfgSvcs.getConstArray(); - for (sal_Int32 i = 0; i < nEntries; ++i) + for (OUString const & entry : rCfgSvcs) { - if (!pEntry[i].isEmpty() && lcl_FindEntry( pEntry[i], rAvailSvcs )) - pRes[ nCnt++ ] = pEntry[i]; + if (!entry.isEmpty() && lcl_FindEntry( entry, rAvailSvcs )) + pRes[ nCnt++ ] = entry; } aRes.realloc( nCnt ); @@ -1244,13 +1240,10 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp ) sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below - OUString aPrefix( aNode ); - aPrefix += "/"; - for (int i = 0; i < nLen; ++i) + OUString aPrefix = aNode + "/"; + for (OUString & name : aNames) { - OUString aTmp( aPrefix ); - aTmp += pNames[i]; - pNames[i] = aTmp; + name = aPrefix + name; } uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) ); @@ -1282,13 +1275,10 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp ) sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below - OUString aPrefix( aNode ); - aPrefix += "/"; - for (int i = 0; i < nLen; ++i) + OUString aPrefix = aNode + "/"; + for (OUString & name : aNames) { - OUString aTmp( aPrefix ); - aTmp += pNames[i]; - pNames[i] = aTmp; + name = aPrefix + name; } uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) ); @@ -1324,13 +1314,10 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ) sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below - OUString aPrefix( aNode ); - aPrefix += "/"; - for (int i = 0; i < nLen; ++i) + OUString aPrefix = aNode + "/"; + for (OUString & name : aNames) { - OUString aTmp( aPrefix ); - aTmp += pNames[i]; - pNames[i] = aTmp; + name = aPrefix + name; } uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) ); @@ -1366,13 +1353,10 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp ) sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below - OUString aPrefix( aNode ); - aPrefix += "/"; - for (int i = 0; i < nLen; ++i) + OUString aPrefix = aNode + "/"; + for (OUString & name : aNames) { - OUString aTmp( aPrefix ); - aTmp += pNames[i]; - pNames[i] = aTmp; + name = aPrefix + name; } uno::Sequence< uno::Any > aValues( /*aCfg.*/GetProperties( aNames ) ); diff --git a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx index a31fd64ee208..921962a3114b 100644 --- a/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx +++ b/reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx @@ -272,13 +272,11 @@ void SAL_CALL ImportDocumentHandler::startElement(const OUString & _sName, const break; } } - beans::PropertyValue* pArgIter = m_aArguments.getArray(); - beans::PropertyValue* pArgEnd = pArgIter + m_aArguments.getLength(); - for(;pArgIter != pArgEnd;++pArgIter) + for(beans::PropertyValue & propVal : m_aArguments) { - if ( pArgIter->Name == "HasCategories" ) + if ( propVal.Name == "HasCategories" ) { - pArgIter->Value <<= bHasCategories; + propVal.Value <<= bHasCategories; break; } } diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index d1b41f36fd70..7b3e73b8cf2b 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -287,15 +287,13 @@ namespace rptui ,PROPERTY_VERTICALALIGN }; - beans::Property* pPropsIter = aProps.getArray(); - beans::Property* pPropsEnd = pPropsIter + aProps.getLength(); - for (; pPropsIter != pPropsEnd; ++pPropsIter) + for (beans::Property const & prop : aProps) { size_t nPos = 0; - for (; nPos < SAL_N_ELEMENTS(pExcludeProperties) && pExcludeProperties[nPos] != pPropsIter->Name; ++nPos ) + for (; nPos < SAL_N_ELEMENTS(pExcludeProperties) && pExcludeProperties[nPos] != prop.Name; ++nPos ) ; if ( nPos == SAL_N_ELEMENTS(pExcludeProperties) ) - _rExcludeProperties.push_back(*pPropsIter); + _rExcludeProperties.push_back(prop); } } diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 846601146e0f..544dfb203638 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -778,12 +778,10 @@ sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt ) else aValues = svx::OMultiColumnTransferable::extractDescriptor(aDropped); - beans::PropertyValue* pIter = aValues.getArray(); - beans::PropertyValue* pEnd = pIter + aValues.getLength(); - for(;pIter != pEnd; ++pIter) + for(beans::PropertyValue & propVal : aValues) { uno::Sequence<beans::PropertyValue> aCurrent; - pIter->Value >>= aCurrent; + propVal.Value >>= aCurrent; sal_Int32 nLength = aCurrent.getLength(); if ( nLength ) { @@ -796,7 +794,7 @@ sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt ) aCurrent[nLength].Name = "Section"; aCurrent[nLength++].Value <<= getSection(); - pIter->Value <<= aCurrent; + propVal.Value <<= aCurrent; } } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index ecb71d622272..a8c1f9d021ee 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1265,8 +1265,6 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe if ( aAllreadyCopiedObjects.getLength() ) { - beans::NamedValue* pIter = aAllreadyCopiedObjects.getArray(); - const beans::NamedValue* pEnd = pIter + aAllreadyCopiedObjects.getLength(); try { uno::Reference<report::XReportDefinition> xReportDefinition = getView()->getReportView()->getController().getReportDefinition(); @@ -1280,10 +1278,10 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe aNewPos.Y() = 0; Point aPrevious; - for (; pIter != pEnd; ++pIter) + for (beans::NamedValue const & namedVal : aAllreadyCopiedObjects) { uno::Sequence< uno::Reference<report::XReportComponent> > aClones; - pIter->Value >>= aClones; + namedVal.Value >>= aClones; uno::Reference<report::XReportComponent>* pColIter = aClones.getArray(); const uno::Reference<report::XReportComponent>* pColEnd = pColIter + aClones.getLength(); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 8cdfb63c1d05..d341e582cac4 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -2113,15 +2113,14 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x nIndex = pCellStyles->GetIndexOfStyleName(sName, XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX, bIsAutoStyle); uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses()); - table::CellRangeAddress* pAddresses(aAddresses.getArray()); bool bGetMerge(true); - for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses) + for (table::CellRangeAddress const & address : aAddresses) { - pSharedData->SetLastColumn(nTable, pAddresses->EndColumn); - pSharedData->SetLastRow(nTable, pAddresses->EndRow); - pCellStyles->AddRangeStyleName(*pAddresses, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat); + pSharedData->SetLastColumn(nTable, address.EndColumn); + pSharedData->SetLastRow(nTable, address.EndRow); + pCellStyles->AddRangeStyleName(address, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat); if (bGetMerge) - bGetMerge = GetMerged(pAddresses, xTable); + bGetMerge = GetMerged(&address, xTable); } } } @@ -2137,17 +2136,16 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x if ( !pOldName ) { uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses()); - table::CellRangeAddress* pAddresses(aAddresses.getArray()); bool bGetMerge(true); - for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses) + for (table::CellRangeAddress const & address : aAddresses) { if (bGetMerge) - bGetMerge = GetMerged(pAddresses, xTable); - pCellStyles->AddRangeStyleName(*pAddresses, nIndex, false, nValidationIndex, nNumberFormat); + bGetMerge = GetMerged(&address, xTable); + pCellStyles->AddRangeStyleName(address, nIndex, false, nValidationIndex, nNumberFormat); if( sStyleName != "Default" || nValidationIndex != -1 ) { - pSharedData->SetLastColumn(nTable, pAddresses->EndColumn); - pSharedData->SetLastRow(nTable, pAddresses->EndRow); + pSharedData->SetLastColumn(nTable, address.EndColumn); + pSharedData->SetLastRow(nTable, address.EndRow); } } } diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index c9da280e6955..cc38b7059892 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -527,11 +527,8 @@ void ScChartObj::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno: if ( rValue >>= aCellRanges ) { ScRangeListRef rRangeList = new ScRangeList(); - const table::CellRangeAddress* pCellRanges = aCellRanges.getArray(); - sal_Int32 nCount = aCellRanges.getLength(); - for ( sal_Int32 i = 0; i < nCount; ++i ) + for ( table::CellRangeAddress const & aCellRange : aCellRanges ) { - table::CellRangeAddress aCellRange = pCellRanges[ i ]; ScRange aRange; ScUnoConversion::FillScRange( aRange, aCellRange ); rRangeList->Append( aRange ); diff --git a/sc/source/ui/vba/vbawsfunction.cxx b/sc/source/ui/vba/vbawsfunction.cxx index ca7cf6dadc08..dba387baf3cd 100644 --- a/sc/source/ui/vba/vbawsfunction.cxx +++ b/sc/source/ui/vba/vbawsfunction.cxx @@ -84,55 +84,53 @@ ScVbaWSFunction::invoke(const OUString& FunctionName, const uno::Sequence< uno:: uno::Sequence< uno::Any > aParamTemp( Params ); if( aParamTemp.hasElements() ) { - uno::Any* pArray = aParamTemp.getArray(); - uno::Any* pArrayEnd = pArray + aParamTemp.getLength(); - for( ; pArray < pArrayEnd; ++pArray ) + for( uno::Any & rArray : aParamTemp ) { - switch( pArray->getValueType().getTypeClass() ) + switch( rArray.getValueType().getTypeClass() ) { case uno::TypeClass_BOOLEAN: - lclConvertBooleanToDouble( *pArray ); + lclConvertBooleanToDouble( rArray ); break; case uno::TypeClass_INTERFACE: { - uno::Reference< excel::XRange > myRange( *pArray, uno::UNO_QUERY ); + uno::Reference< excel::XRange > myRange( rArray, uno::UNO_QUERY ); if( myRange.is() ) - *pArray = myRange->getCellRange(); + rArray = myRange->getCellRange(); } break; case uno::TypeClass_SEQUENCE: { // the sheet.FunctionAccess service doesn't deal with Sequences, only Sequences of Sequence - uno::Type aType = pArray->getValueType(); + uno::Type aType = rArray.getValueType(); if ( aType.equals( cppu::UnoType<uno::Sequence<sal_Int16>>::get() ) ) { uno::Sequence< uno::Sequence< sal_Int16 > > aTmp(1); - (*pArray) >>= aTmp[ 0 ]; - (*pArray) <<= aTmp; + rArray >>= aTmp[ 0 ]; + rArray <<= aTmp; } else if ( aType.equals( cppu::UnoType<uno::Sequence<sal_Int32>>::get() ) ) { uno::Sequence< uno::Sequence< sal_Int32 > > aTmp(1); - (*pArray) >>= aTmp[ 0 ]; - (*pArray) <<= aTmp; + rArray >>= aTmp[ 0 ]; + rArray <<= aTmp; } else if ( aType.equals( cppu::UnoType<uno::Sequence<double>>::get() ) ) { uno::Sequence< uno::Sequence< double > > aTmp(1); - (*pArray) >>= aTmp[ 0 ]; - (*pArray) <<= aTmp; + rArray >>= aTmp[ 0 ]; + rArray <<= aTmp; } else if ( aType.equals( cppu::UnoType<uno::Sequence<OUString>>::get() ) ) { uno::Sequence< uno::Sequence< OUString > > aTmp(1); - (*pArray) >>= aTmp[ 0 ]; - (*pArray) <<= aTmp; + rArray >>= aTmp[ 0 ]; + rArray <<= aTmp; } else if ( aType.equals( cppu::UnoType<uno::Sequence<uno::Any>>::get() ) ) { uno::Sequence< uno::Sequence<uno::Any > > aTmp(1); - (*pArray) >>= aTmp[ 0 ]; - (*pArray) <<= aTmp; + rArray >>= aTmp[ 0 ]; + rArray <<= aTmp; } } break; diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index 7b29b4c98759..e60161a9ea87 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -407,19 +407,18 @@ Sequence< ScriptEventDescriptor > ScriptEventHelper::createEvents( const OUString& sCodeName ) { Sequence< OUString > aControlListeners = getEventListeners(); - OUString* pSrc = aControlListeners.getArray(); sal_Int32 nLength = aControlListeners.getLength(); Sequence< ScriptEventDescriptor > aDest( nLength ); sal_Int32 nEvts = 0; - for ( sal_Int32 i = 0; i< nLength; ++i, ++pSrc ) + for ( OUString const & i : aControlListeners) { // from getListeners eventName is of form // "com.sun.star.awt.XActionListener::actionPerformed" // we need to strip "com.sun.star.awt." from that for form // controls ScriptEventDescriptor evtDesc; - if ( eventMethodToDescriptor( *pSrc, evtDesc, sCodeName ) ) + if ( eventMethodToDescriptor( i, evtDesc, sCodeName ) ) { sal_Int32 dIndex = nEvts; ++nEvts; diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx index 4fabb79b2262..e7b22927d0f0 100644 --- a/sd/source/core/CustomAnimationCloner.cxx +++ b/sd/source/core/CustomAnimationCloner.cxx @@ -187,12 +187,9 @@ namespace sd Sequence< NamedValue > aUserData( xNode->getUserData() ); if( aUserData.hasElements() ) { - NamedValue* pValue = aUserData.getArray(); - const sal_Int32 nLength = aUserData.getLength(); - sal_Int32 nElement; - for( nElement = 0; nElement < nLength; nElement++, pValue++ ) + for( NamedValue & namedValue : aUserData ) { - pValue->Value = transformValue( pValue->Value ); + namedValue.Value = transformValue( namedValue.Value ); } xNode->setUserData( aUserData ); diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index bd19a80f2f08..b5754b73064e 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -845,25 +845,24 @@ bool PPTWriter::ImplCreateDocument() if ( aXCont.is() ) { css::uno::Sequence< OUString> aNameSeq( aXCont->getElementNames() ); - const OUString* pUString = aNameSeq.getArray(); - sal_uInt32 nCount = aNameSeq.getLength(); - if ( nCount ) + if ( aNameSeq.getLength() ) { mpPptEscherEx->OpenContainer( EPP_NamedShows ); sal_uInt32 nCustomShowIndex = 0; - for( i = 0; i < nCount; i++ ) // number of custom shows + for( OUString const & customShowName : aNameSeq ) { - if ( !pUString[ i ].isEmpty() ) + if ( !customShowName.isEmpty() ) { mpPptEscherEx->OpenContainer( EPP_NamedShow, nCustomShowIndex++ ); - sal_uInt32 nNamedShowLen = pUString[ i ].getLength(); + sal_uInt32 nNamedShowLen = customShowName.getLength(); if ( nNamedShowLen > 31 ) nNamedShowLen = 31; mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString ); - const sal_Unicode* pCustomShowName = pUString[ i ].getStr(); - for ( sal_uInt32 k = 0; k < nNamedShowLen; mpStrm->WriteUInt16( pCustomShowName[ k++ ] ) ) ; - mAny = aXCont->getByName( pUString[ i ] ); + const sal_Unicode* pCustomShowName = customShowName.getStr(); + for ( sal_uInt32 k = 0; k < nNamedShowLen; ++k ) + mpStrm->WriteUInt16( pCustomShowName[ k ] ); + mAny = aXCont->getByName( customShowName ); css::uno::Reference< css::container::XIndexContainer > aXIC; if ( mAny >>= aXIC ) { diff --git a/sdext/source/minimizer/pagecollector.cxx b/sdext/source/minimizer/pagecollector.cxx index 3c59b12d04d7..874bbf0a9150 100644 --- a/sdext/source/minimizer/pagecollector.cxx +++ b/sdext/source/minimizer/pagecollector.cxx @@ -45,13 +45,11 @@ void PageCollector::CollectCustomShowPages( const css::uno::Reference< css::fram { // creating a list of every page that is used within our customshow Sequence< OUString> aNameSeq( aXCont->getElementNames() ); - const OUString* pUString = aNameSeq.getArray(); - sal_Int32 i, nCount = aNameSeq.getLength(); - for ( i = 0; i < nCount; i++ ) + for ( OUString const & i :aNameSeq ) { - if ( pUString[ i ] == rCustomShowName ) + if ( i == rCustomShowName ) { - Reference< container::XIndexContainer > aXIC( aXCont->getByName( pUString[ i ] ), UNO_QUERY_THROW ); + Reference< container::XIndexContainer > aXIC( aXCont->getByName( i ), UNO_QUERY_THROW ); sal_Int32 j, nSlideCount = aXIC->getCount(); for ( j = 0; j < nSlideCount; j++ ) { diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index b7a602e7ecac..3e11d9d4c1db 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -815,10 +815,8 @@ namespace sfx2 Sequence< StringPair > aFilters( comphelper::containerToSequence(_rGroup) ); if ( _bAddExtension ) { - StringPair* pFilters = aFilters.getArray(); - StringPair* pEnd = pFilters + aFilters.getLength(); - for ( ; pFilters != pEnd; ++pFilters ) - pFilters->First = addExtension( pFilters->First, pFilters->Second, true, *m_pFileDlgImpl ); + for ( StringPair & filter : aFilters ) + filter.First = addExtension( filter.First, filter.Second, true, *m_pFileDlgImpl ); } m_xFilterGroupManager->appendFilterGroup( OUString(), aFilters ); } diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx index 800cbf7e304b..a8bb0b0d3243 100644 --- a/svtools/source/config/extcolorcfg.cxx +++ b/svtools/source/config/extcolorcfg.cxx @@ -132,11 +132,9 @@ public: uno::Sequence< OUString> ExtendedColorConfig_Impl::GetPropertyNames(const OUString& rScheme) { uno::Sequence< OUString> aNames(GetNodeNames(rScheme)); - OUString* pIter = aNames.getArray(); - OUString* pEnd = pIter + aNames.getLength(); - for(;pIter != pEnd;++pIter) + for(OUString & i : aNames) { - *pIter = rScheme + "/" + *pIter; + i = rScheme + "/" + i; } return aNames; } @@ -221,10 +219,8 @@ void ExtendedColorConfig_Impl::EnableBroadcast() void lcl_addString(uno::Sequence < OUString >& _rSeq,const OUString& _sAdd) { - OUString* pIter = _rSeq.getArray(); - OUString* pEnd = pIter + _rSeq.getLength(); - for(;pIter != pEnd;++pIter) - *pIter += _sAdd; + for(OUString & i : _rSeq) + i += _sAdd; } void ExtendedColorConfig_Impl::Load(const OUString& rScheme) @@ -237,23 +233,20 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme) TDisplayNames aDisplayNameMap; uno::Sequence < OUString > aComponentNames = GetPropertyNames("EntryNames"); OUString sDisplayName("/DisplayName"); - OUString* pIter = aComponentNames.getArray(); - OUString* pEnd = pIter + aComponentNames.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) + for(OUString & componentName : aComponentNames) { uno::Sequence < OUString > aComponentDisplayNames(1); - aComponentDisplayNames[0] = *pIter - + sDisplayName; + aComponentDisplayNames[0] = componentName + sDisplayName; uno::Sequence< uno::Any > aComponentDisplayNamesValue = GetProperties( aComponentDisplayNames ); OUString sComponentDisplayName; if ( aComponentDisplayNamesValue.getLength() && (aComponentDisplayNamesValue[0] >>= sComponentDisplayName) ) { sal_Int32 nIndex = 0; - m_aComponentDisplayNames.insert(TDisplayNames::value_type(pIter->getToken(1,'/',nIndex),sComponentDisplayName)); + m_aComponentDisplayNames.insert(TDisplayNames::value_type(componentName.getToken(1,'/',nIndex),sComponentDisplayName)); } - *pIter += "/Entries"; - uno::Sequence < OUString > aDisplayNames = GetPropertyNames(*pIter); + componentName += "/Entries"; + uno::Sequence < OUString > aDisplayNames = GetPropertyNames(componentName); lcl_addString(aDisplayNames,sDisplayName); uno::Sequence< uno::Any > aDisplayNamesValue = GetProperties( aDisplayNames ); @@ -315,15 +308,12 @@ void ExtendedColorConfig_Impl::Load(const OUString& rScheme) void ExtendedColorConfig_Impl::FillComponentColors(uno::Sequence < OUString >& _rComponents,const TDisplayNames& _rDisplayNames) { const OUString sColorEntries("/Entries"); - OUString* pIter = _rComponents.getArray(); - OUString* pEnd = pIter + _rComponents.getLength(); - for(;pIter != pEnd;++pIter) + for(OUString const & component : _rComponents) { - OUString sComponentName = pIter->copy(pIter->lastIndexOf('/')+1); + OUString sComponentName = component.copy(component.lastIndexOf('/')+1); if ( m_aConfigValues.find(sComponentName) == m_aConfigValues.end() ) { - OUString sEntry = *pIter - + sColorEntries; + OUString sEntry = component + sColorEntries; uno::Sequence < OUString > aColorNames = GetPropertyNames(sEntry); uno::Sequence < OUString > aDefaultColorNames = aColorNames; diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx index 888965e6ea2e..1ee45524aed9 100644 --- a/svx/source/dialog/rubydialog.cxx +++ b/svx/source/dialog/rubydialog.cxx @@ -436,13 +436,12 @@ void SvxRubyDialog::GetRubyText() DBG_ASSERT(aRubyValues.getLength() > (i / 2 + nTempLastPos), "wrong index" ); SetModified(true); Sequence<PropertyValue>& rProps = aRubyValues.getArray()[i / 2 + nTempLastPos]; - PropertyValue* pProps = rProps.getArray(); - for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++) + for (PropertyValue & propVal : rProps) { - if (pProps[nProp].Name == cRubyBaseText) - pProps[nProp].Value <<= aEditArr[i]->GetText(); - else if (pProps[nProp].Name == cRubyText) - pProps[nProp].Value <<= aEditArr[i + 1]->GetText(); + if (propVal.Name == cRubyBaseText) + propVal.Value <<= aEditArr[i]->GetText(); + else if (propVal.Name == cRubyText) + propVal.Value <<= aEditArr[i + 1]->GetText(); } } } @@ -597,14 +596,12 @@ IMPL_LINK(SvxRubyDialog, AdjustHdl_Impl, ListBox&, rBox, void) AssertOneEntry(); sal_Int16 nAdjust = rBox.GetSelectEntryPos(); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); - for (sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++) + for (PropertyValues & rProps : aRubyValues) { - Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby]; - PropertyValue* pProps = rProps.getArray(); - for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++) + for (PropertyValue & propVal : rProps) { - if (pProps[nProp].Name == cRubyAdjust) - pProps[nProp].Value <<= nAdjust; + if (propVal.Name == cRubyAdjust) + propVal.Value <<= nAdjust; } SetModified(true); } @@ -616,14 +613,12 @@ IMPL_LINK(SvxRubyDialog, PositionHdl_Impl, ListBox&, rBox, void) AssertOneEntry(); bool bAbove = !rBox.GetSelectEntryPos(); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); - for (sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++) + for (PropertyValues & rProps : aRubyValues) { - Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby]; - PropertyValue* pProps = rProps.getArray(); - for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++) + for (PropertyValue & propVal : rProps) { - if (pProps[nProp].Name == cRubyIsAbove) - pProps[nProp].Value <<= bAbove; + if (propVal.Name == cRubyIsAbove) + propVal.Value <<= bAbove; } SetModified(true); } @@ -637,15 +632,13 @@ IMPL_LINK_NOARG(SvxRubyDialog, CharStyleHdl_Impl, ListBox&, void) if (LISTBOX_ENTRY_NOTFOUND != m_pCharStyleLB->GetSelectEntryPos()) sStyleName = *static_cast<OUString*>(m_pCharStyleLB->GetSelectEntryData()); Sequence<PropertyValues>& aRubyValues = m_pImpl->GetRubyValues(); - for (sal_Int32 nRuby = 0; nRuby < aRubyValues.getLength(); nRuby++) + for (PropertyValues & rProps : aRubyValues) { - Sequence<PropertyValue> &rProps = aRubyValues.getArray()[nRuby]; - PropertyValue* pProps = rProps.getArray(); - for (sal_Int32 nProp = 0; nProp < rProps.getLength(); nProp++) + for (PropertyValue & propVal : rProps) { - if (pProps[nProp].Name == cRubyCharStyleName) + if (propVal.Name == cRubyCharStyleName) { - pProps[nProp].Value <<= sStyleName; + propVal.Value <<= sStyleName; } } SetModified(true); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 6b61ab0acd5b..ada679becd45 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -2682,9 +2682,8 @@ Sequence< css::util::URL>& FmXGridPeer::getSupportedURLs() // let an css::util::URL-transformer normalize the URLs Reference< css::util::XURLTransformer > xTransformer( util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); - pSupported = aSupported.getArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i) - xTransformer->parseStrict(pSupported[i]); + for (css::util::URL & rURL : aSupported) + xTransformer->parseStrict(rURL); } return aSupported; diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index bb780941d291..0e285474c6ad 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2838,11 +2838,10 @@ Reference< XControl> FmXFormShell::impl_getControl( const Reference< XControlMod Reference< XControlContainer> xControlContainer( getControlContainerForView(), UNO_SET_THROW ); Sequence< Reference< XControl > > seqControls( xControlContainer->getControls() ); - const Reference< XControl >* pControls = seqControls.getArray(); // ... that I can then search - for (sal_Int32 i=0; i<seqControls.getLength(); ++i) + for (Reference< XControl > const & control : seqControls) { - xControl.set( pControls[i], UNO_SET_THROW ); + xControl.set( control, UNO_SET_THROW ); Reference< XControlModel > xCurrentModel( xControl->getModel() ); if ( xCurrentModel == i_rxModel ) break; diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 5de1ae5490cf..ffa434938cae 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -980,14 +980,12 @@ namespace svxform #endif // (OSL_DEBUG_LEVEL > 0) Reference< XPropertySetInfo > xPropInfo( xCurrent->getPropertySetInfo()); Sequence< Property> seqAllCurrentProps = xPropInfo->getProperties(); - Property* pAllCurrentProps = seqAllCurrentProps.getArray(); - for (sal_Int32 j=0; j<seqAllCurrentProps.getLength(); ++j) + for (Property const & currentProp : seqAllCurrentProps) { - OUString sCurrentProp = pAllCurrentProps[j].Name; - if (((pAllCurrentProps[j].Attributes & PropertyAttribute::READONLY) == 0) && (sCurrentProp != FM_PROP_NAME)) + if (((currentProp.Attributes & PropertyAttribute::READONLY) == 0) && (currentProp.Name != FM_PROP_NAME)) { // (read-only attribs aren't set, ditto name, // NewControl defined it uniquely - xNewPropSet->setPropertyValue(sCurrentProp, xCurrent->getPropertyValue(sCurrentProp)); + xNewPropSet->setPropertyValue(currentProp.Name, xCurrent->getPropertyValue(currentProp.Name)); } } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index f1bb51abe791..80d89d6ade9f 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1550,14 +1550,13 @@ void SwInsertDBColAutoPilot::Notify( const css::uno::Sequence< OUString >& ) {} void SwInsertDBColAutoPilot::ImplCommit() { Sequence <OUString> aNames = GetNodeNames(OUString()); - const OUString* pNames = aNames.getArray(); //remove entries that contain this data source + table at first - for(sal_Int32 nNode = 0; nNode < aNames.getLength(); nNode++) + for(OUString const & nodeName : aNames) { Sequence<OUString> aSourceNames(2); OUString* pSourceNames = aSourceNames.getArray(); - pSourceNames[0] = pNames[nNode] + "/DataSource"; - pSourceNames[1] = pNames[nNode] + "/Command"; + pSourceNames[0] = nodeName + "/DataSource"; + pSourceNames[1] = nodeName + "/Command"; Sequence<Any> aSourceProperties = GetProperties(aSourceNames); const Any* pSourceProps = aSourceProperties.getArray(); OUString sSource, sCommand; @@ -1565,7 +1564,7 @@ void SwInsertDBColAutoPilot::ImplCommit() pSourceProps[1] >>= sCommand; if(sSource==aDBData.sDataSource && sCommand==aDBData.sCommand) { - Sequence<OUString> aElements { pNames[nNode] }; + Sequence<OUString> aElements { nodeName }; ClearNodeElements(OUString(), aElements); } } @@ -1663,13 +1662,12 @@ void SwInsertDBColAutoPilot::ImplCommit() void SwInsertDBColAutoPilot::Load() { - Sequence <OUString> aNames = GetNodeNames(OUString()); - const OUString* pNames = aNames.getArray(); + Sequence<OUString> aNames = GetNodeNames(OUString()); SvNumberFormatter& rNFormatr = *pView->GetWrtShell().GetNumberFormatter(); - for(sal_Int32 nNode = 0; nNode < aNames.getLength(); nNode++) + for(OUString const & nodeName : aNames) { //search for entries with the appropriate data source and table - Sequence<OUString> aSourceNames = lcl_createSourceNames(pNames[nNode]); + Sequence<OUString> aSourceNames = lcl_createSourceNames(nodeName); Sequence< Any> aDataSourceProps = GetProperties(aSourceNames); const Any* pDataSourceProps = aDataSourceProps.getConstArray(); @@ -1697,7 +1695,7 @@ void SwInsertDBColAutoPilot::Load() if(pDataSourceProps[10].hasValue()) pNewData->bIsEmptyHeadln = *o3tl::doAccess<bool>(pDataSourceProps[10]); - const OUString sSubNodeName(pNames[nNode] + "/ColumnSet/"); + const OUString sSubNodeName(nodeName + "/ColumnSet/"); Sequence <OUString> aSubNames = GetNodeNames(sSubNodeName); const OUString* pSubNames = aSubNames.getConstArray(); for(sal_Int32 nSub = 0; nSub < aSubNames.getLength(); nSub++) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 37e62f4f2450..35a6e34e765b 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -850,12 +850,8 @@ SwFieldDialog::SwFieldDialog( SwEditWin* parent, IFieldmark *fieldBM ) : { Sequence< OUString > vListEntries; pListEntries->second >>= vListEntries; - for( OUString* pCurrent = vListEntries.getArray(); - pCurrent != vListEntries.getArray() + vListEntries.getLength(); - ++pCurrent) - { - aListBox->InsertEntry(*pCurrent); - } + for( OUString const & i : vListEntries) + aListBox->InsertEntry(i); } // Select the current one diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 4aee2bc88418..fc585806aceb 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -211,12 +211,10 @@ UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rMode Reference<XNameContainer > xNameCont( new SimpleNamedThingContainer< XControlModel > ); uno::Sequence< OUString > sNames = xSrcNameCont->getElementNames(); - OUString* pName = sNames.getArray(); - OUString* pNamesEnd = pName + sNames.getLength(); - for ( ; pName != pNamesEnd; ++pName ) + for ( OUString const & name : sNames ) { - if ( xSrcNameCont->hasByName( *pName ) ) - xNameCont->insertByName( *pName, xSrcNameCont->getByName( *pName ) ); + if ( xSrcNameCont->hasByName( name ) ) + xNameCont->insertByName( name, xSrcNameCont->getByName( name ) ); } setFastPropertyValue_NoBroadcast( BASEPROPERTY_USERFORMCONTAINEES, makeAny( xNameCont ) ); } diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx index 68b8a960d12a..f5d3527fdc06 100644 --- a/toolkit/source/controls/unocontrolcontainer.cxx +++ b/toolkit/source/controls/unocontrolcontainer.cxx @@ -423,14 +423,12 @@ void UnoControlContainer::dispose( ) uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls(); - uno::Reference< awt::XControl >* pCtrls = aCtrls.getArray(); - uno::Reference< awt::XControl >* pCtrlsEnd = pCtrls + aCtrls.getLength(); - for( ; pCtrls < pCtrlsEnd; ++pCtrls ) + for( uno::Reference< awt::XControl > const & control : aCtrls ) { - removingControl( *pCtrls ); + removingControl( control ); // Delete control - (*pCtrls)->dispose(); + control->dispose(); } diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx index cbd7d57770ba..b252b43bcd72 100644 --- a/vcl/unx/generic/dtrans/config.cxx +++ b/vcl/unx/generic/dtrans/config.cxx @@ -75,10 +75,9 @@ DtransX11ConfigItem::DtransX11ConfigItem() : #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "found %" SAL_PRIdINT32 " properties for %s\n", aValues.getLength(), SELECTION_PROPERTY ); #endif - Any* pValue = aValues.getArray(); - for( int i = 0; i < aValues.getLength(); i++, pValue++ ) + for( Any const & value : aValues ) { - if( auto pLine = o3tl::tryAccess<OUString>(*pValue) ) + if( auto pLine = o3tl::tryAccess<OUString>(value) ) { if( !pLine->isEmpty() ) { @@ -94,7 +93,7 @@ DtransX11ConfigItem::DtransX11ConfigItem() : #if OSL_DEBUG_LEVEL > 1 else fprintf( stderr, "found SelectionTimeout of type \"%s\"\n", - OUStringToOString( pValue->getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() ); + OUStringToOString( value.getValueType().getTypeName(), osl_getThreadTextEncoding() ).getStr() ); #endif } } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 9dfa48f1d657..7fbefaf73568 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -170,11 +170,9 @@ typedef std::unordered_map<OUString, FieldConversion, OUStringHash> FieldConvers uno::Any FloatingTableInfo::getPropertyValue(const OUString &propertyName) { - - beans::PropertyValue* pFrameProperties = m_aFrameProperties.getArray(); - for( int i = 0 ; i < m_aFrameProperties.getLength(); i++ ) - if( pFrameProperties[i].Name == propertyName ) - return pFrameProperties[i].Value ; + for( beans::PropertyValue const & propVal : m_aFrameProperties ) + if( propVal.Name == propertyName ) + return propVal.Value ; return uno::Any() ; } diff --git a/writerfilter/source/dmapper/PropertyMapHelper.cxx b/writerfilter/source/dmapper/PropertyMapHelper.cxx index e1afdd6d23ed..d4735d9c7b1e 100644 --- a/writerfilter/source/dmapper/PropertyMapHelper.cxx +++ b/writerfilter/source/dmapper/PropertyMapHelper.cxx @@ -54,31 +54,29 @@ void lcl_DumpTableColumnSeparators(const uno::Any & rTableColumnSeparators) } #ifdef DEBUG_WRITERFILTER -void lcl_DumpPropertyValues(beans::PropertyValues & rValues) +void lcl_DumpPropertyValues(beans::PropertyValues const & rValues) { TagLogger::getInstance().startElement("propertyValues"); - beans::PropertyValue * pValues = rValues.getArray(); - - for (sal_Int32 n = 0; n < rValues.getLength(); ++n) + for (beans::PropertyValue const & propVal : rValues) { TagLogger::getInstance().startElement("propertyValue"); - TagLogger::getInstance().attribute("name", pValues[n].Name); + TagLogger::getInstance().attribute("name", propVal.Name); try { sal_Int32 aInt = 0; - pValues[n].Value >>= aInt; + propVal.Value >>= aInt; TagLogger::getInstance().attribute("value", aInt); } catch (...) { } - if ( pValues[n].Name == "TableColumnSeparators" ) + if ( propVal.Name == "TableColumnSeparators" ) { - lcl_DumpTableColumnSeparators(pValues[n].Value); + lcl_DumpTableColumnSeparators(propVal.Value); } TagLogger::getInstance().endElement(); @@ -86,15 +84,13 @@ void lcl_DumpPropertyValues(beans::PropertyValues & rValues) TagLogger::getInstance().endElement(); } -void lcl_DumpPropertyValueSeq(css::uno::Sequence<css::beans::PropertyValues> & rPropValSeq) +void lcl_DumpPropertyValueSeq(css::uno::Sequence<css::beans::PropertyValues> const & rPropValSeq) { TagLogger::getInstance().startElement("PropertyValueSeq"); - beans::PropertyValues * pValues = rPropValSeq.getArray(); - - for (sal_Int32 n = 0; n < rPropValSeq.getLength(); ++n) + for (auto const & propVal : rPropValSeq) { - lcl_DumpPropertyValues(pValues[n]); + lcl_DumpPropertyValues(propVal); } TagLogger::getInstance().endElement(); diff --git a/writerfilter/source/dmapper/PropertyMapHelper.hxx b/writerfilter/source/dmapper/PropertyMapHelper.hxx index 4bc6ad8f65f1..84ad696c619d 100644 --- a/writerfilter/source/dmapper/PropertyMapHelper.hxx +++ b/writerfilter/source/dmapper/PropertyMapHelper.hxx @@ -30,9 +30,9 @@ namespace dmapper void lcl_DumpTableColumnSeparators(const css::uno::Any & rTableColumnSeparators); #ifdef DEBUG_WRITERFILTER -void lcl_DumpPropertyValues(css::beans::PropertyValues & rValues); +void lcl_DumpPropertyValues(css::beans::PropertyValues const & rValues); -void lcl_DumpPropertyValueSeq(css::uno::Sequence<css::beans::PropertyValues> & rPropValSeq); +void lcl_DumpPropertyValueSeq(css::uno::Sequence<css::beans::PropertyValues> const & rPropValSeq); #endif // DEBUG_WRITERFILTER } } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index c2ae8e7663e3..c331d833a72c 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -635,16 +635,11 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo if( xNamespaceMap.is() ) { Sequence< OUString > aPrefixes( xNamespaceMap->getElementNames() ); - - OUString* pPrefix = aPrefixes.getArray(); - const sal_Int32 nCount = aPrefixes.getLength(); - sal_Int32 nIndex; - OUString aURL; - - for( nIndex = 0; nIndex < nCount; ++nIndex, ++pPrefix ) + for( OUString const & prefix : aPrefixes ) { - if( xNamespaceMap->getByName( *pPrefix ) >>= aURL ) - GetNamespaceMap_().Add( *pPrefix, aURL ); + OUString aURL; + if( xNamespaceMap->getByName( prefix ) >>= aURL ) + GetNamespaceMap_().Add( prefix, aURL ); } } } diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 68eba5a5bf62..0a9dc7be5b43 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -1250,14 +1250,11 @@ void XMLEnhancedCustomShapeContext::EndElement() } ++aPathIter; } - std::vector< beans::PropertyValues >::iterator aHandleIter = maHandles.begin(); - std::vector< beans::PropertyValues >::iterator aHandleEnd = maHandles.end(); - while ( aHandleIter != aHandleEnd ) + for ( css::beans::PropertyValues const & aHandle : maHandles ) { - beans::PropertyValue* pValues = aHandleIter->getArray(); - for ( i = 0; i < aHandleIter->getLength(); i++ ) + for ( beans::PropertyValue const & propValue : aHandle ) { - switch( EASGet( pValues->Name ) ) + switch( EASGet( propValue.Name ) ) { case EAS_RangeYMinimum : case EAS_RangeYMaximum : @@ -1267,7 +1264,7 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_RadiusRangeMaximum : { CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>(*o3tl::doAccess<css::drawing::EnhancedCustomShapeParameter>( - pValues->Value)), pH.get() ); + propValue.Value)), pH.get() ); } break; @@ -1275,17 +1272,15 @@ void XMLEnhancedCustomShapeContext::EndElement() case EAS_Polar : { CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>((*o3tl::doAccess<css::drawing::EnhancedCustomShapeParameterPair>( - pValues->Value)).First), pH.get() ); + propValue.Value)).First), pH.get() ); CheckAndResolveEquationParameter( const_cast<css::drawing::EnhancedCustomShapeParameter &>((*o3tl::doAccess<css::drawing::EnhancedCustomShapeParameterPair>( - pValues->Value)).Second), pH.get() ); + propValue.Value)).Second), pH.get() ); } break; default: break; } - pValues++; } - ++aHandleIter; } } |