diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-09 23:27:25 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-10 09:44:56 +0100 |
commit | 5b2fc10f0cc9f15525c7723764a1feebeceb0d5e (patch) | |
tree | 1d4159a006696d3072dc98fc989c3fbd58e32b7a /dbaccess/source/ui/app/AppControllerGen.cxx | |
parent | 7c693fc3f7218e1ca0c85a0de76ae84226391256 (diff) |
Modernize a bit more dbaccess
mainly by using for-range loops
but also by simplifying some simple algo
Change-Id: If04cd78e62f80f9575e24f3d50ff1e427454da79
Reviewed-on: https://gerrit.libreoffice.org/51019
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'dbaccess/source/ui/app/AppControllerGen.cxx')
-rw-r--r-- | dbaccess/source/ui/app/AppControllerGen.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index 99a04d7b76e7..98daf558b3cf 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -690,15 +690,14 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO } std::vector< std::pair< OUString ,Reference< XModel > > > aComponents; - std::vector< OUString>::const_iterator aEnd = aList.end(); - for (std::vector< OUString>::const_iterator aIter = aList.begin(); aIter != aEnd; ++aIter) + for (auto const& elem : aList) { if ( SID_DB_APP_CONVERTTOVIEW == _nId ) - convertToView(*aIter); + convertToView(elem); else { - Reference< XModel > xModel( openElementWithArguments( *aIter, eType, eOpenMode, _nId,aArguments ), UNO_QUERY ); - aComponents.emplace_back( *aIter, xModel ); + Reference< XModel > xModel( openElementWithArguments( elem, eType, eOpenMode, _nId,aArguments ), UNO_QUERY ); + aComponents.emplace_back( elem, xModel ); } } @@ -706,19 +705,19 @@ void OApplicationController::doAction(sal_uInt16 _nId, const ElementOpenMode _eO if ( _eOpenMode == E_OPEN_FOR_MAIL ) { - std::vector< std::pair< OUString ,Reference< XModel > > >::const_iterator componentIter = aComponents.begin(); - std::vector< std::pair< OUString ,Reference< XModel > > >::const_iterator componentEnd = aComponents.end(); SfxMailModel aSendMail; SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_OK; - for (; componentIter != componentEnd && SfxMailModel::SEND_MAIL_OK == eResult; ++componentIter) + for (auto const& component : aComponents) { try { - Reference< XModel > xModel(componentIter->second,UNO_QUERY); + Reference< XModel > xModel(component.second,UNO_QUERY); // Send document as e-Mail using stored/default type - eResult = aSendMail.AttachDocument(xModel,componentIter->first); + eResult = aSendMail.AttachDocument(xModel,component.first); ::comphelper::disposeComponent(xModel); + if (eResult != SfxMailModel::SEND_MAIL_OK) + break; } catch(const Exception&) { |