diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-27 11:45:21 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-28 13:06:18 +0100 |
commit | 38cc919efb965e7982d23d5b1c91a639cc2c6fdd (patch) | |
tree | 3586b24e5d14c7612dae8da02cdd04ad7b2ec112 | |
parent | 7470cc532fe408dc9d8735cde0e2eb5bb62fd69c (diff) |
fdo#46808, use service constructor for sdbc::ConnectionPool
Change-Id: Id12226af5e537b1eeacbb062ad937a3551e245c0
28 files changed, 80 insertions, 72 deletions
diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index 854e4e932422..18fd291f397d 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -151,7 +151,7 @@ namespace dbtools OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext, sal_Bool _bSetAsActiveConnection ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException @@ -182,7 +182,7 @@ namespace dbtools */ OOO_DLLPUBLIC_DBTOOLS SharedConnection ensureRowSetConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext, bool _bUseAutoConnectionDisposer ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException @@ -423,7 +423,7 @@ namespace dbtools */ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > getCurrentSettingsComposer( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxRowSetProps, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext ); /** transfer and translate properties between two FormComponents diff --git a/connectivity/inc/connectivity/parameters.hxx b/connectivity/inc/connectivity/parameters.hxx index 0e25f99161be..e81e39feb45f 100644 --- a/connectivity/inc/connectivity/parameters.hxx +++ b/connectivity/inc/connectivity/parameters.hxx @@ -23,11 +23,11 @@ #include <vector> #include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/form/XDatabaseParameterListener.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/sdbc/XParameters.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> @@ -101,8 +101,8 @@ namespace dbtools ::osl::Mutex& m_rMutex; ::cppu::OInterfaceContainerHelper m_aParameterListeners; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; ::com::sun::star::uno::WeakReference< ::com::sun::star::beans::XPropertySet > m_xComponent; // the database component whose parameters we're handling @@ -137,7 +137,7 @@ namespace dbtools */ explicit ParameterManager( ::osl::Mutex& _rMutex, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); /// late ctor diff --git a/connectivity/inc/connectivity/virtualdbtools.hxx b/connectivity/inc/connectivity/virtualdbtools.hxx index 7551bedac8d6..1e12e9a60fd9 100644 --- a/connectivity/inc/connectivity/virtualdbtools.hxx +++ b/connectivity/inc/connectivity/virtualdbtools.hxx @@ -125,7 +125,7 @@ namespace connectivity virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext, sal_Bool _bSetAsActiveConnection ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 183ad8d39fa6..065fa84d306f 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/sdb/XParametersSupplier.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> +#include <com/sun/star/sdbc/ConnectionPool.hpp> #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XDataSource.hpp> @@ -357,7 +358,7 @@ Reference< XConnection> getConnection(const Reference< XRowSet>& _rxRowSet) thro // helper function which allows to implement both the connectRowset and the ensureRowSetConnection semantics // if connectRowset (which is deprecated) is removed, this function and one of its parameters are // not needed anymore, the whole implementation can be moved into ensureRowSetConnection then) -SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory, +SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext, bool _bSetAsActiveConnection, bool _bAttachAutoDisposer ) SAL_THROW ( ( SQLException, WrappedTargetException, RuntimeException ) ) { @@ -410,13 +411,15 @@ SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const R if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), xRowSetProps)) xRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd; - xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, comphelper::getComponentContext(_rxFactory) ); + xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, _rxContext ); } else if (!sURL.isEmpty()) { // the row set has no data source, but a connection url set // -> try to connection with that url - Reference< XDriverManager > xDriverManager( - _rxFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.ConnectionPool"))), UNO_QUERY); + Reference< XDriverManager > xDriverManager; + try { + xDriverManager = ConnectionPool::create( _rxContext ); + } catch( const Exception& ) { } if (xDriverManager.is()) { ::rtl::OUString sUser, sPwd; @@ -472,18 +475,18 @@ SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const R } //------------------------------------------------------------------------------ -Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory, +Reference< XConnection> connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext, sal_Bool _bSetAsActiveConnection ) SAL_THROW ( ( SQLException, WrappedTargetException, RuntimeException ) ) { - SharedConnection xConnection = lcl_connectRowSet( _rxRowSet, _rxFactory, _bSetAsActiveConnection, true ); + SharedConnection xConnection = lcl_connectRowSet( _rxRowSet, _rxContext, _bSetAsActiveConnection, true ); return xConnection.getTyped(); } //------------------------------------------------------------------------------ -SharedConnection ensureRowSetConnection(const Reference< XRowSet>& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory, +SharedConnection ensureRowSetConnection(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext>& _rxContext, bool _bUseAutoConnectionDisposer ) SAL_THROW ( ( SQLException, WrappedTargetException, RuntimeException ) ) { - return lcl_connectRowSet( _rxRowSet, _rxFactory, true, _bUseAutoConnectionDisposer ); + return lcl_connectRowSet( _rxRowSet, _rxContext, true, _bUseAutoConnectionDisposer ); } //------------------------------------------------------------------------------ @@ -1266,13 +1269,13 @@ Reference< XDataSource> findDataSource(const Reference< XInterface >& _xParent) } //------------------------------------------------------------------------------ -Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const Reference< XPropertySet >& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory ) +Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const Reference< XPropertySet >& _rxRowSet, const Reference< XComponentContext >& _rxContext ) SAL_THROW( ( SQLException ) ) { Reference< XSingleSelectQueryComposer > xComposer; try { - Reference< XConnection> xConn = connectRowset( Reference< XRowSet >( _rxRowSet, UNO_QUERY ), _rxFactory, sal_True ); + Reference< XConnection> xConn = connectRowset( Reference< XRowSet >( _rxRowSet, UNO_QUERY ), _rxContext, sal_True ); if ( xConn.is() ) // implies _rxRowSet.is() { // build the statement the row set is based on (can't use the ActiveCommand property of the set @@ -1317,12 +1320,12 @@ Reference< XSingleSelectQueryComposer > getComposedRowSetStatement( const Refere //------------------------------------------------------------------------------ Reference< XSingleSelectQueryComposer > getCurrentSettingsComposer( const Reference< XPropertySet>& _rxRowSetProps, - const Reference< XMultiServiceFactory>& _rxFactory) + const Reference< XComponentContext>& _rxContext) { Reference< XSingleSelectQueryComposer > xReturn; try { - xReturn = getComposedRowSetStatement( _rxRowSetProps, _rxFactory ); + xReturn = getComposedRowSetStatement( _rxRowSetProps, _rxContext ); } catch( const SQLException& ) { diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx index b082e88adff3..ef83e56ea80c 100644 --- a/connectivity/source/commontools/parameters.cxx +++ b/connectivity/source/commontools/parameters.cxx @@ -63,15 +63,15 @@ namespace dbtools //= ParameterManager //==================================================================== //-------------------------------------------------------------------- - ParameterManager::ParameterManager( ::osl::Mutex& _rMutex, const Reference< XMultiServiceFactory >& _rxORB ) + ParameterManager::ParameterManager( ::osl::Mutex& _rMutex, const Reference< XComponentContext >& _rxContext ) :m_rMutex ( _rMutex ) ,m_aParameterListeners( _rMutex ) - ,m_xORB ( _rxORB ) + ,m_xContext ( _rxContext ) ,m_pOuterParameters ( NULL ) ,m_nInnerCount ( 0 ) ,m_bUpToDate ( false ) { - OSL_ENSURE( m_xORB.is(), "ParameterManager::ParameterManager: no service factory!" ); + OSL_ENSURE( m_xContext.is(), "ParameterManager::ParameterManager: no service factory!" ); } //-------------------------------------------------------------------- @@ -147,7 +147,7 @@ namespace dbtools try { // get a query composer for the 's settings - m_xComposer.reset( getCurrentSettingsComposer( _rxComponent, m_xORB ), SharedQueryComposer::TakeOwnership ); + m_xComposer.reset( getCurrentSettingsComposer( _rxComponent, m_xContext ), SharedQueryComposer::TakeOwnership ); // see if the composer found parameters Reference< XParametersSupplier > xParamSupp( m_xComposer, UNO_QUERY ); @@ -817,7 +817,7 @@ namespace dbtools // re-create the parent composer all the time. Else, we'd have to bother with // being a listener at its properties, its loaded state, and event the parent-relationship. m_xParentComposer.reset( - getCurrentSettingsComposer( xParent, m_xORB ), + getCurrentSettingsComposer( xParent, m_xContext ), SharedQueryComposer::TakeOwnership ); xParentColSupp = xParentColSupp.query( m_xParentComposer ); diff --git a/connectivity/source/simpledbt/staticdbtools_s.cxx b/connectivity/source/simpledbt/staticdbtools_s.cxx index 1d8939052326..f40f5e3b6932 100644 --- a/connectivity/source/simpledbt/staticdbtools_s.cxx +++ b/connectivity/source/simpledbt/staticdbtools_s.cxx @@ -90,10 +90,10 @@ namespace connectivity } //---------------------------------------------------------------- - Reference< XConnection> ODataAccessStaticTools::connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XMultiServiceFactory>& _rxFactory, sal_Bool _bSetAsActiveConnection) const + Reference< XConnection> ODataAccessStaticTools::connectRowset(const Reference< XRowSet>& _rxRowSet, const Reference< XComponentContext >& _rxContext, sal_Bool _bSetAsActiveConnection) const SAL_THROW ( (SQLException, WrappedTargetException, RuntimeException) ) { - return ::dbtools::connectRowset( _rxRowSet, _rxFactory, _bSetAsActiveConnection); + return ::dbtools::connectRowset( _rxRowSet, _rxContext, _bSetAsActiveConnection); } // ------------------------------------------------ diff --git a/connectivity/source/simpledbt/staticdbtools_s.hxx b/connectivity/source/simpledbt/staticdbtools_s.hxx index a8597209084b..83512c46572c 100644 --- a/connectivity/source/simpledbt/staticdbtools_s.hxx +++ b/connectivity/source/simpledbt/staticdbtools_s.hxx @@ -76,7 +76,7 @@ namespace connectivity // ------------------------------------------------ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext, sal_Bool _bSetAsActiveConnection ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 04c531e4bbb7..50b9aa322640 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1459,7 +1459,7 @@ void SAL_CALL ORowSet::executeWithCompletion( const Reference< XInteractionHandl calcConnection( _rxHandler ); m_bRebuildConnOnExecute = sal_False; - Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext.getLegacyServiceFactory() ); + Reference< XSingleSelectQueryComposer > xComposer = getCurrentSettingsComposer( this, m_aContext.getUNOContext() ); Reference<XParametersSupplier> xParameters(xComposer, UNO_QUERY); Reference<XIndexAccess> xParamsAsIndicies = xParameters.is() ? xParameters->getParameters() : Reference<XIndexAccess>(); diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 89c14fbc8103..b692bb5f4114 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/reflection/ProxyFactory.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> +#include <com/sun/star/sdbc/ConnectionPool.hpp> #include <com/sun/star/sdbc/XDriverAccess.hpp> #include <com/sun/star/sdbc/XDriverManager.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> @@ -642,9 +643,12 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O Reference< XConnection > xReturn; Reference< XDriverManager > xManager; - if ( !m_pImpl->m_aContext.createComponent( "com.sun.star.sdbc.ConnectionPool", xManager ) ) + try { + xManager.set( ConnectionPool::create( m_pImpl->m_aContext.getUNOContext() ) ); + } catch( const Exception& ) { } + if ( !xManager.is() ) // no connection pool installed, fall back to driver manager - m_pImpl->m_aContext.createComponent( "com.sun.star.sdbc.DriverManager", xManager ); + xManager.set( m_pImpl->m_aContext.createComponent( "com.sun.star.sdbc.DriverManager" ), UNO_QUERY_THROW ); ::rtl::OUString sUser(_rUid); ::rtl::OUString sPwd(_rPwd); diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index 80bb59906a0e..78373c523b4a 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -58,7 +58,7 @@ DatabaseDataProvider::DatabaseDataProvider(uno::Reference< uno::XComponentContex ::cppu::PropertySetMixin< chart2::data::XDatabaseDataProvider >( context, static_cast< Implements >( IMPLEMENTS_PROPERTY_SET), uno::Sequence< ::rtl::OUString >()), - m_aParameterManager( m_aMutex, uno::Reference< lang::XMultiServiceFactory >(context->getServiceManager(),uno::UNO_QUERY) ), + m_aParameterManager( m_aMutex, context ), m_aFilterManager( uno::Reference< lang::XMultiServiceFactory >(context->getServiceManager(),uno::UNO_QUERY) ), m_xContext(context), m_CommandType(sdb::CommandType::COMMAND), // #i94114 diff --git a/dbaccess/source/ui/uno/composerdialogs.cxx b/dbaccess/source/ui/uno/composerdialogs.cxx index 0a2cb1e87274..213bccb13e70 100644 --- a/dbaccess/source/ui/uno/composerdialogs.cxx +++ b/dbaccess/source/ui/uno/composerdialogs.cxx @@ -101,7 +101,7 @@ namespace dbaui // fallback: if there is a connection and thus a row set, but no composer, create one if ( xConnection.is() && !m_xComposer.is() ) - m_xComposer = ::dbtools::getCurrentSettingsComposer( Reference< XPropertySet >( m_xRowSet, UNO_QUERY ), m_aContext.getLegacyServiceFactory() ); + m_xComposer = ::dbtools::getCurrentSettingsComposer( Reference< XPropertySet >( m_xRowSet, UNO_QUERY ), m_aContext.getUNOContext() ); // the columns of the row set Reference< XColumnsSupplier > xSuppColumns( m_xRowSet, UNO_QUERY ); diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index f9861d8820ba..bc5804f57b7f 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/XDriverManager.hpp> +#include <com/sun/star/sdbc/ConnectionPool.hpp> #include <comphelper/componentcontext.hxx> #include <comphelper/interaction.hxx> @@ -127,6 +128,7 @@ namespace dbaui using ::com::sun::star::sdbc::XResultSetMetaData; using ::com::sun::star::sdbc::SQLException; using ::com::sun::star::sdb::SQLContext; + using ::com::sun::star::sdbc::ConnectionPool; using ::com::sun::star::sdbc::XDriverManager; using ::com::sun::star::beans::PropertyValue; /** === end UNO using === **/ @@ -952,7 +954,9 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference< OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo ); Reference< XDriverManager > xDriverManager; - xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.ConnectionPool" ), UNO_QUERY ); + try { + xDriverManager.set( ConnectionPool::create( m_aContext.getUNOContext() ) ); + } catch( const Exception& ) { } if ( !xDriverManager.is() ) // no connection pool installed xDriverManager.set( m_aContext.createComponent( "com.sun.star.sdbc.DriverManager" ), UNO_QUERY_THROW ); diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index fa0eb717f569..3c486324795b 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -273,9 +273,9 @@ namespace dbp //===================================================================== //--------------------------------------------------------------------- OControlWizard::OControlWizard( Window* _pParent, const ResId& _rId, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) + const Reference< XPropertySet >& _rxObjectModel, const Reference< XComponentContext >& _rxContext ) :OWizardMachine(_pParent, _rId, WZB_CANCEL | WZB_PREVIOUS | WZB_NEXT | WZB_FINISH) - ,m_xORB(_rxORB) + ,m_xContext(_rxContext) { m_aContext.xObjectModel = _rxObjectModel; initContext(); @@ -433,13 +433,11 @@ namespace dbp //--------------------------------------------------------------------- void OControlWizard::implGetDSContext() { - Reference< XMultiServiceFactory > xORB = getServiceFactory(); try { - DBG_ASSERT(xORB.is(), "OControlWizard::implGetDSContext: invalid service factory!"); + DBG_ASSERT(m_xContext.is(), "OControlWizard::implGetDSContext: invalid service factory!"); - m_aContext.xDatasourceContext = - DatabaseContext::create(comphelper::getComponentContext(xORB)); + m_aContext.xDatasourceContext = DatabaseContext::create(m_xContext); } catch(const Exception&) { @@ -509,7 +507,7 @@ namespace dbp Reference< XInteractionHandler > xHandler; try { - xHandler = Reference< XInteractionHandler >( InteractionHandler::createWithParent(comphelper::getComponentContext(getServiceFactory()), 0), UNO_QUERY_THROW ); + xHandler = Reference< XInteractionHandler >( InteractionHandler::createWithParent(m_xContext, 0), UNO_QUERY_THROW ); } catch(const Exception&) { } if (!xHandler.is()) @@ -567,7 +565,7 @@ namespace dbp Reference< XConnection > xConnection; m_aContext.bEmbedded = ::dbtools::isEmbeddedInDatabase( m_aContext.xForm, xConnection ); if ( !m_aContext.bEmbedded ) - xConnection = ::dbtools::connectRowset( m_aContext.xRowSet, getServiceFactory(), sal_True ); + xConnection = ::dbtools::connectRowset( m_aContext.xRowSet, m_xContext, sal_True ); // get the fields if (xConnection.is()) diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index dbb4748e2144..c6b97bd1d7a8 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -106,17 +106,15 @@ namespace dbp { private: OControlWizardContext m_aContext; - - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; public: OControlWizard( Window* _pParent, const ResId& _rId, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); ~OControlWizard(); @@ -124,8 +122,8 @@ namespace dbp sal_Bool travelNext() { return OControlWizard_Base::travelNext(); } public: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - getServiceFactory() const { return m_xORB; } + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + getComponentContext() const { return m_xContext; } const OControlWizardContext& getContext() const { return m_aContext; } sal_Bool updateContext(const OAccessRegulator&); diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index ece4e1d03865..dcb73bb3260b 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -51,8 +51,8 @@ namespace dbp //===================================================================== //--------------------------------------------------------------------- OGridWizard::OGridWizard( Window* _pParent, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OControlWizard(_pParent, ModuleRes(RID_DLG_GRIDWIZARD), _rxObjectModel, _rxORB) + const Reference< XPropertySet >& _rxObjectModel, const Reference< XComponentContext >& _rxContext ) + :OControlWizard(_pParent, ModuleRes(RID_DLG_GRIDWIZARD), _rxObjectModel, _rxContext) ,m_bHadDataSelection(sal_True) { initControlSettings(&m_aSettings); diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx index 43b2aa3e45ec..b837e3da4989 100644 --- a/extensions/source/dbpilots/gridwizard.hxx +++ b/extensions/source/dbpilots/gridwizard.hxx @@ -49,7 +49,7 @@ namespace dbp OGridWizard( Window* _pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); OGridSettings& getSettings() { return m_aSettings; } diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index a814272050d4..904c1c1c2ec1 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -48,8 +48,8 @@ namespace dbp //===================================================================== //--------------------------------------------------------------------- OGroupBoxWizard::OGroupBoxWizard( Window* _pParent, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OControlWizard(_pParent, ModuleRes(RID_DLG_GROUPBOXWIZARD), _rxObjectModel, _rxORB) + const Reference< XPropertySet >& _rxObjectModel, const Reference< XComponentContext >& _rxContext ) + :OControlWizard(_pParent, ModuleRes(RID_DLG_GROUPBOXWIZARD), _rxObjectModel, _rxContext) ,m_bVisitedDefault(sal_False) ,m_bVisitedDB(sal_False) { @@ -160,7 +160,7 @@ namespace dbp { try { - OOptionGroupLayouter aLayouter(comphelper::getComponentContext(getServiceFactory())); + OOptionGroupLayouter aLayouter( getComponentContext() ); aLayouter.doLayout(getContext(), getSettings()); } catch(const Exception&) diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx index e7e082412f1a..026e39e7ea4b 100644 --- a/extensions/source/dbpilots/groupboxwiz.hxx +++ b/extensions/source/dbpilots/groupboxwiz.hxx @@ -55,7 +55,7 @@ namespace dbp OGroupBoxWizard( Window* _pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); OOptionGroupSettings& getSettings() { return m_aSettings; } diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx index f25c3653a45d..08e365807d95 100644 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ b/extensions/source/dbpilots/listcombowizard.cxx @@ -50,8 +50,8 @@ namespace dbp //===================================================================== //--------------------------------------------------------------------- OListComboWizard::OListComboWizard( Window* _pParent, - const Reference< XPropertySet >& _rxObjectModel, const Reference< XMultiServiceFactory >& _rxORB ) - :OControlWizard(_pParent, ModuleRes(RID_DLG_LISTCOMBOWIZARD), _rxObjectModel, _rxORB) + const Reference< XPropertySet >& _rxObjectModel, const Reference< XComponentContext >& _rxContext ) + :OControlWizard(_pParent, ModuleRes(RID_DLG_LISTCOMBOWIZARD), _rxObjectModel, _rxContext) ,m_bListBox(sal_False) ,m_bHadDataSelection(sal_True) { diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx index d312d2857bbc..8c9fc3ac0268 100644 --- a/extensions/source/dbpilots/listcombowizard.hxx +++ b/extensions/source/dbpilots/listcombowizard.hxx @@ -59,7 +59,7 @@ namespace dbp OListComboWizard( Window* _pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); OListComboSettings& getSettings() { return m_aSettings; } diff --git a/extensions/source/dbpilots/unoautopilot.inl b/extensions/source/dbpilots/unoautopilot.inl index 035982ea9d2a..9375243425bd 100644 --- a/extensions/source/dbpilots/unoautopilot.inl +++ b/extensions/source/dbpilots/unoautopilot.inl @@ -99,7 +99,7 @@ template <class TYPE, class SERVICEINFO> template <class TYPE, class SERVICEINFO> Dialog* OUnoAutoPilot<TYPE, SERVICEINFO>::createDialog(Window* _pParent) { - return new TYPE(_pParent, m_xObjectModel, m_aContext.getLegacyServiceFactory()); + return new TYPE(_pParent, m_xObjectModel, m_aContext.getUNOContext()); } //-------------------------------------------------------------------------- diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 42fd503daa25..992b2d5fb927 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2414,7 +2414,7 @@ namespace pcr if ( xRowSetProps.is() ) { WaitCursor aWaitCursor( impl_getDefaultDialogParent_nothrow() ); - m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet, m_aContext.getLegacyServiceFactory(), false ); + m_xRowSetConnection = ::dbtools::ensureRowSetConnection( xRowSet, m_aContext.getUNOContext(), false ); } } catch ( const SQLException& ) { aError = SQLExceptionInfo( ::cppu::getCaughtException() ); } @@ -2632,7 +2632,7 @@ namespace pcr return false; // get a composer for the statement which the form is currently based on - Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent, m_aContext.getLegacyServiceFactory() ) ); + Reference< XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( m_xComponent, m_aContext.getUNOContext() ) ); OSL_ENSURE( xComposer.is(), "FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow: could not obtain a composer!" ); if ( !xComposer.is() ) return false; diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index ecc2c7059c4c..fadcc0afd107 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -31,6 +31,7 @@ #include <connectivity/dbtools.hxx> #include <connectivity/dbexception.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XKeysSupplier.hpp> @@ -449,7 +450,7 @@ namespace pcr _rxConnection.set(_rxFormProps->getPropertyValue(PROPERTY_ACTIVE_CONNECTION),UNO_QUERY); if ( !_rxConnection.is() ) - _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), m_xORB, sal_True ); + _rxConnection = ::dbtools::connectRowset( Reference< XRowSet >( _rxFormProps, UNO_QUERY ), comphelper::getComponentContext(m_xORB), sal_True ); } //------------------------------------------------------------------------ @@ -471,7 +472,7 @@ namespace pcr Reference< XPropertySet > xTable; try { - Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, m_xORB ), UNO_QUERY ); + Reference< XTablesSupplier > xTablesInForm( ::dbtools::getCurrentSettingsComposer( _rxFormProps, comphelper::getComponentContext(m_xORB) ), UNO_QUERY ); Reference< XNameAccess > xTables; if ( xTablesInForm.is() ) xTables = xTablesInForm->getTables(); diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 434b4ef94587..99f17d4a857c 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -292,7 +292,7 @@ ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory) ,m_aPropertyBagHelper( *this ) ,m_pAggregatePropertyMultiplexer(NULL) ,m_pGroupManager( NULL ) - ,m_aParameterManager( m_aMutex, _rxFactory ) + ,m_aParameterManager( m_aMutex, comphelper::getComponentContext(_rxFactory) ) ,m_aFilterManager( _rxFactory ) ,m_pLoadTimer(NULL) ,m_pThread(NULL) @@ -332,7 +332,7 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource ) ,m_aPropertyBagHelper( *this ) ,m_pAggregatePropertyMultiplexer( NULL ) ,m_pGroupManager( NULL ) - ,m_aParameterManager( m_aMutex, _cloneSource.m_xServiceFactory ) + ,m_aParameterManager( m_aMutex, comphelper::getComponentContext(_cloneSource.m_xServiceFactory) ) ,m_aFilterManager( _cloneSource.m_xServiceFactory ) ,m_pLoadTimer( NULL ) ,m_pThread( NULL ) @@ -2844,7 +2844,7 @@ sal_Bool ODatabaseForm::implEnsureConnection() { Reference< XConnection > xConnection = connectRowset( Reference<XRowSet> (m_xAggregate, UNO_QUERY), - m_xServiceFactory, + comphelper::getComponentContext(m_xServiceFactory), sal_True // set a calculated connection as ActiveConnection ); return xConnection.is(); diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 6922728c1ace..d7ea714b58d9 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -1590,7 +1590,7 @@ bool GeometryHandler::impl_dialogFilter_nothrow( ::rtl::OUString& _out_rSelected } // get a composer for the statement which the form is currently based on - uno::Reference< sdb::XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( xRowSetProp, xServiceFactory ) ); + uno::Reference< sdb::XSingleSelectQueryComposer > xComposer( ::dbtools::getCurrentSettingsComposer( xRowSetProp, m_xContext ) ); OSL_ENSURE( xComposer.is(), "GeometryHandler::impl_dialogFilter_nothrow: could not obtain a composer!" ); if ( !xComposer.is() ) return false; diff --git a/svx/inc/svx/dbtoolsclient.hxx b/svx/inc/svx/dbtoolsclient.hxx index 24b9976fccc1..501bc1552655 100644 --- a/svx/inc/svx/dbtoolsclient.hxx +++ b/svx/inc/svx/dbtoolsclient.hxx @@ -107,7 +107,7 @@ namespace svxform // ------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext, sal_Bool _bSetAsActiveConnection ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException , ::com::sun::star::lang::WrappedTargetException diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx index 872afb51d79e..aab897135bb1 100644 --- a/svx/source/form/dbtoolsclient.cxx +++ b/svx/source/form/dbtoolsclient.cxx @@ -210,12 +210,12 @@ namespace svxform //-------------------------------------------------------------------- Reference< XConnection > OStaticDataAccessTools::connectRowset( const Reference< XRowSet >& _rxRowSet, - const Reference< XMultiServiceFactory >& _rxFactory, sal_Bool _bSetAsActiveConnection ) const + const Reference< XComponentContext >& _rxContext, sal_Bool _bSetAsActiveConnection ) const SAL_THROW ( ( SQLException, WrappedTargetException, RuntimeException ) ) { Reference< XConnection > xReturn; if ( ensureLoaded() ) - xReturn = m_xDataAccessTools->connectRowset( _rxRowSet, _rxFactory, _bSetAsActiveConnection ); + xReturn = m_xDataAccessTools->connectRowset( _rxRowSet, _rxContext, _bSetAsActiveConnection ); return xReturn; } diff --git a/svx/source/form/tabwin.cxx b/svx/source/form/tabwin.cxx index 1b8efb052600..7be58df51c18 100644 --- a/svx/source/form/tabwin.cxx +++ b/svx/source/form/tabwin.cxx @@ -352,7 +352,7 @@ void FmFieldWin::UpdateContent(const ::com::sun::star::uno::Reference< ::com::su // get the connection of the form OStaticDataAccessTools aTools; m_aConnection.reset( - aTools.connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessServiceFactory(), sal_True ), + aTools.connectRowset( Reference< XRowSet >( xForm, UNO_QUERY ), ::comphelper::getProcessComponentContext(), sal_True ), SharedConnection::NoTakeOwnership ); // TODO: When incompatible changes (such as extending the "virtualdbtools" interface by ensureRowSetConnection) |