From b33ff1a083d95388997cf301d8a1538a41c08255 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 20 May 2020 08:48:56 +0200 Subject: use for-range on Sequence in e* Change-Id: I77dc12356ee45b1dee9acaf8a73dea81588822d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94554 Tested-by: Jenkins Reviewed-by: Noel Grandin --- editeng/qa/unit/core-test.cxx | 4 +- editeng/source/misc/svxacorr.cxx | 5 +- editeng/source/uno/unonrule.cxx | 4 +- embeddedobj/source/commonembedding/embedobj.cxx | 4 +- embeddedobj/source/commonembedding/miscobj.cxx | 68 +++++----- embeddedobj/source/commonembedding/persistence.cxx | 150 ++++++++++----------- embeddedobj/source/commonembedding/xfactory.cxx | 12 +- embeddedobj/source/general/docholder.cxx | 6 +- embeddedobj/source/general/xcreator.cxx | 6 +- embeddedobj/source/msole/olecomponent.cxx | 16 +-- embeddedobj/source/msole/oleembed.cxx | 10 +- embeddedobj/source/msole/olepersist.cxx | 32 ++--- embeddedobj/source/msole/ownview.cxx | 12 +- embeddedobj/source/msole/xolefactory.cxx | 6 +- embedserv/source/embed/intercept.cxx | 5 +- eventattacher/source/eventattacher.cxx | 20 ++- extensions/source/bibliography/bibconfig.cxx | 14 +- extensions/source/ole/oleobjw.cxx | 8 +- .../source/update/check/updatecheckconfig.hxx | 8 +- extensions/source/update/check/updatehdl.cxx | 8 +- 20 files changed, 192 insertions(+), 206 deletions(-) diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index b5b133f047a6..a91565bce2a9 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -231,8 +231,8 @@ void Test::testConstruction() bool includes(const uno::Sequence& rSeq, const OUString& rVal) { - for (sal_Int32 i = 0, n = rSeq.getLength(); i < n; ++i) - if (rSeq[i] == rVal) + for (OUString const & s : rSeq) + if (s == rVal) return true; return false; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 1242852d6213..71f6efc2e33f 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -502,10 +502,9 @@ bool SvxAutoCorrect::FnChgOrdinalNumber( uno::Reference< i18n::XOrdinalSuffix > xOrdSuffix = i18n::OrdinalSuffix::create(comphelper::getProcessComponentContext()); - uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); - for (sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++) + const uno::Sequence< OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix(nNum, rCC.getLanguageTag().getLocale()); + for (OUString const & sSuffix : aSuffixes) { - OUString sSuffix(aSuffixes[nSuff]); OUString sEnd = rTxt.copy(nNumEnd + 1, nEndPos - nNumEnd - 1); if (sSuffix == sEnd) diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index 03c051ebaeed..57b68a0de1d3 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -270,10 +270,8 @@ Sequence SvxUnoNumberingRules::getNumberingRuleByIndex(sal void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence& rProperties, sal_Int32 nIndex) { SvxNumberFormat aFmt(maRule.GetLevel( static_cast(nIndex) )); - const beans::PropertyValue* pPropArray = rProperties.getConstArray(); - for(int i = 0; i < rProperties.getLength(); i++) + for(const beans::PropertyValue& rProp : rProperties) { - const beans::PropertyValue& rProp = pPropArray[i]; const OUString& rPropName = rProp.Name; const Any& aVal = rProp.Value; diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index abc43f42736f..669ba884b055 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -447,8 +447,8 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState ) StateChangeNotification_Impl( true, nOldState, nNewState,aGuard ); try { - for ( sal_Int32 nInd = 0; nInd < aIntermediateStates.getLength(); nInd++ ) - SwitchStateTo_Impl( aIntermediateStates[nInd] ); + for ( sal_Int32 state : aIntermediateStates ) + SwitchStateTo_Impl( state ); SwitchStateTo_Impl( nNewState ); } diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 3363a02bfd02..ea2a3cb3c110 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -98,18 +98,18 @@ void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedVa // parse configuration entries // TODO/LATER: in future UI names can be also provided here - for ( sal_Int32 nInd = 0; nInd < aObjectProps.getLength(); nInd++ ) + for ( beans::NamedValue const & prop : aObjectProps ) { - if ( aObjectProps[nInd].Name == "ClassID" ) - aObjectProps[nInd].Value >>= m_aClassID; - else if ( aObjectProps[nInd].Name == "ObjectDocumentServiceName" ) - aObjectProps[nInd].Value >>= m_aDocServiceName; - else if ( aObjectProps[nInd].Name == "ObjectDocumentFilterName" ) - aObjectProps[nInd].Value >>= m_aPresetFilterName; - else if ( aObjectProps[nInd].Name == "ObjectMiscStatus" ) - aObjectProps[nInd].Value >>= m_nMiscStatus; - else if ( aObjectProps[nInd].Name == "ObjectVerbs" ) - aObjectProps[nInd].Value >>= m_aObjectVerbs; + if ( prop.Name == "ClassID" ) + prop.Value >>= m_aClassID; + else if ( prop.Name == "ObjectDocumentServiceName" ) + prop.Value >>= m_aDocServiceName; + else if ( prop.Name == "ObjectDocumentFilterName" ) + prop.Value >>= m_aPresetFilterName; + else if ( prop.Name == "ObjectMiscStatus" ) + prop.Value >>= m_nMiscStatus; + else if ( prop.Name == "ObjectVerbs" ) + prop.Value >>= m_aObjectVerbs; } if ( m_aClassID.getLength() != 16 /*|| !m_aDocServiceName.getLength()*/ ) @@ -161,31 +161,31 @@ void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedVa m_pIntermediateStatesSeqs[4][0][0] = embed::EmbedStates::RUNNING; // verbs table - for ( sal_Int32 nVerbInd = 0; nVerbInd < m_aObjectVerbs.getLength(); nVerbInd++ ) + for ( auto const & verb : std::as_const(m_aObjectVerbs) ) { - if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_PRIMARY ) + if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_PRIMARY ) { - m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, embed::EmbedStates::UI_ACTIVE } ); + m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::UI_ACTIVE } ); } - else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_SHOW ) + else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_SHOW ) { - m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, embed::EmbedStates::UI_ACTIVE } ); + m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::UI_ACTIVE } ); } - else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN ) + else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN ) { - m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, embed::EmbedStates::ACTIVE } ); + m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::ACTIVE } ); } - else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_IPACTIVATE ) + else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_IPACTIVATE ) { - m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, embed::EmbedStates::INPLACE_ACTIVE } ); + m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::INPLACE_ACTIVE } ); } - else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_UIACTIVATE ) + else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_UIACTIVATE ) { - m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, embed::EmbedStates::UI_ACTIVE } ); + m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::UI_ACTIVE } ); } - else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_HIDE ) + else if ( verb.VerbID == embed::EmbedVerbs::MS_OLEVERB_HIDE ) { - m_aVerbTable.insert( { m_aObjectVerbs[nVerbInd].VerbID, embed::EmbedStates::RUNNING } ); + m_aVerbTable.insert( { verb.VerbID, embed::EmbedStates::RUNNING } ); } } } @@ -198,11 +198,11 @@ void OCommonEmbeddedObject::LinkInit_Impl( { // setPersistance has no effect on own links, so the complete initialization must be done here - for ( sal_Int32 nInd = 0; nInd < aMediaDescr.getLength(); nInd++ ) - if ( aMediaDescr[nInd].Name == "URL" ) - aMediaDescr[nInd].Value >>= m_aLinkURL; - else if ( aMediaDescr[nInd].Name == "FilterName" ) - aMediaDescr[nInd].Value >>= m_aLinkFilterName; + for ( beans::PropertyValue const & prop : aMediaDescr ) + if ( prop.Name == "URL" ) + prop.Value >>= m_aLinkURL; + else if ( prop.Name == "FilterName" ) + prop.Value >>= m_aLinkFilterName; OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!" ); @@ -217,15 +217,15 @@ void OCommonEmbeddedObject::LinkInit_Impl( m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, false ); uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor; - for ( sal_Int32 nObjInd = 0; nObjInd < aObjectDescr.getLength(); nObjInd++ ) - if ( aObjectDescr[nObjInd].Name == "OutplaceDispatchInterceptor" ) + for ( beans::PropertyValue const & prop : aObjectDescr ) + if ( prop.Name == "OutplaceDispatchInterceptor" ) { - aObjectDescr[nObjInd].Value >>= xDispatchInterceptor; + prop.Value >>= xDispatchInterceptor; break; } - else if ( aObjectDescr[nObjInd].Name == "Parent" ) + else if ( prop.Name == "Parent" ) { - aObjectDescr[nObjInd].Value >>= m_xParent; + prop.Value >>= m_xParent; } CommonInit_Impl( aObjectProps ); diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 7b63ca58118f..3e4ab0dd989f 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -66,20 +66,20 @@ uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl( const uno::Sequence< uno::Sequence< beans::PropertyValue > aResult; sal_Int32 nResLen = 0; - for ( sal_Int32 nInd = 0; nInd < aMedDescr.getLength(); nInd++ ) - { - if ( aMedDescr[nInd].Name == "ComponentData" || aMedDescr[nInd].Name == "DocumentTitle" - || aMedDescr[nInd].Name == "InteractionHandler" || aMedDescr[nInd].Name == "JumpMark" - // || aMedDescr[nInd].Name == "Password" // makes no sense for embedded objects - || aMedDescr[nInd].Name == "Preview" || aMedDescr[nInd].Name == "ReadOnly" - || aMedDescr[nInd].Name == "StartPresentation" || aMedDescr[nInd].Name == "RepairPackage" - || aMedDescr[nInd].Name == "StatusIndicator" || aMedDescr[nInd].Name == "ViewData" - || aMedDescr[nInd].Name == "ViewId" || aMedDescr[nInd].Name == "MacroExecutionMode" - || aMedDescr[nInd].Name == "UpdateDocMode" - || (aMedDescr[nInd].Name == "DocumentBaseURL" && bCanUseDocumentBaseURL) ) + for ( beans::PropertyValue const & prop : aMedDescr ) + { + if ( prop.Name == "ComponentData" || prop.Name == "DocumentTitle" + || prop.Name == "InteractionHandler" || prop.Name == "JumpMark" + // || prop.Name == "Password" // makes no sense for embedded objects + || prop.Name == "Preview" || prop.Name == "ReadOnly" + || prop.Name == "StartPresentation" || prop.Name == "RepairPackage" + || prop.Name == "StatusIndicator" || prop.Name == "ViewData" + || prop.Name == "ViewId" || prop.Name == "MacroExecutionMode" + || prop.Name == "UpdateDocMode" + || (prop.Name == "DocumentBaseURL" && bCanUseDocumentBaseURL) ) { aResult.realloc( ++nResLen ); - aResult[nResLen-1] = aMedDescr[nInd]; + aResult[nResLen-1] = prop; } } @@ -399,9 +399,9 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl() { // check if there is a password to cache uno::Reference< frame::XModel > xModel( xLoadable, uno::UNO_QUERY_THROW ); - uno::Sequence< beans::PropertyValue > aProps = xModel->getArgs(); - for ( sal_Int32 nInd = 0; nInd < aProps.getLength(); nInd++ ) - if ( aProps[nInd].Name == "Password" && ( aProps[nInd].Value >>= m_aLinkPassword ) ) + const uno::Sequence< beans::PropertyValue > aProps = xModel->getArgs(); + for ( beans::PropertyValue const & prop : aProps ) + if ( prop.Name == "Password" && ( prop.Value >>= m_aLinkPassword ) ) { m_bLinkHasPassword = true; break; @@ -639,22 +639,19 @@ void OCommonEmbeddedObject::SaveObject_Impl() OUString OCommonEmbeddedObject::GetBaseURL_Impl() const { OUString aBaseURL; - sal_Int32 nInd = 0; if ( m_xClientSite.is() ) { try { uno::Reference< frame::XModel > xParentModel( m_xClientSite->getComponent(), uno::UNO_QUERY_THROW ); - uno::Sequence< beans::PropertyValue > aModelProps = xParentModel->getArgs(); - for ( nInd = 0; nInd < aModelProps.getLength(); nInd++ ) - if ( aModelProps[nInd].Name == "DocumentBaseURL" ) + const uno::Sequence< beans::PropertyValue > aModelProps = xParentModel->getArgs(); + for ( beans::PropertyValue const & prop : aModelProps ) + if ( prop.Name == "DocumentBaseURL" ) { - aModelProps[nInd].Value >>= aBaseURL; + prop.Value >>= aBaseURL; break; } - - } catch( const uno::Exception& ) {} @@ -662,10 +659,10 @@ OUString OCommonEmbeddedObject::GetBaseURL_Impl() const if ( aBaseURL.isEmpty() ) { - for ( nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ ) - if ( m_aDocMediaDescriptor[nInd].Name == "DocumentBaseURL" ) + for ( beans::PropertyValue const & prop : m_aDocMediaDescriptor ) + if ( prop.Name == "DocumentBaseURL" ) { - m_aDocMediaDescriptor[nInd].Value >>= aBaseURL; + prop.Value >>= aBaseURL; break; } } @@ -682,21 +679,20 @@ OUString OCommonEmbeddedObject::GetBaseURLFrom_Impl( const uno::Sequence< beans::PropertyValue >& lObjArgs ) { OUString aBaseURL; - sal_Int32 nInd = 0; - for ( nInd = 0; nInd < lArguments.getLength(); nInd++ ) - if ( lArguments[nInd].Name == "DocumentBaseURL" ) + for ( beans::PropertyValue const & prop : lArguments ) + if ( prop.Name == "DocumentBaseURL" ) { - lArguments[nInd].Value >>= aBaseURL; + prop.Value >>= aBaseURL; break; } if ( aBaseURL.isEmpty() ) { - for ( nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) - if ( lObjArgs[nInd].Name == "DefaultParentBaseURL" ) + for ( beans::PropertyValue const & prop : lObjArgs ) + if ( prop.Name == "DefaultParentBaseURL" ) { - lObjArgs[nInd].Value >>= aBaseURL; + prop.Value >>= aBaseURL; break; } } @@ -723,11 +719,11 @@ OUString getStringPropertyValue( const uno::Sequence& rPro { OUString aStr; - for (sal_Int32 i = 0; i < rProps.getLength(); ++i) + for (beans::PropertyValue const & prop : rProps) { - if (rProps[i].Name == rName) + if (prop.Name == rName) { - rProps[i].Value >>= aStr; + prop.Value >>= aStr; break; } } @@ -988,36 +984,36 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( nEntryConnectionMode != embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT ); m_bReadOnly = false; - for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ ) - if ( lArguments[nInd].Name == "ReadOnly" ) - lArguments[nInd].Value >>= m_bReadOnly; + for ( beans::PropertyValue const & prop : lArguments ) + if ( prop.Name == "ReadOnly" ) + prop.Value >>= m_bReadOnly; // TODO: use lObjArgs for StoreVisualReplacement - for ( sal_Int32 nObjInd = 0; nObjInd < lObjArgs.getLength(); nObjInd++ ) - if ( lObjArgs[nObjInd].Name == "OutplaceDispatchInterceptor" ) + for ( beans::PropertyValue const & prop : lObjArgs ) + if ( prop.Name == "OutplaceDispatchInterceptor" ) { uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor; - if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor ) + if ( prop.Value >>= xDispatchInterceptor ) m_xDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor ); } - else if ( lObjArgs[nObjInd].Name == "DefaultParentBaseURL" ) + else if ( prop.Name == "DefaultParentBaseURL" ) { - lObjArgs[nObjInd].Value >>= m_aDefaultParentBaseURL; + prop.Value >>= m_aDefaultParentBaseURL; } - else if ( lObjArgs[nObjInd].Name == "Parent" ) + else if ( prop.Name == "Parent" ) { - lObjArgs[nObjInd].Value >>= m_xParent; + prop.Value >>= m_xParent; } - else if ( lObjArgs[nObjInd].Name == "IndividualMiscStatus" ) + else if ( prop.Name == "IndividualMiscStatus" ) { sal_Int64 nMiscStatus=0; - lObjArgs[nObjInd].Value >>= nMiscStatus; + prop.Value >>= nMiscStatus; m_nMiscStatus |= nMiscStatus; } - else if ( lObjArgs[nObjInd].Name == "CloneFrom" ) + else if ( prop.Name == "CloneFrom" ) { uno::Reference < embed::XEmbeddedObject > xObj; - lObjArgs[nObjInd].Value >>= xObj; + prop.Value >>= xObj; if ( xObj.is() ) { m_bHasClonedSize = true; @@ -1025,15 +1021,15 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( m_nClonedMapUnit = xObj->getMapUnit( embed::Aspects::MSOLE_CONTENT ); } } - else if ( lObjArgs[nObjInd].Name == "OutplaceFrameProperties" ) + else if ( prop.Name == "OutplaceFrameProperties" ) { uno::Sequence< uno::Any > aOutFrameProps; uno::Sequence< beans::NamedValue > aOutFramePropsTyped; - if ( lObjArgs[nObjInd].Value >>= aOutFrameProps ) + if ( prop.Value >>= aOutFrameProps ) { m_xDocHolder->SetOutplaceFrameProperties( aOutFrameProps ); } - else if ( lObjArgs[nObjInd].Value >>= aOutFramePropsTyped ) + else if ( prop.Value >>= aOutFramePropsTyped ) { aOutFrameProps.realloc( aOutFramePropsTyped.getLength() ); uno::Any* pProp = aOutFrameProps.getArray(); @@ -1049,21 +1045,21 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( else SAL_WARN( "embeddedobj.common", "OCommonEmbeddedObject::setPersistentEntry: illegal type for argument 'OutplaceFrameProperties'!" ); } - else if ( lObjArgs[nObjInd].Name == "ModuleName" ) + else if ( prop.Name == "ModuleName" ) { - lObjArgs[nObjInd].Value >>= m_aModuleName; + prop.Value >>= m_aModuleName; } - else if ( lObjArgs[nObjInd].Name == "EmbeddedScriptSupport" ) + else if ( prop.Name == "EmbeddedScriptSupport" ) { - OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bEmbeddedScriptSupport ); + OSL_VERIFY( prop.Value >>= m_bEmbeddedScriptSupport ); } - else if ( lObjArgs[nObjInd].Name == "DocumentRecoverySupport" ) + else if ( prop.Name == "DocumentRecoverySupport" ) { - OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport ); + OSL_VERIFY( prop.Value >>= m_bDocumentRecoverySupport ); } - else if ( lObjArgs[nObjInd].Name == "RecoveryStorage" ) + else if ( prop.Name == "RecoveryStorage" ) { - OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xRecoveryStorage ); + OSL_VERIFY( prop.Value >>= m_xRecoveryStorage ); } @@ -1191,11 +1187,11 @@ void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed:: } bool bTryOptimization = false; - for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) + for ( beans::PropertyValue const & prop : lObjArgs ) { // StoreVisualReplacement and VisualReplacement args have no sense here - if ( lObjArgs[nInd].Name == "CanTryOptimization" ) - lObjArgs[nInd].Value >>= bTryOptimization; + if ( prop.Name == "CanTryOptimization" ) + prop.Value >>= bTryOptimization; } bool bSwitchBackToLoaded = false; @@ -1324,11 +1320,11 @@ void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed:: PostEvent_Impl( "OnSaveAs" ); bool bTryOptimization = false; - for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) + for ( beans::PropertyValue const & prop : lObjArgs ) { // StoreVisualReplacement and VisualReplacement args have no sense here - if ( lObjArgs[nInd].Name == "CanTryOptimization" ) - lObjArgs[nInd].Value >>= bTryOptimization; + if ( prop.Name == "CanTryOptimization" ) + prop.Value >>= bTryOptimization; } bool bSwitchBackToLoaded = false; @@ -1660,17 +1656,17 @@ void SAL_CALL OCommonEmbeddedObject::reload( OUString aOldLinkFilter = m_aLinkFilterName; OUString aNewLinkFilter; - for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ ) + for ( beans::PropertyValue const & prop : lArguments ) { - if ( lArguments[nInd].Name == "URL" ) + if ( prop.Name == "URL" ) { // the new URL - lArguments[nInd].Value >>= m_aLinkURL; + prop.Value >>= m_aLinkURL; m_aLinkFilterName.clear(); } - else if ( lArguments[nInd].Name == "FilterName" ) + else if ( prop.Name == "FilterName" ) { - lArguments[nInd].Value >>= aNewLinkFilter; + prop.Value >>= aNewLinkFilter; m_aLinkFilterName.clear(); } } @@ -1703,11 +1699,11 @@ void SAL_CALL OCommonEmbeddedObject::reload( m_aDocMediaDescriptor = GetValuableArgs_Impl( lArguments, true ); // TODO: use lObjArgs for StoreVisualReplacement - for ( sal_Int32 nObjInd = 0; nObjInd < lObjArgs.getLength(); nObjInd++ ) - if ( lObjArgs[nObjInd].Name == "OutplaceDispatchInterceptor" ) + for ( beans::PropertyValue const & prop : lObjArgs ) + if ( prop.Name == "OutplaceDispatchInterceptor" ) { uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor; - if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor ) + if ( prop.Value >>= xDispatchInterceptor ) m_xDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor ); break; @@ -1719,9 +1715,9 @@ void SAL_CALL OCommonEmbeddedObject::reload( bool bOldReadOnlyValue = m_bReadOnly; m_bReadOnly = false; - for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ ) - if ( lArguments[nInd].Name == "ReadOnly" ) - lArguments[nInd].Value >>= m_bReadOnly; + for ( beans::PropertyValue const & prop : lArguments ) + if ( prop.Name == "ReadOnly" ) + prop.Value >>= m_bReadOnly; if ( bOldReadOnlyValue == m_bReadOnly || m_bIsLink ) return; diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx index 47ea271c7ca9..bfd7d548358a 100644 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx @@ -279,9 +279,9 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta // check if there is URL, URL must exist OUString aURL; - for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ ) - if ( aTempMedDescr[nInd].Name == "URL" ) - aTempMedDescr[nInd].Value >>= aURL; + for ( beans::PropertyValue const & prop : std::as_const(aTempMedDescr) ) + if ( prop.Name == "URL" ) + prop.Value >>= aURL; if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( "No URL for the link is provided!", @@ -334,9 +334,9 @@ uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInsta uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments ); OUString aURL; - for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ ) - if ( aTempMedDescr[nInd].Name == "URL" ) - aTempMedDescr[nInd].Value >>= aURL; + for ( beans::PropertyValue const & prop : std::as_const(aTempMedDescr) ) + if ( prop.Name == "URL" ) + prop.Value >>= aURL; if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( "No URL for the link is provided!", diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index cfc7afcf81a9..90a04d85e125 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -564,10 +564,10 @@ void DocumentHolder::FindConnectPoints( uno::Sequence< beans::PropertyValue > aProps; xMenu->getByIndex( nInd ) >>= aProps; OUString aCommand; - for ( sal_Int32 nSeqInd = 0; nSeqInd < aProps.getLength(); nSeqInd++ ) - if ( aProps[nSeqInd].Name == "CommandURL" ) + for ( beans::PropertyValue const & prop : std::as_const(aProps) ) + if ( prop.Name == "CommandURL" ) { - aProps[nSeqInd].Value >>= aCommand; + prop.Value >>= aCommand; break; } diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx index f3df8d50de9f..0cdc67bebbd7 100644 --- a/embeddedobj/source/general/xcreator.cxx +++ b/embeddedobj/source/general/xcreator.cxx @@ -362,9 +362,9 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta // check if there is URL, URL must exist OUString aURL; - for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ ) - if ( aTempMedDescr[nInd].Name == "URL" ) - aTempMedDescr[nInd].Value >>= aURL; + for ( beans::PropertyValue const & prop : std::as_const(aTempMedDescr) ) + if ( prop.Name == "URL" ) + prop.Value >>= aURL; if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( "No URL for the link is provided!", diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx index 0a532befb6e2..7e8cfdb1809e 100644 --- a/embeddedobj/source/msole/olecomponent.cxx +++ b/embeddedobj/source/msole/olecomponent.cxx @@ -358,9 +358,9 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium, if ( pBuf && !bAnyIsReady ) { - for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ ) - if ( aFlavor.MimeType.match( m_aSupportedGraphFormats[nInd].MimeType ) - && aFlavor.DataType == m_aSupportedGraphFormats[nInd].DataType + for ( auto const & supportedFormat : std::as_const(m_aSupportedGraphFormats) ) + if ( aFlavor.MimeType.match( supportedFormat.MimeType ) + && aFlavor.DataType == supportedFormat.DataType && aFlavor.DataType == cppu::UnoType>::get() ) { bAnyIsReady = ConvertBufferToFormat( pBuf.get(), nBufSize, aFormat, aResult ); @@ -376,9 +376,9 @@ bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium, bool OleComponentNative_Impl::GraphicalFlavor( const datatransfer::DataFlavor& aFlavor ) { // Actually all the required graphical formats must be supported - for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ ) - if ( aFlavor.MimeType.match( m_aSupportedGraphFormats[nInd].MimeType ) - && aFlavor.DataType == m_aSupportedGraphFormats[nInd].DataType ) + for ( auto const & supportedFormat : std::as_const(m_aSupportedGraphFormats) ) + if ( aFlavor.MimeType.match( supportedFormat.MimeType ) + && aFlavor.DataType == supportedFormat.DataType ) return true; return false; @@ -1628,8 +1628,8 @@ sal_Bool SAL_CALL OleComponent::isDataFlavorSupported( const datatransfer::DataF RetrieveObjectDataFlavors_Impl(); } - for ( sal_Int32 nInd = 0; nInd < m_aDataFlavors.getLength(); nInd++ ) - if ( m_aDataFlavors[nInd].MimeType.equals( aFlavor.MimeType ) && m_aDataFlavors[nInd].DataType == aFlavor.DataType ) + for ( auto const & supportedFormat : std::as_const(m_aDataFlavors) ) + if ( supportedFormat.MimeType.equals( aFlavor.MimeType ) && supportedFormat.DataType == aFlavor.DataType ) return true; return false; diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index faf23cf585c9..5997fba7ca22 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -91,8 +91,8 @@ uno::Sequence< sal_Int32 > OleEmbeddedObject::GetReachableStatesList_Impl( uno::Sequence< sal_Int32 > aStates(2); aStates[0] = embed::EmbedStates::LOADED; aStates[1] = embed::EmbedStates::RUNNING; - for ( sal_Int32 nInd = 0; nInd < aVerbList.getLength(); nInd++ ) - if ( aVerbList[nInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN ) + for ( embed::VerbDescriptor const & vd : aVerbList ) + if ( vd.VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN ) { aStates.realloc(3); aStates[2] = embed::EmbedStates::ACTIVE; @@ -275,9 +275,9 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >& uno::Sequence< beans::PropertyValue > aFilterData; if ( aFilterAnyData >>= aFilterData ) { - for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ ) - if ( aFilterData[nInd].Name == "DocumentService" ) - aFilterData[nInd].Value >>= aDocServiceName; + for ( beans::PropertyValue const & prop : std::as_const(aFilterData) ) + if ( prop.Name == "DocumentService" ) + prop.Value >>= aDocServiceName; } if ( !aDocServiceName.isEmpty() ) diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx index 36a6a84b4614..c4c8760b549b 100644 --- a/embeddedobj/source/msole/olepersist.cxx +++ b/embeddedobj/source/msole/olepersist.cxx @@ -1058,14 +1058,14 @@ void OleEmbeddedObject::StoreToLocation_Impl( bool bTryOptimization = false; bool bStoreVis = m_bStoreVisRepl; uno::Reference< io::XStream > xCachedVisualRepresentation; - for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) + for ( beans::PropertyValue const & prop : lObjArgs ) { - if ( lObjArgs[nInd].Name == "StoreVisualReplacement" ) - lObjArgs[nInd].Value >>= bStoreVis; - else if ( lObjArgs[nInd].Name == "VisualReplacement" ) - lObjArgs[nInd].Value >>= xCachedVisualRepresentation; - else if ( lObjArgs[nInd].Name == "CanTryOptimization" ) - lObjArgs[nInd].Value >>= bTryOptimization; + if ( prop.Name == "StoreVisualReplacement" ) + prop.Value >>= bStoreVis; + else if ( prop.Name == "VisualReplacement" ) + prop.Value >>= xCachedVisualRepresentation; + else if ( prop.Name == "CanTryOptimization" ) + prop.Value >>= bTryOptimization; } // ignore visual representation provided from outside if it should not be stored @@ -1310,9 +1310,9 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( bool bElExists = xNameAccess->hasByName( sEntName ); m_bReadOnly = false; - for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ ) - if ( lArguments[nInd].Name == "ReadOnly" ) - lArguments[nInd].Value >>= m_bReadOnly; + for ( beans::PropertyValue const & prop : lArguments ) + if ( prop.Name == "ReadOnly" ) + prop.Value >>= m_bReadOnly; #ifdef _WIN32 sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE; @@ -1320,9 +1320,9 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( SwitchOwnPersistence( xStorage, sEntName ); - for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) - if ( lObjArgs[nInd].Name == "StoreVisualReplacement" ) - lObjArgs[nInd].Value >>= m_bStoreVisRepl; + for ( beans::PropertyValue const & prop : lObjArgs ) + if ( prop.Name == "StoreVisualReplacement" ) + prop.Value >>= m_bStoreVisRepl; #ifdef _WIN32 if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT ) @@ -1388,9 +1388,9 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry( { // use URL ( may be content or stream later ) from MediaDescriptor to initialize object OUString aURL; - for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ ) - if ( lArguments[nInd].Name == "URL" ) - lArguments[nInd].Value >>= aURL; + for ( beans::PropertyValue const & prop : lArguments ) + if ( prop.Name == "URL" ) + prop.Value >>= aURL; if ( aURL.isEmpty() ) throw lang::IllegalArgumentException( diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 9750798c6388..474439194dee 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -212,9 +212,9 @@ OUString OwnView_Impl::GetFilterNameFromExtentionAndInStream( aTypeName = xTypeDetection->queryTypeByDescriptor( aArgs, true ); OUString aFilterName; - for ( sal_Int32 nInd = 0; nInd < aArgs.getLength(); nInd++ ) - if ( aArgs[nInd].Name == "FilterName" ) - aArgs[nInd].Value >>= aFilterName; + for ( beans::PropertyValue const & prop : std::as_const(aArgs) ) + if ( prop.Name == "FilterName" ) + prop.Value >>= aFilterName; if ( aFilterName.isEmpty() && !aTypeName.isEmpty() ) { @@ -224,11 +224,11 @@ OUString OwnView_Impl::GetFilterNameFromExtentionAndInStream( if ( xNameAccess.is() && ( xNameAccess->getByName( aTypeName ) >>= aTypes ) ) { - for ( sal_Int32 nInd = 0; nInd < aTypes.getLength(); nInd++ ) + for ( beans::PropertyValue const & prop : std::as_const(aTypes) ) { - if ( aTypes[nInd].Name == "PreferredFilter" && ( aTypes[nInd].Value >>= aFilterName ) ) + if ( prop.Name == "PreferredFilter" && ( prop.Value >>= aFilterName ) ) { - aTypes[nInd].Value >>= aFilterName; + prop.Value >>= aFilterName; break; } } diff --git a/embeddedobj/source/msole/xolefactory.cxx b/embeddedobj/source/msole/xolefactory.cxx index 341afdd3e003..f162af865c05 100644 --- a/embeddedobj/source/msole/xolefactory.cxx +++ b/embeddedobj/source/msole/xolefactory.cxx @@ -95,15 +95,15 @@ uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInsta aMedDescr, lObjArgs ); - for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ ) + for ( beans::PropertyValue const & prop : lObjArgs ) { - if ( lObjArgs[nInd].Name == "CloneFrom" ) + if ( prop.Name == "CloneFrom" ) { try { uno::Reference < embed::XEmbeddedObject > xObj; uno::Reference < embed::XEmbeddedObject > xNew( xResult, uno::UNO_QUERY ); - lObjArgs[nInd].Value >>= xObj; + prop.Value >>= xObj; if ( xObj.is() ) xNew->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, xObj->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ) ); } diff --git a/embedserv/source/embed/intercept.cxx b/embedserv/source/embed/intercept.cxx index 8e20086f6dd7..ebe94913744b 100644 --- a/embedserv/source/embed/intercept.cxx +++ b/embedserv/source/embed/intercept.cxx @@ -243,10 +243,9 @@ void Interceptor::generateFeatureStateEvent() } - for(sal_Int32 k = 0; k < aSeq.getLength(); ++k) + for(uno::Reference const & k : std::as_const(aSeq)) { - uno::Reference - Control(aSeq[k],uno::UNO_QUERY); + uno::Reference Control(k,uno::UNO_QUERY); if(Control.is()) Control->statusChanged(aStateEvent); diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 6594d66944dc..fb7bb7563a4f 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -316,15 +316,14 @@ Sequence EventAttacherImpl::getSupportedServiceNames_Static( ) void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) { // get services from the argument list - const Any * pArray = Arguments.getConstArray(); - for( sal_Int32 i = 0; i < Arguments.getLength(); i++ ) + for( const Any& arg : Arguments ) { - if( pArray[i].getValueType().getTypeClass() != TypeClass_INTERFACE ) + if( arg.getValueType().getTypeClass() != TypeClass_INTERFACE ) throw IllegalArgumentException(); // InvocationAdapter service ? Reference< XInvocationAdapterFactory2 > xALAS; - pArray[i] >>= xALAS; + arg >>= xALAS; if( xALAS.is() ) { Guard< Mutex > aGuard( m_aMutex ); @@ -332,7 +331,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) } // Introspection service ? Reference< XIntrospection > xI; - pArray[i] >>= xI; + arg >>= xI; if( xI.is() ) { Guard< Mutex > aGuard( m_aMutex ); @@ -340,7 +339,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) } // Reflection service ? Reference< XIdlReflection > xIdlR; - pArray[i] >>= xIdlR; + arg >>= xIdlR; if( xIdlR.is() ) { Guard< Mutex > aGuard( m_aMutex ); @@ -348,7 +347,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) } // Converter Service ? Reference< XTypeConverter > xC; - pArray[i] >>= xC; + arg >>= xC; if( xC.is() ) { Guard< Mutex > aGuard( m_aMutex ); @@ -598,12 +597,9 @@ Reference EventAttacherImpl::attachListenerForTarget( OUString aAddListenerName = "add" + aListenerName; // Send Methods to the correct addListener-Method - Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); - const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray(); - for (sal_Int32 i = 0, n = aMethodSeq.getLength(); i < n ; ++i) + const Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); + for (const Reference< XIdlMethod >& rxMethod : aMethodSeq) { - const Reference< XIdlMethod >& rxMethod = pMethods[i]; - // Is it the correct method? OUString aMethName = rxMethod->getName(); diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index a06bc2a6c74d..a9c2d74f2b4a 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -117,14 +117,13 @@ BibConfig::BibConfig() } } } - Sequence< OUString > aNodeNames = GetNodeNames(cDataSourceHistory); - const OUString* pNodeNames = aNodeNames.getConstArray(); - for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength(); nNode++) + const Sequence< OUString > aNodeNames = GetNodeNames(cDataSourceHistory); + for(OUString const & nodeName : aNodeNames) { Sequence aHistoryNames(3); OUString* pHistoryNames = aHistoryNames.getArray(); - OUString sPrefix = OUStringLiteral(cDataSourceHistory) + "/" + pNodeNames[nNode] + "/"; + OUString sPrefix = OUStringLiteral(cDataSourceHistory) + "/" + nodeName + "/"; pHistoryNames[0] = sPrefix + "DataSourceName"; pHistoryNames[1] = sPrefix + "Command"; pHistoryNames[2] = sPrefix + "CommandType"; @@ -140,14 +139,13 @@ BibConfig::BibConfig() pHistoryValues[2] >>= pMapping->nCommandType; //field assignment is contained in another set sPrefix += "Fields"; - Sequence< OUString > aAssignmentNodeNames = GetNodeNames(sPrefix); - const OUString* pAssignmentNodeNames = aAssignmentNodeNames.getConstArray(); + const Sequence< OUString > aAssignmentNodeNames = GetNodeNames(sPrefix); Sequence aAssignmentPropertyNames(aAssignmentNodeNames.getLength() * 2); OUString* pAssignmentPropertyNames = aAssignmentPropertyNames.getArray(); sal_Int16 nFieldIdx = 0; - for(sal_Int32 nField = 0; nField < aAssignmentNodeNames.getLength(); nField++) + for(OUString const & assignName : aAssignmentNodeNames) { - OUString sSubPrefix = sPrefix + "/" + pAssignmentNodeNames[nField]; + OUString sSubPrefix = sPrefix + "/" + assignName; pAssignmentPropertyNames[nFieldIdx] = sSubPrefix; pAssignmentPropertyNames[nFieldIdx++] += "/ProgrammaticFieldName"; pAssignmentPropertyNames[nFieldIdx] = sSubPrefix; diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 8c98290b2125..c0a830eece91 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -1275,8 +1275,8 @@ uno::Any SAL_CALL IUnknownWrapper::directInvoke( const OUString& aName, const un dispparams.cArgs = aParams.getLength(); // Determine the number of named arguments - for ( sal_Int32 nInd = 0; nInd < aParams.getLength(); nInd++ ) - if ( aParams[nInd].getValueType() == cppu::UnoType::get() ) + for ( uno::Any const & any : aParams ) + if ( any.getValueType() == cppu::UnoType::get() ) dispparams.cNamedArgs ++; // fill the named arguments @@ -1548,9 +1548,9 @@ TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall(const OUStr { TypeDescription ret; - for( sal_Int32 i=0; i < m_seqTypes.getLength(); i++) + for( auto const & rType : std::as_const(m_seqTypes) ) { - TypeDescription _curDesc( m_seqTypes[i]); + TypeDescription _curDesc( rType ); _curDesc.makeComplete(); typelib_InterfaceTypeDescription * pInterface= reinterpret_cast(_curDesc.get()); if( pInterface) diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index 2ee5f3ebaead..6215161d0b0b 100644 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -186,17 +186,17 @@ private: template T getValue( const css::uno::Sequence< css::beans::NamedValue >& rNamedValues, const char * pszName ) { - for( sal_Int32 n=0; n < rNamedValues.getLength(); n++ ) + for( css::beans::NamedValue const & nv : rNamedValues ) { // Unfortunately gcc-3.3 does not like Any.get(); - if( rNamedValues[n].Name.equalsAscii( pszName ) ) + if( nv.Name.equalsAscii( pszName ) ) { T value = T(); - if( ! (rNamedValues[n].Value >>= value) ) + if( ! (nv.Value >>= value) ) throw css::uno::RuntimeException( OUString( cppu_Any_extraction_failure_msg( - &rNamedValues[n].Value, + &nv.Value, ::cppu::getTypeFavourUnsigned(&value).getTypeLibType() ), SAL_NO_ACQUIRE ), css::uno::Reference< css::uno::XInterface >() ); diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index a857ea8af76c..60a9b441ec91 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -755,9 +755,9 @@ void UpdateHandler::insertControlModel( uno::Reference< awt::XControlModel > con uno::Reference< awt::XControlModel > xModel (xFactory->createInstance (rServiceName), uno::UNO_QUERY_THROW); uno::Reference< beans::XPropertySet > xPropSet (xModel, uno::UNO_QUERY_THROW); - for (sal_Int32 i = 0, n = rProps.getLength(); i < n; i++) + for (beans::NamedValue const & prop : rProps) { - xPropSet->setPropertyValue (rProps[i].Name, rProps[i].Value); + xPropSet->setPropertyValue (prop.Name, prop.Value); } // @see awt/UnoControlDialogElement.idl @@ -881,9 +881,9 @@ bool UpdateHandler::showWarning( const OUString &rWarningText, { uno::Sequence< uno::Reference< awt::XWindow > > xChildren = xMsgBoxCtrls->getWindows(); - for ( long i=0; i < xChildren.getLength(); i++ ) + for ( uno::Reference< awt::XWindow > const & child : xChildren ) { - uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( xChildren[i], uno::UNO_QUERY ); + uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( child, uno::UNO_QUERY ); if ( xMsgBoxCtrl.is() ) { bool bIsDefault = true; -- cgit