diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-21 19:39:26 +0300 |
---|---|---|
committer | Arkadiy Illarionov <qarkai@gmail.com> | 2019-07-29 18:44:33 +0200 |
commit | 25b200ff79c71c831bc7e6fe8b1ec0b5315e96d6 (patch) | |
tree | b8e7cc15bfe82b677fb1bfc791b3f2f5a50fdc79 /sfx2/source/view/sfxbasecontroller.cxx | |
parent | c762e3859973355b31f6676a8e697c5fd78c9970 (diff) |
Simplify Sequence iterations in sfx2
Use range-based loops, STL and comphelper functions
Change-Id: I6a0d18493db7a25e8b41925f2d45cb221b5065a7
Reviewed-on: https://gerrit.libreoffice.org/76074
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'sfx2/source/view/sfxbasecontroller.cxx')
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 7819b96488c1..c5503a3c2aa5 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -478,7 +478,7 @@ Sequence< PropertyValue > SAL_CALL SfxBaseController::getCreationArguments() void SfxBaseController::SetCreationArguments_Impl( const Sequence< PropertyValue >& i_rCreationArgs ) { - OSL_ENSURE( m_pData->m_aCreationArgs.getLength() == 0, "SfxBaseController::SetCreationArguments_Impl: not intended to be called twice!" ); + OSL_ENSURE( !m_pData->m_aCreationArgs.hasElements(), "SfxBaseController::SetCreationArguments_Impl: not intended to be called twice!" ); m_pData->m_aCreationArgs = i_rCreationArgs; } @@ -837,12 +837,9 @@ uno::Sequence< Reference< frame::XDispatch > > SAL_CALL SfxBaseController::query sal_Int32 nCount = seqDescripts.getLength(); uno::Sequence< Reference< frame::XDispatch > > lDispatcher( nCount ); - for( sal_Int32 i=0; i<nCount; ++i ) - { - lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL , - seqDescripts[i].FrameName , - seqDescripts[i].SearchFlags ); - } + std::transform(seqDescripts.begin(), seqDescripts.end(), lDispatcher.begin(), + [this](const frame::DispatchDescriptor& rDesc) -> Reference< frame::XDispatch > { + return queryDispatch(rDesc.FeatureURL, rDesc.FrameName, rDesc.SearchFlags); }); return lDispatcher; } @@ -1380,16 +1377,16 @@ void SfxBaseController::ShowInfoBars( ) // and find if it is a Google Drive file. bool bIsGoogleFile = false; bool bCheckedOut = false; - for ( sal_Int32 i = 0; i < aCmisProperties.getLength(); ++i ) + for ( const auto& rCmisProp : aCmisProperties ) { - if ( aCmisProperties[i].Id == "cmis:isVersionSeriesCheckedOut" ) { + if ( rCmisProp.Id == "cmis:isVersionSeriesCheckedOut" ) { uno::Sequence< sal_Bool > bTmp; - aCmisProperties[i].Value >>= bTmp; + rCmisProp.Value >>= bTmp; bCheckedOut = bTmp[0]; } // if it is a Google Drive file, we don't need the checkout bar, // still need the checkout feature for the version dialog. - if ( aCmisProperties[i].Name == "title" ) + if ( rCmisProp.Name == "title" ) bIsGoogleFile = true; } |