Kaydet (Commit) 7298a2b0 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, Convert XMultiServiceFactory to XComponentContext

Change-Id: I3a74d4edaa3ff3c2498c3db2720b0e4e5305c2e4
üst 8c249489
...@@ -128,7 +128,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc() ...@@ -128,7 +128,7 @@ Reference< XSpreadsheetDocument> OCalcConnection::acquireDoc()
aArgs[nPos].Value <<= m_sPassword; aArgs[nPos].Value <<= m_sPassword;
} }
Reference< XDesktop2 > xDesktop = Desktop::create( comphelper::getComponentContext(getDriver()->getFactory()) ); Reference< XDesktop2 > xDesktop = Desktop::create( getDriver()->getComponentContext() );
Reference< XComponent > xComponent; Reference< XComponent > xComponent;
Any aLoaderException; Any aLoaderException;
try try
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "connectivity/dbexception.hxx" #include "connectivity/dbexception.hxx"
#include "resource/sharedresources.hxx" #include "resource/sharedresources.hxx"
#include "resource/calc_res.hrc" #include "resource/calc_res.hrc"
#include "comphelper/processfactory.hxx"
using namespace connectivity::calc; using namespace connectivity::calc;
using namespace connectivity::file; using namespace connectivity::file;
...@@ -54,7 +55,7 @@ OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) ...@@ -54,7 +55,7 @@ OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
connectivity::calc::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< connectivity::calc::ODriver_CreateInstance(const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
{ {
return *(new ODriver(_rxFactory)); return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
} }
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url,
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/DisposedException.hpp>
#include "connectivity/dbexception.hxx" #include "connectivity/dbexception.hxx"
#include "resource/dbase_res.hrc" #include "resource/dbase_res.hrc"
#include "comphelper/processfactory.hxx"
using namespace connectivity::dbase; using namespace connectivity::dbase;
using namespace connectivity::file; using namespace connectivity::file;
...@@ -48,7 +49,7 @@ OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) ...@@ -48,7 +49,7 @@ OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
//------------------------------------------------------------------ //------------------------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::dbase::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::dbase::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
{ {
return *(new ODriver(_rxFactory)); return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
} }
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
......
...@@ -202,7 +202,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( ...@@ -202,7 +202,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
Reference<XDynamicResultSet> xContent = m_pConnection->getDir(); Reference<XDynamicResultSet> xContent = m_pConnection->getDir();
Reference < XSortedDynamicResultSetFactory > xSRSFac = Reference < XSortedDynamicResultSetFactory > xSRSFac =
SortedDynamicResultSetFactory::create( comphelper::getComponentContext( m_pConnection->getDriver()->getFactory() ) ); SortedDynamicResultSetFactory::create( m_pConnection->getDriver()->getComponentContext() );
Sequence< NumberedSortingInfo > aSortInfo( 1 ); Sequence< NumberedSortingInfo > aSortInfo( 1 );
NumberedSortingInfo* pInfo = aSortInfo.getArray(); NumberedSortingInfo* pInfo = aSortInfo.getArray();
......
...@@ -36,9 +36,9 @@ using namespace com::sun::star::sdbc; ...@@ -36,9 +36,9 @@ using namespace com::sun::star::sdbc;
using namespace com::sun::star::sdbcx; using namespace com::sun::star::sdbcx;
using namespace com::sun::star::container; using namespace com::sun::star::container;
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
OFileDriver::OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) OFileDriver::OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext)
: ODriver_BASE(m_aMutex) : ODriver_BASE(m_aMutex)
,m_xFactory(_rxFactory) ,m_xContext(_rxContext)
{ {
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::OFileDriver" ); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "OFileDriver::OFileDriver" );
} }
......
...@@ -58,7 +58,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection ) ...@@ -58,7 +58,7 @@ OStatement_Base::OStatement_Base(OConnection* _pConnection )
:OStatement_BASE(m_aMutex) :OStatement_BASE(m_aMutex)
,::comphelper::OPropertyContainer(OStatement_BASE::rBHelper) ,::comphelper::OPropertyContainer(OStatement_BASE::rBHelper)
,m_xDBMetaData(_pConnection->getMetaData()) ,m_xDBMetaData(_pConnection->getMetaData())
,m_aParser( comphelper::getComponentContext(_pConnection->getDriver()->getFactory()) ) ,m_aParser( _pConnection->getDriver()->getComponentContext() )
,m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) ,m_aSQLIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL )
,m_pConnection(_pConnection) ,m_pConnection(_pConnection)
,m_pParseTree(NULL) ,m_pParseTree(NULL)
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <comphelper/sequence.hxx> #include <comphelper/sequence.hxx>
#include "resource/common_res.hrc" #include "resource/common_res.hrc"
#include "resource/sharedresources.hxx" #include "resource/sharedresources.hxx"
#include "comphelper/processfactory.hxx"
using namespace connectivity::flat; using namespace connectivity::flat;
...@@ -51,7 +52,7 @@ OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException) ...@@ -51,7 +52,7 @@ OUString SAL_CALL ODriver::getImplementationName( ) throw(RuntimeException)
//------------------------------------------------------------------ //------------------------------------------------------------------
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::flat::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL connectivity::flat::ODriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
{ {
return *(new ODriver(_rxFactory)); return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
} }
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
......
...@@ -124,7 +124,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) ...@@ -124,7 +124,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale)
m_aScales.assign(nFieldCount+1,-1); m_aScales.assign(nFieldCount+1,-1);
const sal_Bool bCase = m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(); const sal_Bool bCase = m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers();
CharClass aCharClass( comphelper::getComponentContext(pConnection->getDriver()->getFactory()), LanguageTag( _aLocale)); CharClass aCharClass( pConnection->getDriver()->getComponentContext(), LanguageTag( _aLocale));
// read description // read description
const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter();
const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter();
...@@ -435,10 +435,8 @@ void OFlatTable::construct() ...@@ -435,10 +435,8 @@ void OFlatTable::construct()
SvtSysLocale aLocale; SvtSysLocale aLocale;
::com::sun::star::lang::Locale aAppLocale(aLocale.GetLanguageTag().getLocale()); ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLanguageTag().getLocale());
Reference< XNumberFormatsSupplier > xSupplier = NumberFormatsSupplier::createWithLocale( getComponentContext(m_pConnection->getDriver()->getFactory()), aAppLocale ); Reference< XNumberFormatsSupplier > xSupplier = NumberFormatsSupplier::createWithLocale( m_pConnection->getDriver()->getComponentContext(), aAppLocale );
m_xNumberFormatter = Reference< XNumberFormatter >( NumberFormatter::create( m_xNumberFormatter.set( NumberFormatter::create( m_pConnection->getDriver()->getComponentContext()), UNO_QUERY_THROW);
comphelper::getComponentContext(m_pConnection->getDriver()->getFactory())),
UNO_QUERY_THROW);
m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier); m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY); Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY);
xProp->getPropertyValue(OUString("NullDate")) >>= m_aNullDate; xProp->getPropertyValue(OUString("NullDate")) >>= m_aNullDate;
......
...@@ -35,8 +35,8 @@ namespace connectivity ...@@ -35,8 +35,8 @@ namespace connectivity
{ {
public: public:
ODriver(const ::com::sun::star::uno::Reference< ODriver(const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : ::com::sun::star::uno::XComponentContext >& _rxContext) :
file::OFileDriver(_rxFactory){} file::OFileDriver(_rxContext) {}
static OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); static OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
......
...@@ -34,7 +34,7 @@ namespace connectivity ...@@ -34,7 +34,7 @@ namespace connectivity
class ODriver : public file::OFileDriver class ODriver : public file::OFileDriver
{ {
public: public:
ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : file::OFileDriver(_rxFactory){} ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){}
// XInterface // XInterface
static OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); static OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
......
...@@ -43,9 +43,9 @@ namespace connectivity ...@@ -43,9 +43,9 @@ namespace connectivity
connectivity::OWeakRefArray m_xConnections; // vector containing a list connectivity::OWeakRefArray m_xConnections; // vector containing a list
// of all the Connection objects // of all the Connection objects
// for this Driver // for this Driver
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
public: public:
OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory); OFileDriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
// OComponentHelper // OComponentHelper
virtual void SAL_CALL disposing(void); virtual void SAL_CALL disposing(void);
...@@ -69,7 +69,7 @@ namespace connectivity ...@@ -69,7 +69,7 @@ namespace connectivity
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& connection ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL( const OUString& url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getFactory() const { return m_xFactory; } ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getComponentContext() const { return m_xContext; }
}; };
} }
......
...@@ -34,7 +34,7 @@ namespace connectivity ...@@ -34,7 +34,7 @@ namespace connectivity
class ODriver : public file::OFileDriver class ODriver : public file::OFileDriver
{ {
public: public:
ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) : file::OFileDriver(_rxFactory){} ODriver(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) : file::OFileDriver(_rxContext){}
// XInterface // XInterface
static OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); static OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment