From b9a4a0b9658015a0d55c42de1f5e56941e20d268 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 3 Dec 2012 13:55:06 +0200 Subject: fdo#46808, Convert connectivity::SQLError to use XComponentContext... ...instead of comphelper::ComponentContext. Change-Id: I40384c2d7cfcabd06506321d686dd8e7c7c5f266 --- connectivity/inc/connectivity/sqlerror.hxx | 5 ++--- connectivity/inc/connectivity/sqlparse.hxx | 4 ++-- connectivity/source/commontools/sqlerror.cxx | 15 ++++++++------- connectivity/source/drivers/evoab2/NResultSet.cxx | 2 +- connectivity/source/drivers/mork/MConnection.cxx | 3 ++- connectivity/source/drivers/mozab/MConnection.cxx | 3 ++- connectivity/source/parse/sqlnode.cxx | 4 ++-- dbaccess/source/core/api/RowSetBase.cxx | 2 +- dbaccess/source/core/dataaccess/ContentHelper.cxx | 2 +- dbaccess/source/core/dataaccess/documentcontainer.cxx | 7 ++++--- dbaccess/source/sdbtools/connection/objectnames.cxx | 6 +++--- dbaccess/source/ui/app/AppControllerGen.cxx | 2 +- dbaccess/source/ui/browser/brwctrlr.cxx | 2 +- 13 files changed, 30 insertions(+), 27 deletions(-) diff --git a/connectivity/inc/connectivity/sqlerror.hxx b/connectivity/inc/connectivity/sqlerror.hxx index 9cfaffc62e1e..fae9b2a05870 100644 --- a/connectivity/inc/connectivity/sqlerror.hxx +++ b/connectivity/inc/connectivity/sqlerror.hxx @@ -21,8 +21,7 @@ #define CONNECTIVITY_SQLERROR_HXX #include - -#include +#include #include #include @@ -82,7 +81,7 @@ namespace connectivity public: - explicit SQLError( const ::comphelper::ComponentContext& _rContext ); + explicit SQLError( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _rxContext ); ~SQLError(); /** returns the message associated with a given error condition, after (optionally) replacing diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx index e67aa7d034ce..45357d280fbf 100644 --- a/connectivity/inc/connectivity/sqlparse.hxx +++ b/connectivity/inc/connectivity/sqlparse.hxx @@ -124,8 +124,8 @@ namespace connectivity ::com::sun::star::lang::Locale aLocale; ::connectivity::SQLError aErrors; - OSQLParser_Data( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory ) - :aErrors( _xServiceFactory ) + OSQLParser_Data( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ) + :aErrors( _rxContext ) { } }; diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx index 90cbd97c9bf2..7a10ad2318d7 100644 --- a/connectivity/source/commontools/sqlerror.cxx +++ b/connectivity/source/commontools/sqlerror.cxx @@ -42,6 +42,7 @@ namespace connectivity using ::com::sun::star::uno::Any; using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::sdbc::SQLException; using ::com::sun::star::uno::Type; /** === end UNO using === **/ @@ -58,7 +59,7 @@ namespace connectivity class SQLError_Impl { public: - SQLError_Impl( const ::comphelper::ComponentContext& _rContext ); + SQLError_Impl( const Reference & _rxContext ); ~SQLError_Impl(); // versions of the public SQLError methods which are just delegated to this impl-class @@ -90,7 +91,7 @@ namespace connectivity private: ::osl::Mutex m_aMutex; - ::comphelper::ComponentContext m_aContext; + Reference m_aContext; ::std::auto_ptr< ::comphelper::OfficeResourceBundle > m_pResources; bool m_bAttemptedInit; }; @@ -99,8 +100,8 @@ namespace connectivity //= SQLError_Impl - implementation //==================================================================== //-------------------------------------------------------------------- - SQLError_Impl::SQLError_Impl( const ::comphelper::ComponentContext& _rContext ) - :m_aContext( _rContext ) + SQLError_Impl::SQLError_Impl( const Reference & _rxContext ) + :m_aContext( _rxContext ) ,m_pResources( ) ,m_bAttemptedInit( false ) { @@ -278,7 +279,7 @@ namespace connectivity ::osl::MutexGuard aGuard( m_aMutex ); m_bAttemptedInit = true; - m_pResources.reset( new ::comphelper::OfficeResourceBundle( m_aContext.getUNOContext(), "sdberr" ) ); + m_pResources.reset( new ::comphelper::OfficeResourceBundle( m_aContext, "sdberr" ) ); return m_pResources.get() != NULL; } @@ -286,8 +287,8 @@ namespace connectivity //= SQLError //==================================================================== //-------------------------------------------------------------------- - SQLError::SQLError( const ::comphelper::ComponentContext& _rContext ) - :m_pImpl( new SQLError_Impl( _rContext ) ) + SQLError::SQLError( const Reference & _rxContext ) + :m_pImpl( new SQLError_Impl( _rxContext ) ) { } diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index b5f46408afa9..9b220dcd7090 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -519,7 +519,7 @@ void OEvoabResultSet::construct( const QueryData& _rData ) case eFilterNone: if ( !isLocal( pBook ) ) { - SQLError aErrorFactory( m_pConnection->getDriver().getMSFactory() ); + SQLError aErrorFactory( comphelper::getComponentContext(m_pConnection->getDriver().getMSFactory()) ); SQLException aAsException = aErrorFactory.getSQLException( ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED, *this ); m_aWarnings.appendWarning( SQLWarning( aAsException.Message, diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx index 47525d2f946b..9c9c8edfbfd3 100644 --- a/connectivity/source/drivers/mork/MConnection.cxx +++ b/connectivity/source/drivers/mork/MConnection.cxx @@ -28,6 +28,7 @@ #include #include +#include using namespace dbtools; @@ -382,7 +383,7 @@ void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Refer if ( _rError.getErrorCondition() != 0 ) { - SQLError aErrorHelper( getDriver()->getFactory() ); + SQLError aErrorHelper( comphelper::getComponentContext(getDriver()->getFactory()) ); ::rtl::OUString sParameter( _rError.getParameter() ); if ( !sParameter.isEmpty() ) aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter ); diff --git a/connectivity/source/drivers/mozab/MConnection.cxx b/connectivity/source/drivers/mozab/MConnection.cxx index 5ccf57b9ecf8..af6d57b8eb7b 100644 --- a/connectivity/source/drivers/mozab/MConnection.cxx +++ b/connectivity/source/drivers/mozab/MConnection.cxx @@ -38,6 +38,7 @@ #include #include +#include #if OSL_DEBUG_LEVEL > 0 # define OUtoCStr( x ) ( ::rtl::OUStringToOString ( (x), RTL_TEXTENCODING_ASCII_US).getStr()) @@ -571,7 +572,7 @@ void OConnection::throwSQLException( const ErrorDescriptor& _rError, const Refer if ( _rError.getErrorCondition() != 0 ) { - SQLError aErrorHelper( getDriver()->getMSFactory() ); + SQLError aErrorHelper( comphelper::getComponentContext(getDriver()->getMSFactory()) ); ::rtl::OUString sParameter( _rError.getParameter() ); if ( !sParameter.isEmpty() ) aErrorHelper.raiseException( _rError.getErrorCondition(), _rxContext, sParameter ); diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 73fd5101c7cb..ae9f3f1fe72a 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -571,7 +571,7 @@ bool OSQLParseNode::impl_parseTableNameNodeToString_throw( ::rtl::OUStringBuffer } else { - SQLError aErrors( ::comphelper::getProcessServiceFactory() ); + SQLError aErrors( ::comphelper::getProcessComponentContext() ); aErrors.raiseException( sdb::ErrorCondition::PARSER_CYCLIC_SUB_QUERIES ); } } @@ -1263,7 +1263,7 @@ OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const : 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( uno::Reference(rxContext->getServiceManager(), uno::UNO_QUERY_THROW) ) ) + ,m_pData( new OSQLParser_Data( rxContext ) ) ,m_nFormatKey(0) ,m_nDateFormatKey(0) ,m_xContext(rxContext) diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx index 8b4087d97b30..e9a12dad5ff7 100644 --- a/dbaccess/source/core/api/RowSetBase.cxx +++ b/dbaccess/source/core/api/RowSetBase.cxx @@ -91,7 +91,7 @@ ORowSetBase::ORowSetBase( const ::comphelper::ComponentContext& _rContext, ::cpp ,m_rBHelper(_rBHelper) ,m_pEmptyCollection( NULL ) ,m_aContext( _rContext ) - ,m_aErrors( _rContext ) + ,m_aErrors( _rContext.getUNOContext() ) ,m_nLastColumnIndex(-1) ,m_nDeletedPosition(-1) ,m_nResultSetType( ResultSetType::FORWARD_ONLY ) diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 204cee0c1bdf..20a535f83cf4 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -69,7 +69,7 @@ OContentHelper::OContentHelper(const Reference< XMultiServiceFactory >& _xORB ,m_aPropertyChangeListeners(m_aMutex) ,m_xParentContainer(_xParentContainer) ,m_aContext( _xORB ) - ,m_aErrorHelper( m_aContext ) + ,m_aErrorHelper( m_aContext.getUNOContext() ) ,m_pImpl(_pImpl) ,m_nCommandId(0) { diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 54cda9269439..311263d71965 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -34,6 +34,7 @@ #include "datasource.hxx" #include #include +#include #include #include "core_resource.hxx" #include "core_resource.hrc" @@ -66,8 +67,8 @@ class LocalNameApproval : public IContainerApprove ::connectivity::SQLError m_aErrors; public: - LocalNameApproval( const Reference< XMultiServiceFactory >& _rxFactory ) - :m_aErrors( ::comphelper::ComponentContext( _rxFactory ) ) + LocalNameApproval( const Reference< XComponentContext >& _rxContext ) + :m_aErrors( _rxContext ) { } virtual ~LocalNameApproval() @@ -105,7 +106,7 @@ ODocumentContainer::ODocumentContainer(const Reference< XMultiServiceFactory >& registerProperty(PROPERTY_NAME, PROPERTY_ID_NAME, PropertyAttribute::BOUND | PropertyAttribute::READONLY | PropertyAttribute::CONSTRAINED, &m_pImpl->m_aProps.aTitle, ::getCppuType(&m_pImpl->m_aProps.aTitle)); - setElementApproval( PContainerApprove( new LocalNameApproval ( _xORB ) ) ); + setElementApproval( PContainerApprove( new LocalNameApproval ( comphelper::getComponentContext(_xORB) ) ) ); } ODocumentContainer::~ODocumentContainer() diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx index a4c1e5e77df9..edad066c1c1a 100644 --- a/dbaccess/source/sdbtools/connection/objectnames.cxx +++ b/dbaccess/source/sdbtools/connection/objectnames.cxx @@ -108,7 +108,7 @@ namespace sdbtools if ( validateName( _rName ) ) return; - ::connectivity::SQLError aErrors( m_aContext ); + ::connectivity::SQLError aErrors( m_aContext.getUNOContext() ); SQLException aError( aErrors.getSQLException( ErrorCondition::DB_OBJECT_NAME_IS_USED, m_xConnection, _rName ) ); ::dbtools::DatabaseMetaData aMeta( m_xConnection ); @@ -162,7 +162,7 @@ namespace sdbtools if ( validateName( _rName ) ) return; - ::connectivity::SQLError aErrors( m_aContext ); + ::connectivity::SQLError aErrors( m_aContext.getUNOContext() ); aErrors.raiseException( ErrorCondition::DB_INVALID_SQL_NAME, m_xConnection, _rName ); } }; @@ -211,7 +211,7 @@ namespace sdbtools ::connectivity::ErrorCondition nErrorCondition = validateName_getErrorCondition( _rName ); if ( nErrorCondition != 0 ) { - ::connectivity::SQLError aErrors( m_aContext ); + ::connectivity::SQLError aErrors( m_aContext.getUNOContext() ); aErrors.raiseException( nErrorCondition, m_xConnection ); } } diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx index cb846688e707..659ff0f9438b 100644 --- a/dbaccess/source/ui/app/AppControllerGen.cxx +++ b/dbaccess/source/ui/app/AppControllerGen.cxx @@ -449,7 +449,7 @@ void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int // ensure we're connected if ( !isConnected() ) { - SQLError aError( getORB() ); + SQLError aError( comphelper::getComponentContext(getORB()) ); aError.raiseException( ErrorCondition::DB_NOT_CONNECTED, *this ); } diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index ccd75ae01d0d..fc7237eb1f24 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -697,7 +697,7 @@ void SbaXDataBrowserController::onStartLoading( const Reference< XLoadable >& _r // ----------------------------------------------------------------------------- void SbaXDataBrowserController::impl_checkForCannotSelectUnfiltered( const SQLExceptionInfo& _rError ) { - ::connectivity::SQLError aError( getORB() ); + ::connectivity::SQLError aError( comphelper::getComponentContext(getORB()) ); ::connectivity::ErrorCode nErrorCode( aError.getErrorCode( ErrorCondition::DATA_CANNOT_SELECT_UNFILTERED ) ); if ( ((const SQLException*)_rError)->ErrorCode == nErrorCode ) { -- cgit v1.2.3