summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-11-17 21:03:24 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-18 07:52:36 +0100
commite36c468dab4006afcfae76b1676df7cedbb82f1d (patch)
tree06adfdb71c6f26c962ad126803244f8ca60de328 /dbaccess
parentc197573d5e89156eeca1e1cdf481d9437237e31a (diff)
Replace list by vector in macromigrationdialog (dbaccess)
+ use for range loops Change-Id: I676009baa7b7aeb8c26951a8786da22431b0bc81 Reviewed-on: https://gerrit.libreoffice.org/44896 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ext/macromigration/macromigrationdialog.cxx42
1 files changed, 19 insertions, 23 deletions
diff --git a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
index 7fffb394e49b..e30bd2652daf 100644
--- a/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationdialog.cxx
@@ -44,7 +44,7 @@
#include <ucbhelper/content.hxx>
#include <vcl/layout.hxx>
-#include <list>
+#include <vector>
namespace dbmm
{
@@ -88,7 +88,7 @@ namespace dbmm
// helper
static void lcl_getControllers_throw(const Reference< XModel2 >& _rxDocument,
- std::list< Reference< XController2 > >& _out_rControllers )
+ std::vector< Reference< XController2 > >& _out_rControllers )
{
_out_rControllers.clear();
Reference< XEnumeration > xControllerEnum( _rxDocument->getControllers(), UNO_SET_THROW );
@@ -311,16 +311,13 @@ namespace dbmm
try
{
// collect all controllers of our document
- std::list< Reference< XController2 > > aControllers;
+ std::vector< Reference< XController2 > > aControllers;
lcl_getControllers_throw( m_pData->xDocumentModel, aControllers );
// close all sub documents of all controllers
- for ( std::list< Reference< XController2 > >::const_iterator pos = aControllers.begin();
- pos != aControllers.end() && bSuccess;
- ++pos
- )
+ for (auto const& controller : aControllers)
{
- Reference< XDatabaseDocumentUI > xController( *pos, UNO_QUERY );
+ Reference< XDatabaseDocumentUI > xController( controller, UNO_QUERY );
OSL_ENSURE( xController.is(), "MacroMigrationDialog::impl_closeSubDocs_nothrow: unexpected: controller is missing an important interface!" );
// at the moment, only one implementation for a DBDoc's controller exists, which should
// support this interface
@@ -328,6 +325,8 @@ namespace dbmm
continue;
bSuccess = xController->closeSubComponents();
+ if (!bSuccess)
+ break;
}
}
catch( const Exception& )
@@ -423,7 +422,7 @@ namespace dbmm
void MacroMigrationDialog::impl_reloadDocument_nothrow( bool _bMigrationSuccess )
{
typedef std::pair< Reference< XFrame >, OUString > ViewDescriptor;
- std::list< ViewDescriptor > aViews;
+ std::vector< ViewDescriptor > aViews;
try
{
@@ -449,14 +448,13 @@ namespace dbmm
aDocumentArgs.remove( "URL" );
// collect all controllers of our document
- std::list< Reference< XController2 > > aControllers;
+ std::vector< Reference< XController2 > > aControllers;
lcl_getControllers_throw( m_pData->xDocumentModel, aControllers );
// close all those controllers
- while ( !aControllers.empty() )
+ for (auto const& controller : aControllers)
{
- Reference< XController2 > xController( aControllers.front(), UNO_SET_THROW );
- aControllers.pop_front();
+ Reference< XController2 > xController( controller, UNO_SET_THROW );
Reference< XFrame > xFrame( xController->getFrame(), UNO_SET_THROW );
OUString sViewName( xController->getViewControllerName() );
@@ -474,6 +472,7 @@ namespace dbmm
xFrame->setComponent( nullptr, nullptr );
xController->dispose();
}
+ aControllers.clear();
// Note the document is closed now - disconnecting the last controller
// closes it automatically.
@@ -481,14 +480,11 @@ namespace dbmm
Reference< XOfficeDatabaseDocument > xNewDocument;
// re-create the views
- while ( !aViews.empty() )
+ for (auto const& view : aViews)
{
- ViewDescriptor aView( aViews.front() );
- aViews.pop_front();
-
// load the document into this frame
- Reference< XComponentLoader > xLoader( aView.first, UNO_QUERY_THROW );
- aDocumentArgs.put( "ViewName", aView.second );
+ Reference< XComponentLoader > xLoader( view.first, UNO_QUERY_THROW );
+ aDocumentArgs.put( "ViewName", view.second );
Reference< XInterface > xReloaded( xLoader->loadComponentFromURL(
sDocumentURL,
"_self",
@@ -514,6 +510,7 @@ namespace dbmm
}
#endif
}
+ aViews.clear();
m_pData->xDocument = xNewDocument;
m_pData->xDocumentModel.set( xNewDocument, UNO_QUERY );
@@ -537,13 +534,11 @@ namespace dbmm
// close all frames from aViews - the respective controllers have been closed, but
// reloading didn't work, so the frames are zombies now.
- while ( !aViews.empty() )
+ for (auto const& view : aViews)
{
- ViewDescriptor aView( aViews.front() );
- aViews.pop_front();
try
{
- Reference< XCloseable > xFrameClose( aView.first, UNO_QUERY_THROW );
+ Reference< XCloseable > xFrameClose( view.first, UNO_QUERY_THROW );
xFrameClose->close( true );
}
catch( const Exception& )
@@ -551,6 +546,7 @@ namespace dbmm
DBG_UNHANDLED_EXCEPTION();
}
}
+ aViews.clear();
}
} // namespace dbmm