From 0666e43c45876199ddc71e378554878cca6f0539 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 2 Nov 2012 15:13:28 +0200 Subject: fdo#46808, use service constructor for i18n::CharacterClassification Change-Id: I0499ad7de27b1539e97f01ab8aa0ef2d6713ae76 --- connectivity/inc/connectivity/predicateinput.hxx | 6 ++---- connectivity/inc/connectivity/sqlparse.hxx | 4 ++-- connectivity/inc/connectivity/virtualdbtools.hxx | 2 +- .../source/commontools/ParamterSubstitution.cxx | 3 +-- connectivity/source/commontools/predicateinput.cxx | 19 +++++++++---------- connectivity/source/drivers/file/FStatement.cxx | 3 ++- connectivity/source/drivers/flat/ETable.cxx | 2 +- connectivity/source/drivers/jdbc/JConnection.cxx | 2 +- connectivity/source/drivers/kab/KDriver.hxx | 5 +++-- connectivity/source/drivers/kab/KStatement.cxx | 2 +- connectivity/source/drivers/mork/MStatement.cxx | 3 ++- .../source/drivers/odbcbase/OPreparedStatement.cxx | 3 ++- connectivity/source/parse/sqlnode.cxx | 13 +++++++------ connectivity/source/simpledbt/dbtfactory.cxx | 4 ++-- connectivity/source/simpledbt/dbtfactory.hxx | 2 +- connectivity/source/simpledbt/parser_s.cxx | 4 ++-- connectivity/source/simpledbt/parser_s.hxx | 2 +- 17 files changed, 40 insertions(+), 39 deletions(-) (limited to 'connectivity') diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx index 56abc6e2959a..776e357261b2 100644 --- a/connectivity/inc/connectivity/predicateinput.hxx +++ b/connectivity/inc/connectivity/predicateinput.hxx @@ -21,7 +21,7 @@ #define CONNECTIVITY_PREDICATEINPUT_HXX #include -#include +#include #include #include #include @@ -42,8 +42,6 @@ namespace dbtools class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController { private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > @@ -56,7 +54,7 @@ namespace dbtools public: OPredicateInputController( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, const ::connectivity::IParseContext* _pParseContext = NULL ); diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx index a4a64b3a2480..e67aa7d034ce 100644 --- a/connectivity/inc/connectivity/sqlparse.hxx +++ b/connectivity/inc/connectivity/sqlparse.hxx @@ -163,7 +163,7 @@ namespace connectivity m_xFormatter; // current number formatter sal_Int32 m_nFormatKey; // numberformat, which should be used sal_Int32 m_nDateFormatKey; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification> m_xCharClass; static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> s_xLocaleData; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> xDummy; // can be deleted after 627 @@ -183,7 +183,7 @@ namespace connectivity public: // if NULL, a default context will be used // the context must live as long as the parser - OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory,const IParseContext* _pContext = NULL); + OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext = NULL); ~OSQLParser(); // Parsing an SQLStatement diff --git a/connectivity/inc/connectivity/virtualdbtools.hxx b/connectivity/inc/connectivity/virtualdbtools.hxx index 0f6f6520ed7b..7551bedac8d6 100644 --- a/connectivity/inc/connectivity/virtualdbtools.hxx +++ b/connectivity/inc/connectivity/virtualdbtools.hxx @@ -335,7 +335,7 @@ namespace connectivity public: /// creates a simple version of the class OSQLParser virtual ::rtl::Reference< ISQLParser > createSQLParser( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext ) const = 0; diff --git a/connectivity/source/commontools/ParamterSubstitution.cxx b/connectivity/source/commontools/ParamterSubstitution.cxx index 5a31a9308cab..68f1e163c7be 100644 --- a/connectivity/source/commontools/ParamterSubstitution.cxx +++ b/connectivity/source/commontools/ParamterSubstitution.cxx @@ -86,8 +86,7 @@ namespace connectivity { try { - uno::Reference< XMultiServiceFactory> xFac(m_xContext->getServiceManager(),uno::UNO_QUERY_THROW); - OSQLParser aParser( xFac ); + OSQLParser aParser( m_xContext ); ::rtl::OUString sErrorMessage; ::rtl::OUString sNewSql; OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sText); diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index f8f89601f21c..8b6220ba6107 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -39,12 +39,12 @@ namespace dbtools //......................................................................... using ::com::sun::star::sdbc::XConnection; - using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::util::XNumberFormatsSupplier; using ::com::sun::star::util::NumberFormatter; using ::com::sun::star::util::XNumberFormatter; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::lang::Locale; @@ -100,19 +100,18 @@ namespace dbtools //--------------------------------------------------------------------- OPredicateInputController::OPredicateInputController( - const Reference< XMultiServiceFactory >& _rxORB, const Reference< XConnection >& _rxConnection, const IParseContext* _pParseContext ) - :m_xORB( _rxORB ) - ,m_xConnection( _rxConnection ) - ,m_aParser( m_xORB, _pParseContext ) + const Reference< XComponentContext >& rxContext, const Reference< XConnection >& _rxConnection, const IParseContext* _pParseContext ) + : m_xConnection( _rxConnection ) + ,m_aParser( rxContext, _pParseContext ) { try { // create a number formatter / number formats supplier pair - OSL_ENSURE( m_xORB.is(), "OPredicateInputController::OPredicateInputController: need a service factory!" ); - if ( m_xORB.is() ) + OSL_ENSURE( rxContext.is(), "OPredicateInputController::OPredicateInputController: need a service factory!" ); + if ( rxContext.is() ) { m_xFormatter = Reference< XNumberFormatter >( - NumberFormatter::create(comphelper::getComponentContext(m_xORB)), + NumberFormatter::create(rxContext), UNO_QUERY_THROW ); } @@ -124,9 +123,9 @@ namespace dbtools m_xFormatter->attachNumberFormatsSupplier( xNumberFormats ); // create the locale data - if ( m_xORB.is() ) + if ( rxContext.is() ) { - m_xLocaleData = LocaleData::create( comphelper::getComponentContext(m_xORB) ); + m_xLocaleData = LocaleData::create( rxContext ); } } catch( const Exception& ) diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index c606bbfe9dfc..49c604664d9b 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "connectivity/dbexception.hxx" @@ -57,7 +58,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) :OStatement_BASE(m_aMutex) ,::comphelper::OPropertyContainer(OStatement_BASE::rBHelper) ,m_xDBMetaData(_pConnection->getMetaData()) - ,m_aParser(_pConnection->getDriver()->getFactory()) + ,m_aParser( comphelper::getComponentContext(_pConnection->getDriver()->getFactory()) ) ,m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) ,m_pConnection(_pConnection) ,m_pParseTree(NULL) diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 110f40195be4..0d57cb18b971 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -109,7 +109,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_aScales.assign(nFieldCount+1,-1); const sal_Bool bCase = m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(); - CharClass aCharClass(pConnection->getDriver()->getFactory(),_aLocale); + CharClass aCharClass( comphelper::getComponentContext(pConnection->getDriver()->getFactory()), _aLocale); // read description const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx index 6921c0d96050..a814c1b6665d 100644 --- a/connectivity/source/drivers/jdbc/JConnection.cxx +++ b/connectivity/source/drivers/jdbc/JConnection.cxx @@ -469,7 +469,7 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( ) throw( { try { - OSQLParser aParser( m_pDriver->getContext().getLegacyServiceFactory() ); + OSQLParser aParser( m_pDriver->getContext().getUNOContext() ); ::rtl::OUString sErrorMessage; ::rtl::OUString sNewSql; OSQLParseNode* pNode = aParser.parseTree(sErrorMessage,_sSQL); diff --git a/connectivity/source/drivers/kab/KDriver.hxx b/connectivity/source/drivers/kab/KDriver.hxx index b51058151279..1243f7425185 100644 --- a/connectivity/source/drivers/kab/KDriver.hxx +++ b/connectivity/source/drivers/kab/KDriver.hxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -161,8 +162,8 @@ namespace connectivity static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& - getMSFactory() const { return m_xMSFactory; } + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + getComponentContext() const { return comphelper::getComponentContext(m_xMSFactory); } /** returns the driver's implementation name (being pure ASCII) for reference in various places */ diff --git a/connectivity/source/drivers/kab/KStatement.cxx b/connectivity/source/drivers/kab/KStatement.cxx index e898ee48f62f..a5babf0c2de3 100644 --- a/connectivity/source/drivers/kab/KStatement.cxx +++ b/connectivity/source/drivers/kab/KStatement.cxx @@ -62,7 +62,7 @@ IMPLEMENT_SERVICE_INFO(KabStatement, "com.sun.star.sdbc.drivers.KabStatement", " KabCommonStatement::KabCommonStatement(KabConnection* _pConnection ) : KabCommonStatement_BASE(m_aMutex), OPropertySetHelper(KabCommonStatement_BASE::rBHelper), - m_aParser(_pConnection->getDriver()->getMSFactory()), + m_aParser(_pConnection->getDriver()->getComponentContext()), m_aSQLIterator(_pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ), m_pParseTree(NULL), m_pConnection(_pConnection), diff --git a/connectivity/source/drivers/mork/MStatement.cxx b/connectivity/source/drivers/mork/MStatement.cxx index 342ac2add17b..2beacfecd95a 100644 --- a/connectivity/source/drivers/mork/MStatement.cxx +++ b/connectivity/source/drivers/mork/MStatement.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -79,7 +80,7 @@ OCommonStatement::OCommonStatement(OConnection* _pConnection ) ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this) ,m_pTable(NULL) ,m_pConnection(_pConnection) - ,m_aParser(_pConnection->getDriver()->getFactory()) + ,m_aParser( comphelper::getComponentContext(_pConnection->getDriver()->getFactory()) ) ,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) ) ,rBHelper(OCommonStatement_IBASE::rBHelper) { diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx index 206369840936..f5c05b80f76f 100644 --- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx @@ -30,6 +30,7 @@ #include "odbc/OResultSet.hxx" #include "odbc/OResultSetMetaData.hxx" #include +#include #include #include #include "connectivity/dbtools.hxx" @@ -73,7 +74,7 @@ OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::O { if(_pConnection->isParameterSubstitutionEnabled()) { - OSQLParser aParser(_pConnection->getDriver()->getORB()); + OSQLParser aParser( comphelper::getComponentContext(_pConnection->getDriver()->getORB()) ); ::rtl::OUString sErrorMessage; ::rtl::OUString sNewSql; ::std::auto_ptr pNode( aParser.parseTree(sErrorMessage,sql) ); diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index daf8ff5e768a..73fd5101c7cb 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include "connectivity/dbconversion.hxx" #include #include @@ -1068,8 +1069,8 @@ OSQLParseNode* OSQLParser::buildNode_STR_NUM(OSQLParseNode*& _pLiteral) { ::rtl::OUString aValue; if(!m_xCharClass.is()) - m_xCharClass = Reference(m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.i18n.CharacterClassification")),UNO_QUERY); - if(m_xCharClass.is() && s_xLocaleData.is()) + m_xCharClass = CharacterClassification::create( m_xContext ); + if( s_xLocaleData.is() ) { try { @@ -1259,13 +1260,13 @@ OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const : //============================================================================= //----------------------------------------------------------------------------- -OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory,const IParseContext* _pContext) +OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext) :m_pContext(_pContext) ,m_pParseTree(NULL) - ,m_pData( new OSQLParser_Data( _xServiceFactory ) ) + ,m_pData( new OSQLParser_Data( uno::Reference(rxContext->getServiceManager(), uno::UNO_QUERY_THROW) ) ) ,m_nFormatKey(0) ,m_nDateFormatKey(0) - ,m_xServiceFactory(_xServiceFactory) + ,m_xContext(rxContext) { @@ -1286,7 +1287,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: s_pGarbageCollector = new OSQLParseNodesGarbageCollector(); if(!s_xLocaleData.is()) - s_xLocaleData = LocaleData::create(comphelper::getComponentContext(m_xServiceFactory)); + s_xLocaleData = LocaleData::create(m_xContext); // reset to 0 memset(OSQLParser::s_nRuleIDs,0,sizeof(OSQLParser::s_nRuleIDs[0]) * (OSQLParseNode::rule_count+1)); diff --git a/connectivity/source/simpledbt/dbtfactory.cxx b/connectivity/source/simpledbt/dbtfactory.cxx index 616a7fa6dded..29d000423ed0 100644 --- a/connectivity/source/simpledbt/dbtfactory.cxx +++ b/connectivity/source/simpledbt/dbtfactory.cxx @@ -94,9 +94,9 @@ namespace connectivity SAL_WNODEPRECATED_DECLARATIONS_POP //---------------------------------------------------------------- - ::rtl::Reference< simple::ISQLParser > ODataAccessToolsFactory::createSQLParser(const Reference< XMultiServiceFactory >& _rxServiceFactory,const IParseContext* _pContext) const + ::rtl::Reference< simple::ISQLParser > ODataAccessToolsFactory::createSQLParser(const Reference< XComponentContext >& rxContext, const IParseContext* _pContext) const { - return new OSimpleSQLParser(_rxServiceFactory,_pContext); + return new OSimpleSQLParser(rxContext, _pContext); } //........................................................................ diff --git a/connectivity/source/simpledbt/dbtfactory.hxx b/connectivity/source/simpledbt/dbtfactory.hxx index ba9d9c7e532f..40005ecbdd9f 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::lang::XMultiServiceFactory >& _rxServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext ) const; diff --git a/connectivity/source/simpledbt/parser_s.cxx b/connectivity/source/simpledbt/parser_s.cxx index 302099d53622..b49c4bfe9a49 100644 --- a/connectivity/source/simpledbt/parser_s.cxx +++ b/connectivity/source/simpledbt/parser_s.cxx @@ -35,8 +35,8 @@ namespace connectivity //= OSimpleSQLParser //================================================================ //---------------------------------------------------------------- - OSimpleSQLParser::OSimpleSQLParser(const Reference< XMultiServiceFactory >& _rxServiceFactory,const IParseContext* _pContext) - :m_aFullParser(_rxServiceFactory,_pContext) + OSimpleSQLParser::OSimpleSQLParser(const Reference< XComponentContext >& rxContext, const IParseContext* _pContext) + :m_aFullParser(rxContext, _pContext) { } diff --git a/connectivity/source/simpledbt/parser_s.hxx b/connectivity/source/simpledbt/parser_s.hxx index 6d2555e7b099..155ef739b233 100644 --- a/connectivity/source/simpledbt/parser_s.hxx +++ b/connectivity/source/simpledbt/parser_s.hxx @@ -40,7 +40,7 @@ namespace connectivity OSQLParser m_aFullParser; public: - OSimpleSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceFactory,const IParseContext* _pContext); + OSimpleSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext); // ISQLParser virtual ::rtl::Reference< simple::ISQLParseNode > predicateTree( -- cgit