diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-03 13:10:01 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-10 08:05:27 +0200 |
commit | b8a403467e6209437c3c113ff2df95df6ffec61a (patch) | |
tree | 20ffdd57a734bca6b35be41658ed7c9127ec1677 /dbaccess | |
parent | do not return reference to a local object (diff) | |
download | core-b8a403467e6209437c3c113ff2df95df6ffec61a.tar.gz core-b8a403467e6209437c3c113ff2df95df6ffec61a.zip |
fdo#46808, Create new-style sdb::ReportDesign service
The service already existed, it just did not have an IDL file.
Change-Id: I681754040e1de8d96fe5bdc1b442bfc4de76c7c7
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/browser/dbloader.cxx | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 60b4b0a13479..1f4a3be7b3e2 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> +#include <com/sun/star/sdb/ReportDesign.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/frame/XModule.hpp> @@ -53,11 +54,11 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; -using ::com::sun::star::sdbc::XDataSource; using namespace dbaui; class DBContentLoader : public ::cppu::WeakImplHelper2< XFrameLoader, XServiceInfo> @@ -67,9 +68,9 @@ private: Sequence< PropertyValue> m_aArgs; Reference< XLoadEventListener > m_xListener; Reference< XFrame > m_xFrame; - Reference< XMultiServiceFactory > m_xServiceFactory; + Reference< XComponentContext > m_xContext; public: - DBContentLoader(const Reference< XMultiServiceFactory >&); + DBContentLoader(const Reference< XComponentContext >&); ~DBContentLoader(); // XServiceInfo @@ -94,8 +95,8 @@ public: }; DBG_NAME(DBContentLoader) -DBContentLoader::DBContentLoader(const Reference< XMultiServiceFactory >& _rxFactory) - :m_xServiceFactory(_rxFactory) +DBContentLoader::DBContentLoader(const Reference< XComponentContext >& _rxContext) + :m_xContext(_rxContext) { DBG_CTOR(DBContentLoader,NULL); @@ -116,7 +117,7 @@ extern "C" void SAL_CALL createRegistryInfo_DBContentLoader() // ------------------------------------------------------------------------- Reference< XInterface > SAL_CALL DBContentLoader::Create( const Reference< XMultiServiceFactory > & rSMgr ) { - return *(new DBContentLoader(rSMgr)); + return *(new DBContentLoader(comphelper::getComponentContext(rSMgr))); } // ------------------------------------------------------------------------- // XServiceInfo @@ -181,8 +182,6 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: m_aURL = rURL; m_aArgs = rArgs; - ::comphelper::ComponentContext aContext( m_xServiceFactory ); - struct ServiceNameToImplName { const sal_Char* pAsciiServiceName; @@ -209,7 +208,8 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: { if ( sComponentURL.equalsAscii( aImplementations[i].pAsciiServiceName ) ) { - aContext.createComponent( aImplementations[i].pAsciiImplementationName, xController ); + xController.set( m_xContext->getServiceManager()-> + createInstanceWithContext( ::rtl::OUString::createFromAscii( aImplementations[i].pAsciiImplementationName ), m_xContext), UNO_QUERY_THROW ); break; } } @@ -250,14 +250,10 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: Reference< XModel > xReportModel( aLoadArgs.getOrDefault( "Model", Reference< XModel >() ) ); if ( xReportModel.is() ) { - xController.set( m_xServiceFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.ReportDesign" ) ) ), UNO_QUERY ); - if ( xController.is() ) - { - xController->attachModel( xReportModel ); - xReportModel->connectController( xController.get() ); - xReportModel->setCurrentController( xController.get() ); - } + xController.set( ReportDesign::create( m_xContext ) ); + xController->attachModel( xReportModel ); + xReportModel->connectController( xController.get() ); + xReportModel->setCurrentController( xController.get() ); } } @@ -275,7 +271,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: else if ( !sDataSourceName.isEmpty() ) { ::dbtools::SQLExceptionInfo aError; - xDataSource.set( getDataSourceByName( sDataSourceName, NULL, comphelper::getComponentContext(m_xServiceFactory), &aError ) ); + xDataSource.set( getDataSourceByName( sDataSourceName, NULL, m_xContext, &aError ) ); xDatabaseDocument.set( getDataSourceOrModel( xDataSource ), UNO_QUERY ); } else if ( xConnection.is() ) |