From 9c00e38b431b57c3760f6c0aa774424b3239eeda Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 18 Sep 2012 09:46:34 +0200 Subject: fdo#46808, Adapt sdb::DatabaseContext UNO service to new style Create a merged XDatabaseContext interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Quite a few IDL files had to be marked as published for this to work. Change-Id: Ie9a0da88d8c33cc83fc9d2334ff83ab2744c222f --- sc/source/ui/dbgui/dapidata.cxx | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 1f482031f9a0..862698318895 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -53,7 +54,6 @@ using namespace com::sun::star; //------------------------------------------------------------------------- -#define DP_SERVICE_DBCONTEXT "com.sun.star.sdb.DatabaseContext" #define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" // entries in the "type" ListBox @@ -86,20 +86,15 @@ ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg( Window* pParent ) : { // get database names - uno::Reference xContext( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( DP_SERVICE_DBCONTEXT )) ), - uno::UNO_QUERY); - if (xContext.is()) + uno::Reference xContext = sdb::DatabaseContext::create( + comphelper::getProcessComponentContext() ); + uno::Sequence aNames = xContext->getElementNames(); + long nCount = aNames.getLength(); + const rtl::OUString* pArray = aNames.getConstArray(); + for (long nPos = 0; nPos < nCount; nPos++) { - uno::Sequence aNames = xContext->getElementNames(); - long nCount = aNames.getLength(); - const rtl::OUString* pArray = aNames.getConstArray(); - for (long nPos = 0; nPos < nCount; nPos++) - { - String aName = pArray[nPos]; - aLbDatabase.InsertEntry( aName ); - } + String aName = pArray[nPos]; + aLbDatabase.InsertEntry( aName ); } } catch(uno::Exception&) @@ -161,11 +156,8 @@ void ScDataPilotDatabaseDlg::FillObjects() { // open connection (for tables or queries) - uno::Reference xContext( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( DP_SERVICE_DBCONTEXT )) ), - uno::UNO_QUERY); - if ( !xContext.is() ) return; + uno::Reference xContext = sdb::DatabaseContext::create( + comphelper::getProcessComponentContext() ); uno::Any aSourceAny = xContext->getByName( aDatabaseName ); uno::Reference xSource( -- cgit v1.2.3