diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-20 12:48:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-20 15:39:38 +0200 |
commit | 283a9790bffa6536f4c26bd31d85f815bc64dd08 (patch) | |
tree | c65ac7fe50fbea809dd765c24edbb47b57adea2b /dbaccess | |
parent | 18bdf78e156f3cd1e6ccbb3ae28e919583bac70c (diff) |
loplugin:indentation check for indent inside block
look for places where the statements inside a block are
not indented
Change-Id: I0cbfa7e0b6fb194b2aff6fa7e070fb907d70ca2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123885
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/uno/copytablewizard.cxx | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 48aaabdf42ff..d343dc4149f1 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -799,79 +799,79 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< do { - Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); + Reference< XPropertySetInfo > xPSI( _rxDataSourceDescriptor->getPropertySetInfo(), UNO_SET_THROW ); - // if there's an ActiveConnection, use it - if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) - { - Reference< XConnection > xPure; - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); - xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); - } - if ( xConnection.is() ) - { - xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); - SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); - break; - } - - // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource - OUString sDataSource, sDatabaseLocation; - if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); - if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); - - // need a DatabaseContext for loading the data source - Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext ); - Reference< XDataSource > xDataSource; - if ( !sDataSource.isEmpty() ) - xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); - if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() ) - xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); - - if ( xDataSource.is() ) - { - // first, try connecting with completion - xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); - SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); - if ( xInteractionHandler.is() ) + // if there's an ActiveConnection, use it + if ( xPSI->hasPropertyByName( PROPERTY_ACTIVE_CONNECTION ) ) + { + Reference< XConnection > xPure; + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xPure ); + xConnection.reset( xPure, SharedConnection::NoTakeOwnership ); + } + if ( xConnection.is() ) { - Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); - if ( xInteractiveConnection.is() ) - xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); + xInteractionHandler = lcl_getInteractionHandler_throw( xConnection.getTyped(), m_xInteractionHandler ); + SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + break; } - // interactively connecting was not successful or possible -> connect without interaction - if ( !xConnection.is() ) + // there could be a DataSourceName or a DatabaseLocation, describing the css.sdb.DataSource + OUString sDataSource, sDatabaseLocation; + if ( xPSI->hasPropertyByName( PROPERTY_DATASOURCENAME ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sDataSource ); + if ( xPSI->hasPropertyByName( PROPERTY_DATABASE_LOCATION ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation ); + + // need a DatabaseContext for loading the data source + Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_xContext ); + Reference< XDataSource > xDataSource; + if ( !sDataSource.isEmpty() ) + xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW ); + if ( !xDataSource.is() && !sDatabaseLocation.isEmpty() ) + xDataSource.set( xDatabaseContext->getByName( sDatabaseLocation ), UNO_QUERY_THROW ); + + if ( xDataSource.is() ) { - xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership ); + // first, try connecting with completion + xInteractionHandler = lcl_getInteractionHandler_throw( xDataSource, m_xInteractionHandler ); + SAL_WARN_IF( !xInteractionHandler.is(), "dbaccess.ui", "CopyTableWizard::impl_extractConnection_throw: lcl_getInteractionHandler_throw returned nonsense!" ); + if ( xInteractionHandler.is() ) + { + Reference< XCompletedConnection > xInteractiveConnection( xDataSource, UNO_QUERY ); + if ( xInteractiveConnection.is() ) + xConnection.reset( xInteractiveConnection->connectWithCompletion( xInteractionHandler ), SharedConnection::TakeOwnership ); + } + + // interactively connecting was not successful or possible -> connect without interaction + if ( !xConnection.is() ) + { + xConnection.reset( xDataSource->getConnection( OUString(), OUString() ), SharedConnection::TakeOwnership ); + } } - } - if ( xConnection.is() ) - break; + if ( xConnection.is() ) + break; - // finally, there could be a ConnectionResource/ConnectionInfo - OUString sConnectionResource; - Sequence< PropertyValue > aConnectionInfo; - if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); - if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) - OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); - - Reference< XDriverManager > xDriverManager; - try { - xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW ); - } catch( const Exception& ) { } - if ( !xDriverManager.is() ) - // no connection pool installed - xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW ); - - if ( aConnectionInfo.hasElements() ) - xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); - else - xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); + // finally, there could be a ConnectionResource/ConnectionInfo + OUString sConnectionResource; + Sequence< PropertyValue > aConnectionInfo; + if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_RESOURCE ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_RESOURCE ) >>= sConnectionResource ); + if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) ) + OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); + + Reference< XDriverManager > xDriverManager; + try { + xDriverManager.set( ConnectionPool::create( m_xContext ), UNO_QUERY_THROW ); + } catch( const Exception& ) { } + if ( !xDriverManager.is() ) + // no connection pool installed + xDriverManager.set( DriverManager::create( m_xContext ), UNO_QUERY_THROW ); + + if ( aConnectionInfo.hasElements() ) + xConnection.set( xDriverManager->getConnectionWithInfo( sConnectionResource, aConnectionInfo ), UNO_SET_THROW ); + else + xConnection.set( xDriverManager->getConnection( sConnectionResource ), UNO_SET_THROW ); } while ( false ); |