summaryrefslogtreecommitdiff
path: root/cui/source/options
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-06 16:37:57 +0200
committerNoel Grandin <noel@peralex.com>2012-12-10 08:05:36 +0200
commit9fc4553b6433fbb6565a5b946c4256c0bfe345f1 (patch)
tree347cd116da96a13f9087685017f6ee4a5fc7aca7 /cui/source/options
parentd01fba6afc39092ae3ae85c38ac21bb7d26d63e2 (diff)
fdo#46808, Adapt sdbc::DriverManager UNO service to new style
Change-Id: Ic2be6bd08aaabc81d0fbe0269ca577868defe934
Diffstat (limited to 'cui/source/options')
-rw-r--r--cui/source/options/sdbcdriverenum.cxx31
1 files changed, 13 insertions, 18 deletions
diff --git a/cui/source/options/sdbcdriverenum.cxx b/cui/source/options/sdbcdriverenum.cxx
index 9033ebcb3ca4..e210df625df0 100644
--- a/cui/source/options/sdbcdriverenum.cxx
+++ b/cui/source/options/sdbcdriverenum.cxx
@@ -20,9 +20,9 @@
#include "sdbcdriverenum.hxx"
#include <comphelper/stl_types.hxx>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdbc/DriverManager.hpp>
//........................................................................
namespace offapp
@@ -32,6 +32,7 @@ namespace offapp
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::sdbc;
//====================================================================
//= ODriverEnumerationImpl
@@ -52,25 +53,19 @@ namespace offapp
{
try
{
- Reference< XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
- Reference< XInterface > xDM = xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager") ) );
- OSL_ENSURE(xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: no access to the SDBC driver manager!");
+ Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ Reference< XDriverManager2 > xEnumAccess = DriverManager::create( xContext );
- Reference< XEnumerationAccess > xEnumAccess(xDM, UNO_QUERY);
- OSL_ENSURE(xEnumAccess.is() || !xDM.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: can't enumerate SDBC drivers (missing the interface)!");
- if (xEnumAccess.is())
- {
- Reference< XEnumeration > xEnumDrivers = xEnumAccess->createEnumeration();
- OSL_ENSURE(xEnumDrivers.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: invalid enumeration object!");
+ Reference< XEnumeration > xEnumDrivers = xEnumAccess->createEnumeration();
+ OSL_ENSURE(xEnumDrivers.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: invalid enumeration object!");
- Reference< XServiceInfo > xDriverSI;
- while (xEnumDrivers->hasMoreElements())
- {
- xEnumDrivers->nextElement() >>= xDriverSI;
- OSL_ENSURE(xDriverSI.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: driver without service info!");
- if (xDriverSI.is())
- m_aImplNames.push_back(xDriverSI->getImplementationName());
- }
+ Reference< XServiceInfo > xDriverSI;
+ while (xEnumDrivers->hasMoreElements())
+ {
+ xEnumDrivers->nextElement() >>= xDriverSI;
+ OSL_ENSURE(xDriverSI.is(), "ODriverEnumerationImpl::ODriverEnumerationImpl: driver without service info!");
+ if (xDriverSI.is())
+ m_aImplNames.push_back(xDriverSI->getImplementationName());
}
}
catch(const Exception&)