diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-31 15:30:37 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-03 10:00:02 +0200 |
commit | 2838b8eb5ead00780ed9ed9410abee8b8d53a9a4 (patch) | |
tree | 9adc985fafa8e87435546cee5e64aa6d83ef1fe3 /connectivity | |
parent | 28e3aff576f06b0b02c7232da5d723e865b3c7ed (diff) |
fdo#46808, Convert ComponentContext in connectivity,extension..
...modules.
Change-Id: Ie61976dc12b514bb85ca42496c0d9173a1c56264
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbmetadata.cxx | 6 | ||||
-rw-r--r-- | connectivity/source/commontools/formattedcolumnvalue.cxx | 12 | ||||
-rw-r--r-- | connectivity/source/manager/mdrivermanager.cxx | 31 | ||||
-rw-r--r-- | connectivity/source/manager/mdrivermanager.hxx | 18 | ||||
-rw-r--r-- | connectivity/source/simpledbt/dbtfactory.cxx | 5 | ||||
-rw-r--r-- | connectivity/source/simpledbt/dbtfactory.hxx | 4 |
6 files changed, 36 insertions, 40 deletions
diff --git a/connectivity/source/commontools/dbmetadata.cxx b/connectivity/source/commontools/dbmetadata.cxx index 79881a425d73..788fc88dd0a5 100644 --- a/connectivity/source/commontools/dbmetadata.cxx +++ b/connectivity/source/commontools/dbmetadata.cxx @@ -38,7 +38,6 @@ #include <tools/diagnose_ex.h> #include <comphelper/namedvaluecollection.hxx> -#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <sal/macros.h> @@ -56,6 +55,7 @@ namespace dbtools using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::container::XChild; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::beans::XPropertySet; @@ -364,7 +364,7 @@ namespace dbtools } //-------------------------------------------------------------------- - bool DatabaseMetaData::supportsUserAdministration( const ::comphelper::ComponentContext& _rContext ) const + bool DatabaseMetaData::supportsUserAdministration( const Reference<XComponentContext>& _rContext ) const { lcl_checkConnected( *m_pImpl ); @@ -377,7 +377,7 @@ namespace dbtools if ( !xUsersSupp.is() ) { // - or at the driver manager - Reference< XDriverManager2 > xDriverManager = DriverManager::create( _rContext.getUNOContext() ); + Reference< XDriverManager2 > xDriverManager = DriverManager::create( _rContext ); Reference< XDataDefinitionSupplier > xDriver( xDriverManager->getDriverByURL( m_pImpl->xConnectionMetaData->getURL() ), UNO_QUERY ); if ( xDriver.is() ) xUsersSupp.set( xDriver->getDataDefinitionByConnection( m_pImpl->xConnection ), UNO_QUERY ); diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index daff9098e88a..625872fa22c3 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -33,7 +33,6 @@ #include <i18nlangtag/mslangid.hxx> #include <i18nlangtag/languagetag.hxx> #include <comphelper/numbers.hxx> -#include <comphelper/componentcontext.hxx> #include <unotools/sharedunocomponent.hxx> //........................................................................ @@ -49,6 +48,7 @@ namespace dbtools using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::sdbc::XRowSet; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::util::NumberFormatter; @@ -184,7 +184,7 @@ namespace dbtools } //................................................................ - void lcl_initColumnDataValue_nothrow( const ::comphelper::ComponentContext& i_rContext, FormattedColumnValue_Data& i_rData, + void lcl_initColumnDataValue_nothrow( const Reference<XComponentContext>& i_rContext, FormattedColumnValue_Data& i_rData, const Reference< XRowSet >& i_rRowSet, const Reference< XPropertySet >& i_rColumn ) { OSL_PRECOND( i_rRowSet.is(), "lcl_initColumnDataValue_nothrow: no row set!" ); @@ -196,10 +196,10 @@ namespace dbtools { // get the number formats supplier of the connection of the form Reference< XConnection > xConnection( getConnection( i_rRowSet ), UNO_QUERY_THROW ); - Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_True, i_rContext.getUNOContext() ), UNO_SET_THROW ); + Reference< XNumberFormatsSupplier > xSupplier( getNumberFormats( xConnection, sal_True, i_rContext ), UNO_SET_THROW ); // create a number formatter for it - xNumberFormatter.set( NumberFormatter::create(i_rContext.getUNOContext()), UNO_QUERY_THROW ); + xNumberFormatter.set( NumberFormatter::create( i_rContext ), UNO_QUERY_THROW ); xNumberFormatter->attachNumberFormatsSupplier( xSupplier ); } catch( const Exception& ) @@ -215,11 +215,11 @@ namespace dbtools //= FormattedColumnValue //==================================================================== //-------------------------------------------------------------------- - FormattedColumnValue::FormattedColumnValue( const ::comphelper::ComponentContext& i_rContext, + FormattedColumnValue::FormattedColumnValue( const Reference< XComponentContext >& _rxContext, const Reference< XRowSet >& _rxRowSet, const Reference< XPropertySet >& i_rColumn ) :m_pData( new FormattedColumnValue_Data ) { - lcl_initColumnDataValue_nothrow( i_rContext, *m_pData, _rxRowSet, i_rColumn ); + lcl_initColumnDataValue_nothrow( _rxContext, *m_pData, _rxRowSet, i_rColumn ); } //-------------------------------------------------------------------- diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index 6c40bb8f3d00..6458cf046c89 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -65,7 +65,7 @@ class ODriverEnumeration : public ::cppu::WeakImplHelper1< XEnumeration > { friend class OSDBCDriverManager; - DECLARE_STL_VECTOR( SdbcDriver, DriverArray ); + DECLARE_STL_VECTOR( Reference< XDriver >, DriverArray ); DriverArray m_aDrivers; ConstDriverArrayIterator m_aPos; // order matters! @@ -127,9 +127,9 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W }; /// an STL functor which extracts a SdbcDriver from a DriverAccess - struct ExtractDriverFromAccess : public ::std::unary_function< DriverAccess, SdbcDriver > + struct ExtractDriverFromAccess : public ::std::unary_function< DriverAccess, Reference<XDriver> > { - SdbcDriver operator()( const DriverAccess& _rAccess ) const + Reference<XDriver> operator()( const DriverAccess& _rAccess ) const { return _rAccess.xDriver; } @@ -142,16 +142,16 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W ExtractAfterLoad() : ExtractAfterLoad_BASE( ExtractDriverFromAccess(), EnsureDriver() ) { } }; - struct ExtractDriverFromCollectionElement : public ::std::unary_function< DriverCollection::value_type, SdbcDriver > + struct ExtractDriverFromCollectionElement : public ::std::unary_function< DriverCollection::value_type, Reference<XDriver> > { - SdbcDriver operator()( const DriverCollection::value_type& _rElement ) const + Reference<XDriver> operator()( const DriverCollection::value_type& _rElement ) const { return _rElement.second; } }; // predicate for checking whether or not a driver accepts a given URL - class AcceptsURL : public ::std::unary_function< SdbcDriver, bool > + class AcceptsURL : public ::std::unary_function< Reference<XDriver>, bool > { protected: const OUString& m_rURL; @@ -161,7 +161,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W AcceptsURL( const OUString& _rURL ) : m_rURL( _rURL ) { } //................................................................. - bool operator()( const SdbcDriver& _rDriver ) const + bool operator()( const Reference<XDriver>& _rDriver ) const { // ask the driver if ( _rDriver.is() && _rDriver->acceptsURL( m_rURL ) ) @@ -172,7 +172,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W } }; - static sal_Int32 lcl_getDriverPrecedence( const ::comphelper::ComponentContext& _rContext, Sequence< OUString >& _rPrecedence ) + static sal_Int32 lcl_getDriverPrecedence( const Reference<XComponentContext>& _rContext, Sequence< OUString >& _rPrecedence ) { _rPrecedence.realloc( 0 ); try @@ -185,8 +185,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W // create a configuration provider Reference< XMultiServiceFactory > xConfigurationProvider( - com::sun::star::configuration::theDefaultProvider::get( - _rContext.getUNOContext() ) ); + com::sun::star::configuration::theDefaultProvider::get( _rContext ) ); // one argument for creating the node access: the path to the configuration node Sequence< Any > aCreationArgs(1); @@ -242,9 +241,9 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W //========================================================================== //-------------------------------------------------------------------------- OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& _rxContext ) - :m_aContext( _rxContext ) + :m_xContext( _rxContext ) ,m_aEventLogger( _rxContext, "org.openoffice.logging.sdbc.DriverManager" ) - ,m_aDriverConfig(m_aContext.getUNOContext()) + ,m_aDriverConfig(m_xContext) ,m_nLoginTimeout(0) { // bootstrap all objects supporting the .sdb.Driver service @@ -261,7 +260,7 @@ OSDBCDriverManager::~OSDBCDriverManager() void OSDBCDriverManager::bootstrapDrivers() { - Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY ); + Reference< XContentEnumerationAccess > xEnumAccess( m_xContext->getServiceManager(), UNO_QUERY ); Reference< XEnumeration > xEnumDrivers; if (xEnumAccess.is()) xEnumDrivers = xEnumAccess->createContentEnumeration(SERVICE_SDBC_DRIVER); @@ -288,7 +287,7 @@ void OSDBCDriverManager::bootstrapDrivers() { // yes -> no need to load the driver immediately (load it later when needed) aDriverDescriptor.sImplementationName = xSI->getImplementationName(); aDriverDescriptor.xComponentFactory = xFactory; - aDriverDescriptor.xUNOContext = m_aContext.getUNOContext(); + aDriverDescriptor.xUNOContext = m_xContext; bValidDescriptor = sal_True; m_aEventLogger.log( LogLevel::CONFIG, @@ -299,7 +298,7 @@ void OSDBCDriverManager::bootstrapDrivers() else { // no -> create the driver - Reference< XDriver > xDriver( xFactory->createInstanceWithContext( m_aContext.getUNOContext() ), UNO_QUERY ); + Reference< XDriver > xDriver( xFactory->createInstanceWithContext( m_xContext ), UNO_QUERY ); OSL_ENSURE( xDriver.is(), "OSDBCDriverManager::bootstrapDrivers: a driver which is no driver?!" ); if ( xDriver.is() ) @@ -341,7 +340,7 @@ void OSDBCDriverManager::initializeDriverPrecedence() { // get the precedence of the drivers from the configuration Sequence< OUString > aDriverOrder; - if ( 0 == lcl_getDriverPrecedence( m_aContext, aDriverOrder ) ) + if ( 0 == lcl_getDriverPrecedence( m_xContext, aDriverOrder ) ) // nothing to do return; diff --git a/connectivity/source/manager/mdrivermanager.hxx b/connectivity/source/manager/mdrivermanager.hxx index 8fae89d3d718..be1e2586e9c3 100644 --- a/connectivity/source/manager/mdrivermanager.hxx +++ b/connectivity/source/manager/mdrivermanager.hxx @@ -31,7 +31,6 @@ #include <cppuhelper/implbase3.hxx> #include <comphelper/stl_types.hxx> #include <comphelper/logging.hxx> -#include <comphelper/componentcontext.hxx> #include <osl/mutex.hxx> #include "connectivity/DriversConfig.hxx" @@ -41,17 +40,14 @@ namespace drivermanager //====================================================================== //= various //====================================================================== - typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDriver > SdbcDriver; - DECLARE_STL_USTRINGACCESS_MAP( SdbcDriver, DriverCollection ); + DECLARE_STL_USTRINGACCESS_MAP( css::uno::Reference< css::sdbc::XDriver >, DriverCollection ); - typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > DriverFactory; - typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > UNOContext; struct DriverAccess { - OUString sImplementationName; /// the implementation name of the driver - DriverFactory xComponentFactory; /// the factory to create the driver component (if not already done so) - UNOContext xUNOContext; /// ensure UNO context propagation - SdbcDriver xDriver; /// the driver itself + OUString sImplementationName; /// the implementation name of the driver + css::uno::Reference< css::sdbc::XDriver > xDriver; /// the driver itself + css::uno::Reference< css::lang::XSingleComponentFactory > xComponentFactory; /// the factory to create the driver component (if not already done so) + css::uno::Reference<css::uno::XComponentContext> xUNOContext; /// ensure UNO context propagation }; //========================================================================== @@ -67,7 +63,7 @@ namespace drivermanager friend class ODriverEnumeration; ::osl::Mutex m_aMutex; - ::comphelper::ComponentContext m_aContext; + css::uno::Reference<css::uno::XComponentContext> m_xContext; ::comphelper::EventLogger m_aEventLogger; DECLARE_STL_VECTOR(DriverAccess, DriverAccessArray); @@ -75,7 +71,7 @@ namespace drivermanager // for drivers registered at runtime (not bootstrapped) we don't require an XServiceInfo interface, // so we have to remember their impl-name in another way - DECLARE_STL_USTRINGACCESS_MAP(SdbcDriver, DriverCollection); + DECLARE_STL_USTRINGACCESS_MAP(css::uno::Reference< css::sdbc::XDriver >, DriverCollection); DriverCollection m_aDriversRT; ::connectivity::DriversConfig m_aDriverConfig; diff --git a/connectivity/source/simpledbt/dbtfactory.cxx b/connectivity/source/simpledbt/dbtfactory.cxx index 29d000423ed0..acaa5a934754 100644 --- a/connectivity/source/simpledbt/dbtfactory.cxx +++ b/connectivity/source/simpledbt/dbtfactory.cxx @@ -85,10 +85,11 @@ namespace connectivity //---------------------------------------------------------------- SAL_WNODEPRECATED_DECLARATIONS_PUSH - ::std::auto_ptr< ::dbtools::FormattedColumnValue > ODataAccessToolsFactory::createFormattedColumnValue( const ::comphelper::ComponentContext& _rContext, + ::std::auto_ptr< ::dbtools::FormattedColumnValue > ODataAccessToolsFactory::createFormattedColumnValue( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet, const Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn ) { - ::std::auto_ptr< ::dbtools::FormattedColumnValue > pValue( new ::dbtools::FormattedColumnValue( _rContext, _rxRowSet, _rxColumn ) ); + ::std::auto_ptr< ::dbtools::FormattedColumnValue > pValue( new ::dbtools::FormattedColumnValue( _rxContext, _rxRowSet, _rxColumn ) ); return pValue; } SAL_WNODEPRECATED_DECLARATIONS_POP diff --git a/connectivity/source/simpledbt/dbtfactory.hxx b/connectivity/source/simpledbt/dbtfactory.hxx index 40005ecbdd9f..6dee4c83f385 100644 --- a/connectivity/source/simpledbt/dbtfactory.hxx +++ b/connectivity/source/simpledbt/dbtfactory.hxx @@ -44,7 +44,7 @@ namespace connectivity // IDataAccessToolsFactory virtual ::rtl::Reference< simple::ISQLParser > createSQLParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const IParseContext* _pContext ) const; @@ -55,7 +55,7 @@ namespace connectivity virtual ::rtl::Reference< simple::IDataAccessTools > getDataAccessTools(); virtual ::std::auto_ptr< ::dbtools::FormattedColumnValue > createFormattedColumnValue( - const ::comphelper::ComponentContext& _rContext, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn ); |