diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-20 08:48:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-20 21:31:13 +0200 |
commit | b33ff1a083d95388997cf301d8a1538a41c08255 (patch) | |
tree | 35c773fc0be7c6e4c4b479c9594fb1e8843ef183 /embeddedobj | |
parent | fb149c68db909e6ec17520e277583ed759a0d49a (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'embeddedobj')
-rw-r--r-- | embeddedobj/source/commonembedding/embedobj.cxx | 4 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/miscobj.cxx | 68 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/persistence.cxx | 150 | ||||
-rw-r--r-- | embeddedobj/source/commonembedding/xfactory.cxx | 12 | ||||
-rw-r--r-- | embeddedobj/source/general/docholder.cxx | 6 | ||||
-rw-r--r-- | embeddedobj/source/general/xcreator.cxx | 6 | ||||
-rw-r--r-- | embeddedobj/source/msole/olecomponent.cxx | 16 | ||||
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 10 | ||||
-rw-r--r-- | embeddedobj/source/msole/olepersist.cxx | 32 | ||||
-rw-r--r-- | embeddedobj/source/msole/ownview.cxx | 12 | ||||
-rw-r--r-- | embeddedobj/source/msole/xolefactory.cxx | 6 |
11 files changed, 159 insertions, 163 deletions
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<beans::PropertyValue>& 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<uno::Sequence< sal_Int8 >>::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 ) ); } |