[Libreoffice-commits] .: 2 commits - connectivity/inc connectivity/source cui/source dbaccess/inc dbaccess/source extensions/source offapi/com offapi/type_reference offapi/UnoApi_offapi.mk sc/source svtools/inc svtools/source svx/inc svx/source sw/inc sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 27 06:04:04 PDT 2012


 connectivity/inc/connectivity/dbtools.hxx                  |    6 
 connectivity/inc/connectivity/virtualdbtools.hxx           |    5 
 connectivity/source/commontools/dbtools.cxx                |   15 +-
 connectivity/source/simpledbt/staticdbtools_s.cxx          |    4 
 connectivity/source/simpledbt/staticdbtools_s.hxx          |    2 
 cui/source/options/dbregisterednamesconfig.cxx             |   14 +-
 dbaccess/inc/genericcontroller.hxx                         |    4 
 dbaccess/source/core/api/RowSet.cxx                        |    5 
 dbaccess/source/core/dataaccess/databasecontext.hxx        |   12 -
 dbaccess/source/core/dataaccess/databasedocument.cxx       |    4 
 dbaccess/source/core/dataaccess/datasource.cxx             |    4 
 dbaccess/source/filter/xml/dbloader2.cxx                   |    6 
 dbaccess/source/ui/browser/genericcontroller.cxx           |    3 
 dbaccess/source/ui/browser/unodatbr.cxx                    |    2 
 dbaccess/source/ui/dlg/DbAdminImpl.cxx                     |    7 -
 dbaccess/source/ui/dlg/DbAdminImpl.hxx                     |   10 -
 dbaccess/source/ui/dlg/dbwizsetup.cxx                      |    6 
 dbaccess/source/ui/inc/UITools.hxx                         |    5 
 dbaccess/source/ui/misc/TokenWriter.cxx                    |    3 
 dbaccess/source/ui/misc/UITools.cxx                        |   33 ++---
 dbaccess/source/ui/misc/WCopyTable.cxx                     |    3 
 dbaccess/source/ui/querydesign/querycontroller.cxx         |    3 
 dbaccess/source/ui/relationdesign/RelationController.cxx   |    3 
 dbaccess/source/ui/tabledesign/TableController.cxx         |    3 
 dbaccess/source/ui/uno/copytablewizard.cxx                 |    5 
 extensions/source/abpilot/datasourcehandling.cxx           |   26 ++--
 extensions/source/bibliography/bibconfig.cxx               |   16 --
 extensions/source/bibliography/datman.cxx                  |    7 -
 extensions/source/dbpilots/commonpagesdbp.hxx              |    4 
 extensions/source/dbpilots/controlwizard.cxx               |   11 -
 extensions/source/dbpilots/wizardcontext.hxx               |    3 
 offapi/UnoApi_offapi.mk                                    |    3 
 offapi/com/sun/star/sdb/DatabaseContext.idl                |   56 ---------
 offapi/com/sun/star/sdb/DatabaseRegistrationEvent.idl      |    2 
 offapi/com/sun/star/sdb/XDatabaseContext.idl               |   80 +++++++++++++
 offapi/com/sun/star/sdb/XDatabaseRegistrations.idl         |    4 
 offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl |    2 
 offapi/type_reference/types.rdb                            |binary
 sc/source/ui/dbgui/dapidata.cxx                            |   30 +---
 svtools/inc/svtools/addresstemplate.hxx                    |    3 
 svtools/source/dialogs/addresstemplate.cxx                 |    5 
 svx/inc/svx/dbtoolsclient.hxx                              |    2 
 svx/source/form/dbtoolsclient.cxx                          |    4 
 svx/source/form/fmvwimp.cxx                                |    2 
 svx/source/form/formcontrolfactory.cxx                     |    2 
 sw/inc/swdbtoolsclient.hxx                                 |    2 
 sw/source/core/edit/edfldexp.cxx                           |   10 -
 sw/source/ui/dbui/addresslistdialog.cxx                    |   79 ++++++------
 sw/source/ui/dbui/addresslistdialog.hxx                    |    7 -
 sw/source/ui/dbui/dbmgr.cxx                                |   31 +----
 sw/source/ui/dbui/dbtree.cxx                               |   21 +--
 sw/source/ui/dbui/swdbtoolsclient.cxx                      |    4 
 sw/source/ui/fldui/changedb.cxx                            |   14 --
 sw/source/ui/uiview/view2.cxx                              |   16 --
 54 files changed, 302 insertions(+), 311 deletions(-)

New commits:
commit a00c4e02acd1b7a3ab126941166aa2d12c7eb3fc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Sep 27 13:43:06 2012 +0200

    Improvements on previous commit
    
    * Made XDatabaseContext inherit XDatabaseRegistrations non-optionally, adapted
      call-sites to just use XDatabaseContext w/o querying.  (The previous commit
      had inadvertantly effectively removed support for XDatabaseRegistrations from
      the ODatabaseContext implementation, as an optional UNO super-interface does
      not lead to a super-class in the corresponding C++ class hierarchy, but making
      the super-interface non-optional fixes that anyway.)
    
    * Adapted some more call-sites to just use XDatabaseContext w/o querying.
    
    * Added @since tag.
    
    * Replaced new uses of comphelper::ComponentContext::getUNOContext with
      comphelper::getComponentContext (see 03a9f139bd9ea1a4f9096fc982e6b326def58532
      "ComponentContext::getUnoContext -> getComponentContext simplification;" I
      intend to get rid of comphelper/componentcontext.hxx much sooner than of
      comphelper/processfactory.hxx).
    
    Change-Id: I68d09f2dbe651629f79ed21cd40cdb6d6b32c624

diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index 24f29a1..4674fe4 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -63,9 +63,9 @@
 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
 #include <com/sun/star/util/XNumberFormatTypes.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/interaction.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/property.hxx>
 #include <connectivity/conncleanup.hxx>
 #include <connectivity/dbconversion.hxx>
@@ -281,7 +281,7 @@ Reference< XConnection > getConnection_allowException(
             const ::rtl::OUString& _rsPwd,
             const Reference< XMultiServiceFactory>& _rxFactory)
 {
-    Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, comphelper::ComponentContext(_rxFactory).getUNOContext()) );
+    Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, comphelper::getComponentContext(_rxFactory)) );
     Reference<XConnection> xConnection;
     if (xDataSource.is())
     {
diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
index c2829b1..ce06d0c 100644
--- a/cui/source/options/dbregisterednamesconfig.cxx
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -32,7 +32,6 @@
 #include "svx/svxids.hrc"
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/sdb/DatabaseContext.hpp>
-#include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/processfactory.hxx>
@@ -63,8 +62,8 @@ namespace svx
         try
         {
             Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
-            Reference< XDatabaseRegistrations > xRegistrations(
-                DatabaseContext::create(xContext), UNO_QUERY_THROW );
+            Reference< XDatabaseContext > xRegistrations(
+                DatabaseContext::create(xContext) );
 
             Sequence< ::rtl::OUString > aRegistrationNames( xRegistrations->getRegistrationNames() );
             const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray();
@@ -94,9 +93,9 @@ namespace svx
 
         try
         {
-            ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
-            Reference< XDatabaseRegistrations > xRegistrations(
-                aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
+            Reference< XDatabaseContext > xRegistrations(
+                DatabaseContext::create(
+                    comphelper::getProcessComponentContext()));
 
             const DatabaseRegistrations& rNewRegistrations = pRegistrations->getRegistrations();
             for (   DatabaseRegistrations::const_iterator reg = rNewRegistrations.begin();
diff --git a/dbaccess/inc/genericcontroller.hxx b/dbaccess/inc/genericcontroller.hxx
index 86fcd0d..2316566 100644
--- a/dbaccess/inc/genericcontroller.hxx
+++ b/dbaccess/inc/genericcontroller.hxx
@@ -25,7 +25,6 @@
 #include "dbaccessdllapi.h"
 #include "IController.hxx"
 
-#include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/frame/CommandGroup.hpp>
 #include <com/sun/star/frame/XController2.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
@@ -37,6 +36,7 @@
 #include <com/sun/star/frame/XLayoutManager.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
@@ -242,7 +242,7 @@ namespace dbaui
         ControllerFrame                                                                     m_aCurrentFrame;
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >      m_xSlaveDispatcher;     // for intercepting dispatches
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >      m_xMasterDispatcher;    // dito
-        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >        m_xDatabaseContext;
+        ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >         m_xDatabaseContext;
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle >                 m_xTitleHelper;
 
         sal_Bool                m_bPreview;
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index c4ac4ef..136992e 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -2155,7 +2155,7 @@ Reference< XConnection >  ORowSet::calcConnection(const Reference< XInteractionH
         Reference< XConnection > xNewConn;
         if ( !m_aDataSourceName.isEmpty() )
         {
-            Reference< XNameAccess > xDatabaseContext( DatabaseContext::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
+            Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(m_aContext.getUNOContext()) );
             try
             {
                 Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_aDataSourceName ), UNO_QUERY_THROW );
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index a0480df..3139e20 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -601,7 +601,7 @@ Sequence< ::rtl::OUString > ODatabaseSource::getSupportedServiceNames(  ) throw
 Reference< XInterface > ODatabaseSource::Create( const Reference< XComponentContext >& _rxContext )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen at sun.com", "ODatabaseSource::Create" );
-    Reference< XSingleServiceFactory > xDBContext( DatabaseContext::create(_rxContext), UNO_QUERY_THROW );
+    Reference< XDatabaseContext > xDBContext( DatabaseContext::create(_rxContext) );
     return xDBContext->createInstance();
 }
 
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index 6441d8d..8b2d393 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -38,7 +38,6 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #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/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
@@ -446,7 +445,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::
     sal_Int32 nInitialSelection = -1;
     if ( !xModel.is() )
     {
-        Reference< XSingleServiceFactory > xDatabaseContext( DatabaseContext::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
+        Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(m_aContext.getUNOContext()) );
 
         ::rtl::OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE);
         bCreateNew = sFactoryName.match(_rURL);
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index ed7fadf..3131ad1 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -256,7 +256,7 @@ sal_Bool OGenericUnoController::Construct(Window* /*pParent*/)
     OSL_ENSURE(getORB().is(), "OGenericUnoController::Construct need a service factory!");
     try
     {
-        m_xDatabaseContext = Reference< XNameAccess >( DatabaseContext::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW );
+        m_xDatabaseContext = DatabaseContext::create(comphelper::getComponentContext(getORB()));
     }
     catch(Exception&)
     {
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 0be575a..6000c5a 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3126,7 +3126,7 @@ void SbaTableQueryBrowser::unloadAndCleanup( sal_Bool _bDisposeConnection )
 // -------------------------------------------------------------------------
 namespace
 {
-    Reference< XInterface > lcl_getDataSource( const Reference< XNameAccess >& _rxDatabaseContext,
+    Reference< XInterface > lcl_getDataSource( const Reference< XDatabaseContext >& _rxDatabaseContext,
         const ::rtl::OUString& _rDataSourceName, const Reference< XConnection >& _rxConnection )
     {
         Reference< XDataSource > xDataSource;
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index da713f3..2150c6b 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -50,9 +50,9 @@
 #include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
 #include <com/sun/star/ucb/AuthenticationRequest.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/guarding.hxx>
 #include <comphelper/interaction.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/sequence.hxx>
 #include <comphelper/string.hxx>
@@ -208,8 +208,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
 
     try
     {
-        m_xDatabaseContext = Reference< XNameAccess >( DatabaseContext::create(comphelper::ComponentContext(m_xORB).getUNOContext()), UNO_QUERY_THROW );
-        m_xDynamicContext.set(m_xDatabaseContext,UNO_QUERY);
+        m_xDatabaseContext = DatabaseContext::create(comphelper::getComponentContext(m_xORB));
     }
     catch(Exception&)
     {
@@ -219,8 +218,6 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
     {
         ShowServiceNotAvailableError(_pParent->GetParent(), String(SERVICE_SDB_DATABASECONTEXT), sal_True);
     }
-
-    OSL_ENSURE(m_xDynamicContext.is(), "ODbAdminDialog::ODbAdminDialog : no XNamingService interface !");
 }
     //-------------------------------------------------------------------------
 sal_Bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< PropertyValue >& _rDriverParam)
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
index bdba410..305aa8a 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx
@@ -21,10 +21,9 @@
 #define _DBAUI_DBADMINIMPL_HXX_
 
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdbc/XDriver.hpp>
 #include <comphelper/stl_types.hxx>
@@ -60,10 +59,8 @@ namespace dbaui
     private:
         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
                             m_xORB;                 /// service factory
-        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+        ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
                                 m_xDatabaseContext;     /// database context we're working in
-        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XNamingService >
-                                m_xDynamicContext;      /// just another interface of the context ...
         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   m_xDatasource;
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >         m_xModel;
 
@@ -97,8 +94,7 @@ namespace dbaui
 
         inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xORB; }
 
-        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getDatabaseContext() const { return m_xDatabaseContext; }
-        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XNamingService > getDynamicContext() const { return m_xDynamicContext; }
+        ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext > getDatabaseContext() const { return m_xDatabaseContext; }
 
         /** creates a new connection. The caller is responsible to dispose it !!!!
         */
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 664879d..9f05b4e 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -50,7 +50,6 @@
 #include <cppuhelper/exc_hlp.hxx>
 
 #include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
@@ -859,7 +858,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
     void ODbTypeWizDialogSetup::RegisterDataSourceByLocation(const ::rtl::OUString& _sPath)
     {
         Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
-        Reference< XNamingService > xDatabaseContext( DatabaseContext::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW );
+        Reference< XDatabaseContext > xDatabaseContext( DatabaseContext::create(comphelper::getComponentContext(getORB())) );
         Reference< XNameAccess > xNameAccessDatabaseContext(xDatabaseContext, UNO_QUERY_THROW );
         INetURLObject aURL( _sPath );
         ::rtl::OUString sFilename = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 9c30b73..16615e4 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -277,7 +277,7 @@ void ODatabaseImportExport::initialize()
     if ( !m_xConnection.is() )
     {   // we need a connection
         OSL_ENSURE(!m_sDataSourceName.isEmpty(),"There must be a datsource name!");
-        Reference<XNameAccess> xDatabaseContext( DatabaseContext::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), UNO_QUERY_THROW);
+        Reference<XNameAccess> xDatabaseContext( DatabaseContext::create(comphelper::getComponentContext(m_xFactory)), UNO_QUERY_THROW);
         Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY);
 
         Reference< XConnection > xConnection;
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index e7e0ae9..025e7d1 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -46,8 +46,8 @@
 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/types.hxx>
 #include <comphelper/interaction.hxx>
 #include <connectivity/dbtools.hxx>
@@ -1338,7 +1338,7 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
         {
             xSuppDestinationColumns.set( xTable, UNO_QUERY_THROW );
             // insert new table name into table filter
-            ::dbaui::appendToFilter( m_xDestConnection, m_sName, comphelper::ComponentContext(GetFactory()).getUNOContext(), this );
+            ::dbaui::appendToFilter( m_xDestConnection, m_sName, comphelper::getComponentContext(GetFactory()), this );
 
             // copy ui settings
             m_rSourceObject.copyUISettingsTo( xTable );
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 6d46ff6..9bdd3a7 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -66,6 +66,7 @@
 
 #include <comphelper/basicio.hxx>
 #include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/property.hxx>
 #include <comphelper/seqstream.hxx>
 #include <comphelper/streamsection.hxx>
@@ -1534,7 +1535,7 @@ bool OQueryController::doSaveAsDoc(sal_Bool _bSaveAs)
                     m_xAlterView.set( xElements->getByName( m_sName ), UNO_QUERY );
 
                 // now check if our datasource has set a tablefilter and if so, append the new table name to it
-                ::dbaui::appendToFilter( getConnection(), m_sName, comphelper::ComponentContext(getORB()).getUNOContext(), getView() );
+                ::dbaui::appendToFilter( getConnection(), m_sName, comphelper::getComponentContext(getORB()), getView() );
             }
             Reference< XTitleChangeListener> xEventListener(impl_getTitleHelper_throw(),UNO_QUERY);
             if ( xEventListener.is() )
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 8a72e90..abe665b 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -26,8 +26,8 @@
 #include "dbustrings.hrc"
 #include <connectivity/dbtools.hxx>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
@@ -161,7 +161,7 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue
         case ID_BROWSER_SAVEDOC:
             {
                 OSL_ENSURE(isEditable(),"Slot ID_BROWSER_SAVEDOC should not be enabled!");
-                if(!::dbaui::checkDataSourceAvailable(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_NAME)), comphelper::ComponentContext(getORB()).getUNOContext()))
+                if(!::dbaui::checkDataSourceAvailable(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_NAME)), comphelper::getComponentContext(getORB())))
                 {
                     String aMessage(ModuleRes(STR_DATASOURCE_DELETED));
                     OSQLWarningBox( getView(), aMessage ).Execute();
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index f7b969f..ea9b022 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -56,8 +56,8 @@
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/streamsection.hxx>
 #include <comphelper/types.hxx>
 #include <connectivity/dbexception.hxx>
@@ -406,7 +406,7 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs)
                 assignTable();
             }
             // now check if our datasource has set a tablefilter and if append the new table name to it
-            ::dbaui::appendToFilter(getConnection(),m_sName,comphelper::ComponentContext(getORB()).getUNOContext(),getView()); // we are not interessted in the return value
+            ::dbaui::appendToFilter(getConnection(),m_sName,comphelper::getComponentContext(getORB()),getView()); // we are not interessted in the return value
             Reference< frame::XTitleChangeListener> xEventListener(impl_getTitleHelper_throw(),UNO_QUERY);
             if ( xEventListener.is() )
             {
diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx
index c91b480..c37139b 100644
--- a/extensions/source/abpilot/datasourcehandling.cxx
+++ b/extensions/source/abpilot/datasourcehandling.cxx
@@ -49,7 +49,7 @@
 #include <com/sun/star/uno/XNamingService.hpp>
 
 #include <comphelper/interaction.hxx>
-#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
 #include <unotools/confignode.hxx>
@@ -127,7 +127,7 @@ namespace abp
         {
             // create the new data source
             Reference< XPropertySet > xNewDataSource;
-            lcl_implCreateAndInsert( comphelper::ComponentContext(_rxORB).getUNOContext(), _rName, xNewDataSource );
+            lcl_implCreateAndInsert( comphelper::getComponentContext(_rxORB), _rName, xNewDataSource );
 
             //.............................................................
             // set the URL property
@@ -157,11 +157,9 @@ namespace abp
         OSL_ENSURE( !_sURL.isEmpty(), "lcl_registerDataSource: invalid URL!" );
         try
         {
-
-            ::comphelper::ComponentContext aContext( _rxORB );
-            Reference< XDatabaseRegistrations > xRegistrations(
-                aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
-
+            Reference< XDatabaseContext > xRegistrations(
+                DatabaseContext::create(
+                    comphelper::getComponentContext(_rxORB)));
             if ( xRegistrations->hasRegisteredDatabase( _sName ) )
                 xRegistrations->changeDatabaseLocation( _sName, _sURL );
             else
@@ -201,7 +199,7 @@ namespace abp
         {
             // create the UNO context
             m_pImpl->xContext = Reference<XNameAccess>(
-                      lcl_getDataSourceContext( comphelper::ComponentContext(_rxORB).getUNOContext() ),
+                      lcl_getDataSourceContext( comphelper::getComponentContext(_rxORB) ),
                       UNO_QUERY_THROW);
 
             if (m_pImpl->xContext.is())
diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx
index 0703871..3d00eba 100644
--- a/extensions/source/dbpilots/commonpagesdbp.hxx
+++ b/extensions/source/dbpilots/commonpagesdbp.hxx
@@ -23,7 +23,7 @@
 #include "controlwizard.hxx"
 #include <vcl/fixed.hxx>
 #include <vcl/lstbox.hxx>
-#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
 
 //.........................................................................
 namespace dbp
@@ -44,7 +44,7 @@ namespace dbp
         FixedText       m_aTableLabel;
         ListBox         m_aTable;
 
-        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+        ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
                         m_xDSContext;
 
     public:
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx
index ba216b3..47c6bb5 100644
--- a/extensions/source/dbpilots/controlwizard.cxx
+++ b/extensions/source/dbpilots/controlwizard.cxx
@@ -42,7 +42,7 @@
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/sdbc/SQLWarning.hpp>
 #include <com/sun/star/sdb/SQLContext.hpp>
-#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/types.hxx>
 #include <connectivity/dbtools.hxx>
 #include <vcl/msgbox.hxx>
@@ -446,9 +446,8 @@ namespace dbp
         {
             DBG_ASSERT(xORB.is(), "OControlWizard::implGetDSContext: invalid service factory!");
 
-            m_aContext.xDatasourceContext = Reference<XNameAccess>(
-                DatabaseContext::create(comphelper::ComponentContext(xORB).getUNOContext()),
-                UNO_QUERY_THROW);
+            m_aContext.xDatasourceContext =
+                DatabaseContext::create(comphelper::getComponentContext(xORB));
         }
         catch(const Exception&)
         {
diff --git a/extensions/source/dbpilots/wizardcontext.hxx b/extensions/source/dbpilots/wizardcontext.hxx
index 2e5bb42..6b77c78 100644
--- a/extensions/source/dbpilots/wizardcontext.hxx
+++ b/extensions/source/dbpilots/wizardcontext.hxx
@@ -22,6 +22,7 @@
 
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
 #include <com/sun/star/sdbc/XRowSet.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/drawing/XDrawPage.hpp>
@@ -40,7 +41,7 @@ namespace dbp
     struct OControlWizardContext
     {
         // the global data source context
-        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+        ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
                     xDatasourceContext;
 
         // the control mode
diff --git a/offapi/com/sun/star/sdb/XDatabaseContext.idl b/offapi/com/sun/star/sdb/XDatabaseContext.idl
index 9c03942..c721a27 100644
--- a/offapi/com/sun/star/sdb/XDatabaseContext.idl
+++ b/offapi/com/sun/star/sdb/XDatabaseContext.idl
@@ -30,6 +30,8 @@ module com {  module sun {  module star {  module sdb {
 
 /**
     Provides an interface for the new-style DatabaseContext service to implement.
+
+    @since LibreOffice 3.7
  */
 published interface XDatabaseContext
 {
@@ -67,7 +69,7 @@ published interface XDatabaseContext
 
         @since OOo 3.3
     */
-    [optional] interface XDatabaseRegistrations;
+    interface XDatabaseRegistrations;
 };
 
 
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 7d362fe..49f7ca5 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -34,7 +34,6 @@
 #include <svtools/helpid.hrc>
 #include <svtools/svtresid.hxx>
 #include <tools/debug.hxx>
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/interaction.hxx>
 #include <comphelper/processfactory.hxx>
@@ -801,7 +800,7 @@ void AssignmentPersistentData::Commit()
 
             try
             {
-                m_xDatabaseContext = DatabaseContext::create(comphelper::ComponentContext(m_xORB).getUNOContext());
+                m_xDatabaseContext = DatabaseContext::create(comphelper::getComponentContext(m_xORB));
             }
             catch(Exception&) { }
             if (!m_xDatabaseContext.is())
commit 9c00e38b431b57c3760f6c0aa774424b3239eeda
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Sep 18 09:46:34 2012 +0200

    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

diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx
index 4c08dd1..a0f8bc5 100644
--- a/connectivity/inc/connectivity/dbtools.hxx
+++ b/connectivity/inc/connectivity/dbtools.hxx
@@ -60,7 +60,9 @@ namespace lang {
 namespace container {
     class XNameAccess;
 }
-
+namespace uno {
+    class XComponentContext;
+}
 namespace util {
     class XNumberFormatTypes;
     class XNumberFormatsSupplier;
@@ -505,7 +507,7 @@ namespace dbtools
                                     sal_Int32 _nDataType);
     // return the datasource for the given datasource name
     OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource(const ::rtl::OUString& _rsDataSourceName,
-                        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);
+                        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
 
     /** search for a name that is NOT in the NameAcces
         @param  _rxContainer
diff --git a/connectivity/inc/connectivity/virtualdbtools.hxx b/connectivity/inc/connectivity/virtualdbtools.hxx
index dfd6eba..dafaa45 100644
--- a/connectivity/inc/connectivity/virtualdbtools.hxx
+++ b/connectivity/inc/connectivity/virtualdbtools.hxx
@@ -61,6 +61,9 @@ namespace com {
                 class XColumn;
                 class SQLContext;
             }
+            namespace uno {
+                class XComponentContext;
+            }
             namespace container {
                 class XNameAccess;
             }
@@ -175,7 +178,7 @@ namespace connectivity
 
             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
                 const ::rtl::OUString& _rsRegisteredName,
-                const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+                const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
             ) const = 0;
 
             virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index f175c3e..24f29a1 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/BooleanComparisonMode.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/sdb/ParametersRequest.hpp>
@@ -62,6 +63,7 @@
 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
 #include <com/sun/star/util/XNumberFormatTypes.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/interaction.hxx>
 #include <comphelper/property.hxx>
@@ -245,14 +247,11 @@ Reference< XConnection> findConnection(const Reference< XInterface >& xParent)
 //------------------------------------------------------------------------------
 Reference< XDataSource> getDataSource_allowException(
             const ::rtl::OUString& _rsTitleOrPath,
-            const Reference< XMultiServiceFactory >& _rxFactory )
+            const Reference< XComponentContext >& _rxContext )
 {
     ENSURE_OR_RETURN( !_rsTitleOrPath.isEmpty(), "getDataSource_allowException: invalid arg !", NULL );
 
-    Reference< XNameAccess> xDatabaseContext(
-        _rxFactory->createInstance(
-            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DatabaseContext" )) ),UNO_QUERY );
-    OSL_ENSURE( xDatabaseContext.is(), "getDataSource_allowException: could not obtain the database context!" );
+    Reference< XDatabaseContext> xDatabaseContext = DatabaseContext::create(_rxContext);
 
     return Reference< XDataSource >( xDatabaseContext->getByName( _rsTitleOrPath ), UNO_QUERY );
 }
@@ -260,12 +259,12 @@ Reference< XDataSource> getDataSource_allowException(
 //------------------------------------------------------------------------------
 Reference< XDataSource > getDataSource(
             const ::rtl::OUString& _rsTitleOrPath,
-            const Reference< XMultiServiceFactory >& _rxFactory )
+            const Reference< XComponentContext >& _rxContext )
 {
     Reference< XDataSource > xDS;
     try
     {
-        xDS = getDataSource_allowException( _rsTitleOrPath, _rxFactory );
+        xDS = getDataSource_allowException( _rsTitleOrPath, _rxContext );
     }
     catch( const Exception& )
     {
@@ -282,7 +281,7 @@ Reference< XConnection > getConnection_allowException(
             const ::rtl::OUString& _rsPwd,
             const Reference< XMultiServiceFactory>& _rxFactory)
 {
-    Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, _rxFactory) );
+    Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, comphelper::ComponentContext(_rxFactory).getUNOContext()) );
     Reference<XConnection> xConnection;
     if (xDataSource.is())
     {
diff --git a/connectivity/source/simpledbt/staticdbtools_s.cxx b/connectivity/source/simpledbt/staticdbtools_s.cxx
index 6c8c9ae..797555c 100644
--- a/connectivity/source/simpledbt/staticdbtools_s.cxx
+++ b/connectivity/source/simpledbt/staticdbtools_s.cxx
@@ -149,9 +149,9 @@ namespace connectivity
     }
 
     //----------------------------------------------------------------
-    Reference< XDataSource > ODataAccessStaticTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XMultiServiceFactory>& _rxFactory ) const
+    Reference< XDataSource > ODataAccessStaticTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XComponentContext>& _rxContext ) const
     {
-        return ::dbtools::getDataSource( _rsRegisteredName, _rxFactory );
+        return ::dbtools::getDataSource( _rsRegisteredName, _rxContext );
     }
 
     //----------------------------------------------------------------
diff --git a/connectivity/source/simpledbt/staticdbtools_s.hxx b/connectivity/source/simpledbt/staticdbtools_s.hxx
index da0f1be..3132f00 100644
--- a/connectivity/source/simpledbt/staticdbtools_s.hxx
+++ b/connectivity/source/simpledbt/staticdbtools_s.hxx
@@ -138,7 +138,7 @@ namespace connectivity
         // ------------------------------------------------
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
             const ::rtl::OUString& _rsRegisteredName,
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
         ) const;
 
         // ------------------------------------------------
diff --git a/cui/source/options/dbregisterednamesconfig.cxx b/cui/source/options/dbregisterednamesconfig.cxx
index bb93577..c2829b1 100644
--- a/cui/source/options/dbregisterednamesconfig.cxx
+++ b/cui/source/options/dbregisterednamesconfig.cxx
@@ -31,6 +31,7 @@
 #include "dbregistersettings.hxx"
 #include "svx/svxids.hrc"
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
@@ -61,9 +62,9 @@ namespace svx
 
         try
         {
-            ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+            Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
             Reference< XDatabaseRegistrations > xRegistrations(
-                aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
+                DatabaseContext::create(xContext), UNO_QUERY_THROW );
 
             Sequence< ::rtl::OUString > aRegistrationNames( xRegistrations->getRegistrationNames() );
             const ::rtl::OUString* pRegistrationName = aRegistrationNames.getConstArray();
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index e8bc774..c4ac4ef 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/ErrorCondition.hpp>
 #include <com/sun/star/sdb/RowChangeAction.hpp>
 #include <com/sun/star/sdb/RowSetVetoException.hpp>
@@ -2154,9 +2155,7 @@ Reference< XConnection >  ORowSet::calcConnection(const Reference< XInteractionH
         Reference< XConnection > xNewConn;
         if ( !m_aDataSourceName.isEmpty() )
         {
-            Reference< XNameAccess > xDatabaseContext(
-                m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ),
-                UNO_QUERY_THROW );
+            Reference< XNameAccess > xDatabaseContext( DatabaseContext::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
             try
             {
                 Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_aDataSourceName ), UNO_QUERY_THROW );
diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx
index 83b0195..6e43425 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.hxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.hxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
 #include <com/sun/star/sdb/XDatabaseEnvironment.hpp>
 #include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
 #include <com/sun/star/uno/XNamingService.hpp>
@@ -39,7 +40,7 @@
 #include <basic/basicmanagerrepository.hxx>
 #include <comphelper/componentcontext.hxx>
 #include <comphelper/stl_types.hxx>
-#include <cppuhelper/compbase8.hxx>
+#include <cppuhelper/compbase3.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
 
 #include <boost/shared_ptr.hpp>
@@ -64,14 +65,9 @@ class DatabaseDocumentLoader;
 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
     ODatabaseContext_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
 
-typedef ::cppu::WeakComponentImplHelper8    <   ::com::sun::star::lang::XServiceInfo
-                                            ,   ::com::sun::star::container::XEnumerationAccess
-                                            ,   ::com::sun::star::container::XNameAccess
-                                            ,   ::com::sun::star::uno::XNamingService
-                                            ,   ::com::sun::star::container::XContainer
-                                            ,   ::com::sun::star::lang::XSingleServiceFactory
+typedef ::cppu::WeakComponentImplHelper3    <   ::com::sun::star::lang::XServiceInfo
+                                            ,   ::com::sun::star::sdb::XDatabaseContext
                                             ,   ::com::sun::star::lang::XUnoTunnel
-                                            ,   ::com::sun::star::sdb::XDatabaseRegistrations
                                             >   DatabaseAccessContext_Base;
 
 class ODatabaseContext  :public DatabaseAccessContext_Base
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 9b49dc4..83435d8 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -53,6 +53,7 @@
 #include <com/sun/star/view/XSelectionSupplier.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
 
 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
@@ -101,6 +102,7 @@ using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::embed;
 using namespace ::com::sun::star::task;
 using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::sdb;
 using namespace ::com::sun::star::sdbc;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::xml::sax;
@@ -1868,7 +1870,7 @@ Sequence< ::rtl::OUString > ODatabaseDocument::getSupportedServiceNames(  ) thro
 Reference< XInterface > ODatabaseDocument::Create( const Reference< XComponentContext >& _rxContext )
 {
     ::comphelper::ComponentContext aContext( _rxContext );
-    Reference< XUnoTunnel > xDBContextTunnel( aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ), UNO_QUERY_THROW );
+    Reference< XUnoTunnel > xDBContextTunnel( DatabaseContext::create(_rxContext), UNO_QUERY_THROW );
     ODatabaseContext* pContext = reinterpret_cast< ODatabaseContext* >( xDBContextTunnel->getSomething( ODatabaseContext::getUnoTunnelImplementationId() ) );
 
     ::rtl::Reference<ODatabaseModelImpl> pImpl( new ODatabaseModelImpl( aContext.getLegacyServiceFactory(), *pContext ) );
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 061d873..a0480df 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -40,6 +40,7 @@
 #include <com/sun/star/embed/XTransactedObject.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/reflection/XProxyFactory.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdbc/XDriverAccess.hpp>
 #include <com/sun/star/sdbc/XDriverManager.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
@@ -600,8 +601,7 @@ Sequence< ::rtl::OUString > ODatabaseSource::getSupportedServiceNames(  ) throw
 Reference< XInterface > ODatabaseSource::Create( const Reference< XComponentContext >& _rxContext )
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen at sun.com", "ODatabaseSource::Create" );
-    ::comphelper::ComponentContext aContext( _rxContext );
-    Reference< XSingleServiceFactory > xDBContext( aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ), UNO_QUERY_THROW );
+    Reference< XSingleServiceFactory > xDBContext( DatabaseContext::create(_rxContext), UNO_QUERY_THROW );
     return xDBContext->createInstance();
 }
 
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index bad3711..6441d8d 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -40,6 +40,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/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
 #include <com/sun/star/task/XJobExecutor.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
@@ -445,9 +446,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::
     sal_Int32 nInitialSelection = -1;
     if ( !xModel.is() )
     {
-        Reference< XSingleServiceFactory > xDatabaseContext;
-        if ( !m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT, xDatabaseContext ) )
-            throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "css.sdb.DatabaseContext not available" ) ), NULL );
+        Reference< XSingleServiceFactory > xDatabaseContext( DatabaseContext::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
 
         ::rtl::OUString sFactoryName = SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE);
         bCreateNew = sFactoryName.match(_rURL);
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index cb8d8b9..ed7fadf 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -34,6 +34,7 @@
 #include <comphelper/sequence.hxx>
 #include <comphelper/extract.hxx>
 #include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/SQLContext.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -255,7 +256,7 @@ sal_Bool OGenericUnoController::Construct(Window* /*pParent*/)
     OSL_ENSURE(getORB().is(), "OGenericUnoController::Construct need a service factory!");
     try
     {
-        m_xDatabaseContext = Reference< XNameAccess >(getORB()->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
+        m_xDatabaseContext = Reference< XNameAccess >( DatabaseContext::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW );
     }
     catch(Exception&)
     {
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index a0d53c4..da713f3 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -41,6 +41,7 @@
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/SQLContext.hpp>
 #include <com/sun/star/sdbc/XDriver.hpp>
 #include <com/sun/star/sdbc/XDriverAccess.hpp>
@@ -49,6 +50,7 @@
 #include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
 #include <com/sun/star/ucb/AuthenticationRequest.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/guarding.hxx>
 #include <comphelper/interaction.hxx>
 #include <comphelper/property.hxx>
@@ -206,7 +208,7 @@ ODbDataSourceAdministrationHelper::ODbDataSourceAdministrationHelper(const Refer
 
     try
     {
-        m_xDatabaseContext = Reference< XNameAccess >(m_xORB->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
+        m_xDatabaseContext = Reference< XNameAccess >( DatabaseContext::create(comphelper::ComponentContext(m_xORB).getUNOContext()), UNO_QUERY_THROW );
         m_xDynamicContext.set(m_xDatabaseContext,UNO_QUERY);
     }
     catch(Exception&)
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index 274c813..664879d 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -54,6 +54,7 @@
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
@@ -858,8 +859,8 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
     void ODbTypeWizDialogSetup::RegisterDataSourceByLocation(const ::rtl::OUString& _sPath)
     {
         Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
-        Reference< XNamingService > xDatabaseContext(getORB()->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
-        Reference< XNameAccess > xNameAccessDatabaseContext(xDatabaseContext, UNO_QUERY);
+        Reference< XNamingService > xDatabaseContext( DatabaseContext::create(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW );
+        Reference< XNameAccess > xNameAccessDatabaseContext(xDatabaseContext, UNO_QUERY_THROW );
         INetURLObject aURL( _sPath );
         ::rtl::OUString sFilename = aURL.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
         ::rtl::OUString sDatabaseName = ::dbtools::createUniqueName(xNameAccessDatabaseContext, sFilename,sal_False);
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
index 4abcb59..574b3ad 100644
--- a/dbaccess/source/ui/inc/UITools.hxx
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -57,6 +57,7 @@ namespace com { namespace sun { namespace star {
         class XNumberFormatter;
     }
     namespace ucb { class XContent; }
+    namespace uno { class XComponentContext; }
 
 }}}
 
@@ -138,7 +139,7 @@ namespace dbaui
     /** checks if the given name exists in the database context
     */
     sal_Bool checkDataSourceAvailable(  const ::rtl::OUString& _sDataSourceName,
-                                        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory_xORB);
+                                        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
 
     /** maps SvxCellHorJustify to com::sun::star::awt::TextAlign
         @param SvxCellHorJustify& _eAlignment
@@ -215,7 +216,7 @@ namespace dbaui
     */
     sal_Bool appendToFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
                             const ::rtl::OUString& _sName,
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory,
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
                             Window* _pParent);
 
     /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 36c922c..9c30b73 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -29,6 +29,7 @@
 #include <comphelper/string.hxx>
 #include <comphelper/types.hxx>
 #include <connectivity/dbtools.hxx>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
@@ -276,7 +277,7 @@ void ODatabaseImportExport::initialize()
     if ( !m_xConnection.is() )
     {   // we need a connection
         OSL_ENSURE(!m_sDataSourceName.isEmpty(),"There must be a datsource name!");
-        Reference<XNameAccess> xDatabaseContext = Reference< XNameAccess >(m_xFactory->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
+        Reference<XNameAccess> xDatabaseContext( DatabaseContext::create(comphelper::ComponentContext(m_xFactory).getUNOContext()), UNO_QUERY_THROW);
         Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY);
 
         Reference< XConnection > xConnection;
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 4131abc..0ac020f 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -27,6 +27,7 @@
 #include "dbtreelistbox.hxx"
 #include "defaultobjectnamecheck.hxx"
 #include <comphelper/extract.hxx>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
@@ -223,7 +224,7 @@ Reference< XDataSource > getDataSourceByName( const ::rtl::OUString& _rDataSourc
     Window* _pErrorMessageParent, Reference< XMultiServiceFactory > _rxORB, ::dbtools::SQLExceptionInfo* _pErrorInfo )
 {
     ::comphelper::ComponentContext aContext( _rxORB );
-    Reference< XNameAccess > xDatabaseContext( aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
+    Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create(aContext.getUNOContext());
 
     Reference< XDataSource > xDatasource;
     Any aError;
@@ -722,22 +723,18 @@ void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDe
     return sDefaultName;
 }
 // -----------------------------------------------------------------------------
-sal_Bool checkDataSourceAvailable(const ::rtl::OUString& _sDataSourceName,const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB)
+sal_Bool checkDataSourceAvailable(const ::rtl::OUString& _sDataSourceName,const Reference< ::com::sun::star::uno::XComponentContext >& _xContext)
 {
-    sal_Bool bRet = sal_False;
-    Reference< XNameAccess > xDataBaseContext(_xORB->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
-    if ( xDataBaseContext.is() )
-    {
-        bRet = xDataBaseContext->hasByName(_sDataSourceName);
-        if ( !bRet )
-        { // try if this one is a URL
-            try
-            {
-                bRet = xDataBaseContext->getByName(_sDataSourceName).hasValue();
-            }
-            catch(const Exception&)
-            {
-            }
+    Reference< XDatabaseContext > xDataBaseContext = DatabaseContext::create(_xContext);
+    sal_Bool bRet = xDataBaseContext->hasByName(_sDataSourceName);
+    if ( !bRet )
+    { // try if this one is a URL
+        try
+        {
+            bRet = xDataBaseContext->getByName(_sDataSourceName).hasValue();
+        }
+        catch(const Exception&)
+        {
         }
     }
     return bRet;
@@ -1019,7 +1016,7 @@ const SfxFilter* getStandardDatabaseFilter()
 // -----------------------------------------------------------------------------
 sal_Bool appendToFilter(const Reference<XConnection>& _xConnection,
                         const ::rtl::OUString& _sName,
-                        const Reference< XMultiServiceFactory >& _xFactory,
+                        const Reference< XComponentContext >& _rxContext,
                         Window* _pParent)
 {
     sal_Bool bRet = sal_False;
@@ -1050,7 +1047,7 @@ sal_Bool appendToFilter(const Reference<XConnection>& _xConnection,
             bRet = sal_True;
             if(bHasToInsert)
             {
-                if(! ::dbaui::checkDataSourceAvailable(::comphelper::getString(xProp->getPropertyValue(PROPERTY_NAME)),_xFactory))
+                if(! ::dbaui::checkDataSourceAvailable(::comphelper::getString(xProp->getPropertyValue(PROPERTY_NAME)),_rxContext))
                 {
                     String aMessage(ModuleRes(STR_TABLEDESIGN_DATASOURCE_DELETED));
                     OSQLWarningBox( _pParent, aMessage ).Execute();
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 782eb3c..e7e0ae9 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -46,6 +46,7 @@
 #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/types.hxx>
 #include <comphelper/interaction.hxx>
@@ -1337,7 +1338,7 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
         {
             xSuppDestinationColumns.set( xTable, UNO_QUERY_THROW );
             // insert new table name into table filter
-            ::dbaui::appendToFilter( m_xDestConnection, m_sName, GetFactory(), this );
+            ::dbaui::appendToFilter( m_xDestConnection, m_sName, comphelper::ComponentContext(GetFactory()).getUNOContext(), this );
 
             // copy ui settings
             m_rSourceObject.copyUISettingsTo( xTable );
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 7ae2348..6d46ff6 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -1534,7 +1534,7 @@ bool OQueryController::doSaveAsDoc(sal_Bool _bSaveAs)
                     m_xAlterView.set( xElements->getByName( m_sName ), UNO_QUERY );
 
                 // now check if our datasource has set a tablefilter and if so, append the new table name to it
-                ::dbaui::appendToFilter( getConnection(), m_sName, getORB(), getView() );
+                ::dbaui::appendToFilter( getConnection(), m_sName, comphelper::ComponentContext(getORB()).getUNOContext(), getView() );
             }
             Reference< XTitleChangeListener> xEventListener(impl_getTitleHelper_throw(),UNO_QUERY);
             if ( xEventListener.is() )
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index ec23a4b..8a72e90 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -26,6 +26,7 @@
 #include "dbustrings.hrc"
 #include <connectivity/dbtools.hxx>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
@@ -160,7 +161,7 @@ void ORelationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue
         case ID_BROWSER_SAVEDOC:
             {
                 OSL_ENSURE(isEditable(),"Slot ID_BROWSER_SAVEDOC should not be enabled!");
-                if(!::dbaui::checkDataSourceAvailable(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_NAME)),getORB()))
+                if(!::dbaui::checkDataSourceAvailable(::comphelper::getString(getDataSource()->getPropertyValue(PROPERTY_NAME)), comphelper::ComponentContext(getORB()).getUNOContext()))
                 {
                     String aMessage(ModuleRes(STR_DATASOURCE_DELETED));
                     OSQLWarningBox( getView(), aMessage ).Execute();
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index e86d6f1..f7b969f 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -56,6 +56,7 @@
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/streamsection.hxx>
 #include <comphelper/types.hxx>
@@ -405,7 +406,7 @@ sal_Bool OTableController::doSaveDoc(sal_Bool _bSaveAs)
                 assignTable();
             }
             // now check if our datasource has set a tablefilter and if append the new table name to it
-            ::dbaui::appendToFilter(getConnection(),m_sName,getORB(),getView()); // we are not interessted in the return value
+            ::dbaui::appendToFilter(getConnection(),m_sName,comphelper::ComponentContext(getORB()).getUNOContext(),getView()); // we are not interessted in the return value
             Reference< frame::XTitleChangeListener> xEventListener(impl_getTitleHelper_throw(),UNO_QUERY);
             if ( xEventListener.is() )
             {
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index ea9ceb8..820569a 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
@@ -103,6 +104,8 @@ namespace dbaui
     using ::com::sun::star::container::XChild;
     using ::com::sun::star::task::XInteractionHandler;
     using ::com::sun::star::frame::XModel;
+    using ::com::sun::star::sdb::DatabaseContext;
+    using ::com::sun::star::sdb::XDatabaseContext;
     using ::com::sun::star::sdb::XDocumentDataSource;
     using ::com::sun::star::sdb::XCompletedConnection;
     using ::com::sun::star::lang::WrappedTargetException;
@@ -911,7 +914,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference<
         OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_DATABASE_LOCATION ) >>= sDatabaseLocation );
 
     // need a DatabaseContext for loading the data source
-    Reference< XNameAccess > xDatabaseContext( m_aContext.createComponent( "com.sun.star.sdb.DatabaseContext" ), UNO_QUERY_THROW );
+    Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create( m_aContext.getUNOContext() );
     Reference< XDataSource > xDataSource;
     if ( !sDataSource.isEmpty() )
         xDataSource.set( xDatabaseContext->getByName( sDataSource ), UNO_QUERY_THROW );
diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx
index 2c45e5e..c91b480 100644
--- a/extensions/source/abpilot/datasourcehandling.cxx
+++ b/extensions/source/abpilot/datasourcehandling.cxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/lang/XComponent.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/SQLContext.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdb/XDatabaseRegistrations.hpp>
@@ -77,22 +78,21 @@ namespace abp
 
     //=====================================================================
     //---------------------------------------------------------------------
-    static Reference< XNameAccess > lcl_getDataSourceContext( const Reference< XMultiServiceFactory >& _rxORB ) SAL_THROW (( Exception ))
+    static Reference< XDatabaseContext > lcl_getDataSourceContext( const Reference< XComponentContext >& _rxContext ) SAL_THROW (( Exception ))
     {
-        Reference< XNameAccess > xContext( _rxORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DatabaseContext" )) ), UNO_QUERY );
-        DBG_ASSERT(xContext.is(), "lcl_getDataSourceContext: could not access the data source context!");
+        Reference<XDatabaseContext> xContext = DatabaseContext::create(_rxContext);
         return xContext;
     }
 
     //---------------------------------------------------------------------
     /// creates a new data source and inserts it into the context
     static void lcl_implCreateAndInsert(
-        const Reference< XMultiServiceFactory >& _rxORB, const ::rtl::OUString& _rName,
+        const Reference< XComponentContext >& _rxContext, const ::rtl::OUString& _rName,
         Reference< XPropertySet >& /* [out] */ _rxNewDataSource ) SAL_THROW (( ::com::sun::star::uno::Exception ))
     {
         //.............................................................
         // get the data source context
-        Reference< XNameAccess > xContext = lcl_getDataSourceContext( _rxORB );
+        Reference< XDatabaseContext > xContext = lcl_getDataSourceContext( _rxContext );
 
         DBG_ASSERT( !xContext->hasByName( _rName ), "lcl_implCreateAndInsert: name already used!" );
         (void)_rName;
@@ -127,7 +127,7 @@ namespace abp
         {
             // create the new data source
             Reference< XPropertySet > xNewDataSource;
-            lcl_implCreateAndInsert( _rxORB, _rName, xNewDataSource );
+            lcl_implCreateAndInsert( comphelper::ComponentContext(_rxORB).getUNOContext(), _rName, xNewDataSource );
 
             //.............................................................
             // set the URL property
@@ -200,7 +200,9 @@ namespace abp
         try
         {
             // create the UNO context
-            m_pImpl->xContext = lcl_getDataSourceContext( _rxORB );
+            m_pImpl->xContext = Reference<XNameAccess>(
+                      lcl_getDataSourceContext( comphelper::ComponentContext(_rxORB).getUNOContext() ),
+                      UNO_QUERY_THROW);
 
             if (m_pImpl->xContext.is())
             {
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx
index 652b4a5..c169606 100644
--- a/extensions/source/bibliography/bibconfig.cxx
+++ b/extensions/source/bibliography/bibconfig.cxx
@@ -33,12 +33,14 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <comphelper/processfactory.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
 
 using ::rtl::OUString;
 
@@ -343,17 +345,9 @@ const Sequence<OUString>& DBChangeDialogConfig_Impl::GetDataSourceNames()
 {
     if(!aSourceNames.getLength())
     {
-        Reference<XNameAccess> xDBContext;
-        Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
-        if( xMgr.is() )
-        {
-            Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
-            xDBContext = Reference<XNameAccess>(xInstance, UNO_QUERY) ;
-        }
-        if(xDBContext.is())
-        {
-            aSourceNames = xDBContext->getElementNames();
-        }
+        Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+        Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
+        aSourceNames = xDBContext->getElementNames();
     }
     return aSourceNames;
 }
diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx
index 2b04564..0562802 100644
--- a/extensions/source/bibliography/datman.cxx
+++ b/extensions/source/bibliography/datman.cxx
@@ -41,6 +41,7 @@
 #include <com/sun/star/uno/XNamingService.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
 #include <com/sun/star/sdbc/XConnection.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
@@ -96,9 +97,9 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL)
     Reference< XDataSource >    xDataSource;
     // is it a favorite title ?
     Reference< XMultiServiceFactory >  xMgr = comphelper::getProcessServiceFactory();
-    Reference<XInterface> xNamingContextIfc = xMgr->createInstance(C2U("com.sun.star.sdb.DatabaseContext"));
-    Reference< XNameAccess >  xNamingContext(xNamingContextIfc, UNO_QUERY);
-    if (xNamingContext.is() && xNamingContext->hasByName(_rURL))
+    Reference<XComponentContext>  xContext = comphelper::getProcessComponentContext();
+    Reference< XDatabaseContext >  xNamingContext = DatabaseContext::create(xContext);
+    if (xNamingContext->hasByName(_rURL))
     {
         DBG_ASSERT(Reference< XNamingService > (xNamingContext, UNO_QUERY).is(), "::getDataSource : no NamingService interface on the sdb::DatabaseAccessContext !");
         try
diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx
index abe80c4..ba216b3 100644
--- a/extensions/source/dbpilots/controlwizard.cxx
+++ b/extensions/source/dbpilots/controlwizard.cxx
@@ -30,6 +30,7 @@
 #include <tools/debug.hxx>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
 #include <com/sun/star/sdbc/XPreparedStatement.hpp>
 #include <com/sun/star/container/XChild.hpp>
@@ -41,6 +42,7 @@
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/sdbc/SQLWarning.hpp>
 #include <com/sun/star/sdb/SQLContext.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/types.hxx>
 #include <connectivity/dbtools.hxx>
 #include <vcl/msgbox.hxx>
@@ -444,13 +446,9 @@ namespace dbp
         {
             DBG_ASSERT(xORB.is(), "OControlWizard::implGetDSContext: invalid service factory!");
 
-            Reference< XInterface > xContext;
-            if (xORB.is())
-                xContext = xORB->createInstance(::rtl::OUString("com.sun.star.sdb.DatabaseContext"));
-            DBG_ASSERT(xContext.is(), "OControlWizard::implGetDSContext: invalid database context!");
-
-            m_aContext.xDatasourceContext = Reference< XNameAccess >(xContext, UNO_QUERY);
-            DBG_ASSERT(m_aContext.xDatasourceContext.is() || !xContext.is(), "OControlWizard::implGetDSContext: invalid database context (missing the XNameAccess)!");
+            m_aContext.xDatasourceContext = Reference<XNameAccess>(
+                DatabaseContext::create(comphelper::ComponentContext(xORB).getUNOContext()),
+                UNO_QUERY_THROW);
         }
         catch(const Exception&)
         {
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index a9451c8..104d76c 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -235,6 +235,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/script/vba
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/sdb,\
 	DataAccessDescriptorFactory \
+	DatabaseContext \
 	DatabaseInteractionHandler \
 	InteractionHandler \
 ))
@@ -973,7 +974,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/sdb,\
 	DatabaseAccessConnection \
 	DatabaseAccessContext \
 	DatabaseAccessDataSource \
-	DatabaseContext \
 	DatabaseDocument \
 	DatabaseEnvironment \
 	DatasourceAdministrationDialog \
@@ -3092,6 +3092,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/sdb,\
 	XDataAccessDescriptorFactory \
 	XDatabaseAccess \
 	XDatabaseAccessListener \
+	XDatabaseContext \
 	XDatabaseEnvironment \
 	XDatabaseRegistrations \
 	XDatabaseRegistrationsListener \
diff --git a/offapi/com/sun/star/sdb/DatabaseContext.idl b/offapi/com/sun/star/sdb/DatabaseContext.idl
index 52ddc1c..fee3536 100644
--- a/offapi/com/sun/star/sdb/DatabaseContext.idl
+++ b/offapi/com/sun/star/sdb/DatabaseContext.idl
@@ -19,19 +19,9 @@
 #ifndef __com_sun_star_sdb_DatabaseContext_idl__
 #define __com_sun_star_sdb_DatabaseContext_idl__
 
-#include <com/sun/star/container/XEnumerationAccess.idl>
+#include <com/sun/star/sdb/XDatabaseContext.idl>
 
-#include <com/sun/star/container/XContainer.idl>
-
-#include <com/sun/star/lang/XSingleServiceFactory.idl>
-
-#include <com/sun/star/container/XNameAccess.idl>
-
-#include <com/sun/star/uno/XNamingService.idl>
-
- module com {  module sun {  module star {  module sdb {
-
-published interface XDatabaseRegistrations;
+module com {  module sun {  module star {  module sdb {
 
 /** is the context for accessing datasource.
 
@@ -44,50 +34,10 @@ published interface XDatabaseRegistrations;
     </p>
     @see com::sun::star::sdb::DataSource
  */
-published service DatabaseContext
-{
-    /** Enumeration on all registered data sources.
-     */
-    interface com::sun::star::container::XEnumerationAccess;
-
-    /** NameAccess on all registered data sources.
-        <p>One exception is the <method "com.sun.star.container.XNameAccess">getByName</method>, this method also allows to ask
-        for a <member "DataAccessDescriptor">DatabaseLocation</member>.
-        </p>
-     */
-    interface com::sun::star::container::XNameAccess;
-
-    /** Interface for registering new datasources.
-     */
-    interface com::sun::star::uno::XNamingService;
-
-    /** Interface for registering listener to get notified when new datasources are created or removed.
-    */
-    interface com::sun::star::container::XContainer;
-
-    /** Interface for creation of new datasources.
-    */
-    interface com::sun::star::lang::XSingleServiceFactory;
-
-    /** allows to access and modify the configuration data for registered data source.
-
-        <p>The main purpose of this interface is to allow you to register data sources which you know
-        by URL only, and have not yet loaded.</p>
-
-        <p>Also, it hides the details of the configuration data where the data source registrations
-        are maintained, so if possible at all, you should use this interface, instead of modifying or
-        querying the configuration data directly.</p>
-
-        @since OOo 3.3
-    */
-    [optional] interface XDatabaseRegistrations;
-};
-
+published service DatabaseContext : XDatabaseContext;
 
 }; }; }; };
 
-/*===========================================================================
-===========================================================================*/
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/sdb/DatabaseRegistrationEvent.idl b/offapi/com/sun/star/sdb/DatabaseRegistrationEvent.idl
index 29678a2..7b606cf 100644
--- a/offapi/com/sun/star/sdb/DatabaseRegistrationEvent.idl
+++ b/offapi/com/sun/star/sdb/DatabaseRegistrationEvent.idl
@@ -33,7 +33,7 @@ module com { module sun { module star { module sdb {
 
     @since  OpenOffice.org 3.3
  */
-struct DatabaseRegistrationEvent : ::com::sun::star::lang::EventObject
+published struct DatabaseRegistrationEvent : ::com::sun::star::lang::EventObject
 {
     /// is the name of the database registration affected by the event
     string  Name;
diff --git a/offapi/com/sun/star/sdb/XDatabaseContext.idl b/offapi/com/sun/star/sdb/XDatabaseContext.idl
new file mode 100644
index 0000000..9c03942
--- /dev/null
+++ b/offapi/com/sun/star/sdb/XDatabaseContext.idl
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_sdb_XDatabaseContext_idl__
+#define __com_sun_star_sdb_XDatabaseContext_idl__
+
+#include <com/sun/star/container/XEnumerationAccess.idl>
+#include <com/sun/star/container/XContainer.idl>
+#include <com/sun/star/lang/XSingleServiceFactory.idl>
+#include <com/sun/star/container/XNameAccess.idl>
+#include <com/sun/star/uno/XNamingService.idl>
+#include <com/sun/star/sdb/XDatabaseRegistrations.idl>
+
+module com {  module sun {  module star {  module sdb {
+
+/**
+    Provides an interface for the new-style DatabaseContext service to implement.
+ */
+published interface XDatabaseContext
+{
+    /** Enumeration on all registered data sources.
+     */
+    interface com::sun::star::container::XEnumerationAccess;
+
+    /** NameAccess on all registered data sources.
+        <p>One exception is the <method "com.sun.star.container.XNameAccess">getByName</method>, this method also allows to ask
+        for a <member "DataAccessDescriptor">DatabaseLocation</member>.
+        </p>
+     */
+    interface com::sun::star::container::XNameAccess;
+
+    /** Interface for registering new datasources.
+     */
+    interface com::sun::star::uno::XNamingService;
+
+    /** Interface for registering listener to get notified when new datasources are created or removed.
+    */
+    interface com::sun::star::container::XContainer;
+
+    /** Interface for creation of new datasources.
+    */
+    interface com::sun::star::lang::XSingleServiceFactory;
+
+    /** allows to access and modify the configuration data for registered data source.
+
+        <p>The main purpose of this interface is to allow you to register data sources which you know
+        by URL only, and have not yet loaded.</p>
+
+        <p>Also, it hides the details of the configuration data where the data source registrations
+        are maintained, so if possible at all, you should use this interface, instead of modifying or
+        querying the configuration data directly.</p>
+
+        @since OOo 3.3
+    */
+    [optional] interface XDatabaseRegistrations;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl b/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl
index 3ca1550..1052642 100644
--- a/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl
+++ b/offapi/com/sun/star/sdb/XDatabaseRegistrations.idl
@@ -28,7 +28,7 @@
 
 module com { module sun { module star { module sdb {
 
-interface XDatabaseRegistrationsListener;
+published interface XDatabaseRegistrationsListener;
 
 
 /** provides access to the application-wide registered databases.
@@ -40,7 +40,7 @@ interface XDatabaseRegistrationsListener;
 
     @since OOo 3.3
  */
-interface XDatabaseRegistrations
+published interface XDatabaseRegistrations
 {
     /** determines whether a database is registered under the given name.
 
diff --git a/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl b/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl
index 1f502fd..7e4b8af 100644
--- a/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl
+++ b/offapi/com/sun/star/sdb/XDatabaseRegistrationsListener.idl
@@ -34,7 +34,7 @@ module com { module sun { module star { module sdb {
 
     @since OOo 3.3
  */
-interface XDatabaseRegistrationsListener : ::com::sun::star::lang::XEventListener
+published interface XDatabaseRegistrationsListener : ::com::sun::star::lang::XEventListener
 {
     /** called when a database has been registered
     */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index c0d725b..312d0eb 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx
index 1f48203..8626983 100644
--- a/sc/source/ui/dbgui/dapidata.cxx
+++ b/sc/source/ui/dbgui/dapidata.cxx
@@ -39,6 +39,7 @@
 #include <com/sun/star/sheet/DataImportMode.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XQueriesSupplier.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 
@@ -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<container::XNameAccess> xContext(
-                comphelper::getProcessServiceFactory()->createInstance(
-                    rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( DP_SERVICE_DBCONTEXT )) ),
-                uno::UNO_QUERY);
-        if (xContext.is())
+        uno::Reference<sdb::XDatabaseContext> xContext = sdb::DatabaseContext::create(
+                comphelper::getProcessComponentContext() );
+        uno::Sequence<rtl::OUString> aNames = xContext->getElementNames();
+        long nCount = aNames.getLength();
+        const rtl::OUString* pArray = aNames.getConstArray();
+        for (long nPos = 0; nPos < nCount; nPos++)
         {
-            uno::Sequence<rtl::OUString> 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<container::XNameAccess> xContext(
-                comphelper::getProcessServiceFactory()->createInstance(
-                    rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( DP_SERVICE_DBCONTEXT )) ),
-                uno::UNO_QUERY);
-        if ( !xContext.is() ) return;
+        uno::Reference<sdb::XDatabaseContext> xContext = sdb::DatabaseContext::create(
+                comphelper::getProcessComponentContext() );
 
         uno::Any aSourceAny = xContext->getByName( aDatabaseName );
         uno::Reference<sdb::XCompletedConnection> xSource(
diff --git a/svtools/inc/svtools/addresstemplate.hxx b/svtools/inc/svtools/addresstemplate.hxx
index 7907408..65462f5 100644
--- a/svtools/inc/svtools/addresstemplate.hxx
+++ b/svtools/inc/svtools/addresstemplate.hxx
@@ -40,6 +40,7 @@
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/util/AliasProgrammaticPair.hpp>
+#include <com/sun/star/sdb/XDatabaseContext.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
 #include <unotools/configitem.hxx>
 
@@ -75,7 +76,7 @@ namespace svt
         const String    m_sNoFieldSelection;
 
         /// the DatabaseContext for selecting data sources
-        ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+        ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext >
                         m_xDatabaseContext;
         // the ORB for creating objects
         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 67c964e..7d362fe 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -34,6 +34,7 @@
 #include <svtools/helpid.hrc>
 #include <svtools/svtresid.hxx>
 #include <tools/debug.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 #include <comphelper/interaction.hxx>
 #include <comphelper/processfactory.hxx>
@@ -47,6 +48,7 @@
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdb/SQLContext.hpp>
 #include <com/sun/star/sdbc/SQLWarning.hpp>
@@ -797,14 +799,14 @@ void AssignmentPersistentData::Commit()
             if (!m_xORB.is())
                 return;
 
-            const rtl::OUString sContextServiceName("com.sun.star.sdb.DatabaseContext");
             try
             {
-                m_xDatabaseContext = Reference< XNameAccess >(m_xORB->createInstance(sContextServiceName), UNO_QUERY);
+                m_xDatabaseContext = DatabaseContext::create(comphelper::ComponentContext(m_xORB).getUNOContext());
             }
             catch(Exception&) { }
             if (!m_xDatabaseContext.is())
             {
+                const rtl::OUString sContextServiceName("com.sun.star.sdb.DatabaseContext");
                 ShowServiceNotAvailableError( this, sContextServiceName, sal_False);
                 return;
             }
diff --git a/svx/inc/svx/dbtoolsclient.hxx b/svx/inc/svx/dbtoolsclient.hxx
index 661f8d8..3568c20 100644
--- a/svx/inc/svx/dbtoolsclient.hxx
+++ b/svx/inc/svx/dbtoolsclient.hxx
@@ -149,7 +149,7 @@ namespace svxform
         // ------------------------------------------------
         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
                 const ::rtl::OUString& _rsRegisteredName,
-                const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+                const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
             ) const;
 
         // ------------------------------------------------
diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx
index da1ef37..c07be75 100644
--- a/svx/source/form/dbtoolsclient.cxx
+++ b/svx/source/form/dbtoolsclient.cxx
@@ -249,11 +249,11 @@ namespace svxform
     }
 
     //----------------------------------------------------------------
-    Reference< XDataSource > OStaticDataAccessTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XMultiServiceFactory>& _rxFactory ) const
+    Reference< XDataSource > OStaticDataAccessTools::getDataSource( const ::rtl::OUString& _rsRegisteredName, const Reference< XComponentContext>& _rxContext ) const
     {
         Reference< XDataSource > xReturn;
         if ( ensureLoaded() )
-            xReturn = m_xDataAccessTools->getDataSource(_rsRegisteredName,_rxFactory);
+            xReturn = m_xDataAccessTools->getDataSource(_rsRegisteredName,_rxContext);
         return xReturn;
     }
 
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 638fd6e..d55071e 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1177,7 +1177,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript
 
         // obtain the data source
         if ( !xDataSource.is() )
-            xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, m_aContext.getLegacyServiceFactory() );
+            xDataSource = OStaticDataAccessTools().getDataSource( sDataSource, m_aContext.getUNOContext() );
 
         // and the connection, if necessary
         if ( !xConnection.is() )
diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx
index 0c1e17f..5cf18fe 100644
--- a/svx/source/form/formcontrolfactory.cxx
+++ b/svx/source/form/formcontrolfactory.cxx
@@ -222,7 +222,7 @@ namespace svxform
 
                 Reference< XPropertySet > xDsProperties;
                 if ( !sDataSourceName.isEmpty() )
-                    xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext.getLegacyServiceFactory() ) );
+                    xDsProperties = xDsProperties.query( OStaticDataAccessTools().getDataSource( sDataSourceName, _rContext.getUNOContext() ) );
                 if ( xDsProperties.is() )
                     xDsProperties->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Info" ) ) ) >>= aInfo;
             }
diff --git a/sw/inc/swdbtoolsclient.hxx b/sw/inc/swdbtoolsclient.hxx
index 0174125..eb376d0 100644
--- a/sw/inc/swdbtoolsclient.hxx
+++ b/sw/inc/swdbtoolsclient.hxx
@@ -56,7 +56,7 @@ public:
 
     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
         const ::rtl::OUString& _rsRegisteredName,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
+        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
             );
 
     sal_Int32 getDefaultNumberFormat(
diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx
index 3577776..30aa1d6 100644
--- a/sw/source/core/edit/edfldexp.cxx
+++ b/sw/source/core/edit/edfldexp.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <doc.hxx>
 #include <docary.hxx>
 #include <ndtxt.hxx>        // GetCurFld
@@ -48,13 +49,8 @@ sal_Bool SwEditShell::IsFieldDataSourceAvailable(String& rUsedDataSource) const
 {
     const SwFldTypes * pFldTypes = GetDoc()->GetFldTypes();
     const sal_uInt16 nSize = pFldTypes->size();
-    uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
-    if( !xMgr.is() )
-        return sal_False;
-    uno::Reference<uno::XInterface> xInstance = xMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseContext")));
-    uno::Reference<container::XNameAccess> xDBContext(xInstance, uno::UNO_QUERY) ;
-    if(!xDBContext.is())
-        return sal_False;
+    uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+    uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext);
     for(sal_uInt16 i = 0; i < nSize; ++i)
     {
         SwFieldType& rFldType = *((*pFldTypes)[i]);
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 68d4ab4..8a54926 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -45,6 +45,7 @@
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
@@ -211,61 +212,55 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) :
     m_aListLB.SetTabs(&nTabs[0], MAP_PIXEL);
     m_aOK.SetClickHdl( LINK( this, SwAddressListDialog, OKHdl_Impl));
 
-    uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
-    if( xMgr.is() )
-    {
-        uno::Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
-        m_xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ;
-    }
+    uno::Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+    m_xDBContext = DatabaseContext::create(xContext);
+
     SwMailMergeConfigItem& rConfigItem = m_pAddressPage->GetWizard()->GetConfigItem();
     const SwDBData& rCurrentData = rConfigItem.GetCurrentDBData();
 
-    OSL_ENSURE(m_xDBContext.is(), "service 'com.sun.star.sdb.DatabaseContext' not found!");
     sal_Bool bEnableEdit = sal_False;
     sal_Bool bEnableOK = sal_True;
     m_aListLB.SelectAll( sal_False );
 
-    if(m_xDBContext.is())
+    SwDBConfig aDb;
+    ::rtl::OUString sBibliography = aDb.GetBibliographySource().sDataSource;
+    uno::Sequence< ::rtl::OUString> aNames = m_xDBContext->getElementNames();
+    const ::rtl::OUString* pNames = aNames.getConstArray();
+    for(sal_Int32 nName = 0; nName < aNames.getLength(); ++nName)
     {
-        SwDBConfig aDb;
-        ::rtl::OUString sBibliography = aDb.GetBibliographySource().sDataSource;
-        uno::Sequence< ::rtl::OUString> aNames = m_xDBContext->getElementNames();
-        const ::rtl::OUString* pNames = aNames.getConstArray();
-        for(sal_Int32 nName = 0; nName < aNames.getLength(); ++nName)
+        if ( pNames[nName] == sBibliography )
+            continue;
+        SvLBoxEntry* pEntry = m_aListLB.InsertEntry(pNames[nName]);
+        AddressUserData_Impl* pUserData = new AddressUserData_Impl();
+        pEntry->SetUserData(pUserData);
+        if(pNames[nName] == rCurrentData.sDataSource)
         {
-            if ( pNames[nName] == sBibliography )
-                continue;
-            SvLBoxEntry* pEntry = m_aListLB.InsertEntry(pNames[nName]);
-            AddressUserData_Impl* pUserData = new AddressUserData_Impl();
-            pEntry->SetUserData(pUserData);
-            if(pNames[nName] == rCurrentData.sDataSource)
+            m_aListLB.Select(pEntry);
+            m_aListLB.SetEntryText(rCurrentData.sCommand, pEntry, ITEMID_TABLE - 1);
+            pUserData->nCommandType = rCurrentData.nCommandType;
+            pUserData->xSource = rConfigItem.GetSource();
+            pUserData->xConnection = rConfigItem.GetConnection();
+            pUserData->xColumnsSupplier = rConfigItem.GetColumnsSupplier();
+            pUserData->xResultSet = rConfigItem.GetResultSet();
+            pUserData->sFilter = rConfigItem.GetFilter();
+            //is the data source editable (csv, Unicode, single table)
+            uno::Reference<beans::XPropertySet> xSourceProperties;
+            try
             {
-                m_aListLB.Select(pEntry);
-                m_aListLB.SetEntryText(rCurrentData.sCommand, pEntry, ITEMID_TABLE - 1);
-                pUserData->nCommandType = rCurrentData.nCommandType;
-                pUserData->xSource = rConfigItem.GetSource();
-                pUserData->xConnection = rConfigItem.GetConnection();
-                pUserData->xColumnsSupplier = rConfigItem.GetColumnsSupplier();
-                pUserData->xResultSet = rConfigItem.GetResultSet();
-                pUserData->sFilter = rConfigItem.GetFilter();
-                //is the data source editable (csv, Unicode, single table)
-                uno::Reference<beans::XPropertySet> xSourceProperties;
-                try
-                {
-                    m_xDBContext->getByName(pNames[nName]) >>= xSourceProperties;
-                    pUserData->sURL = lcl_getFlatURL( xSourceProperties );
-                    bEnableEdit = !pUserData->sURL.isEmpty() &&
-                        SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
-                        !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL );
-                }
-                catch (const uno::Exception&)
-                {
-                    bEnableOK = sal_False;
-                }
-                m_aDBData = rCurrentData;
+                m_xDBContext->getByName(pNames[nName]) >>= xSourceProperties;
+                pUserData->sURL = lcl_getFlatURL( xSourceProperties );
+                bEnableEdit = !pUserData->sURL.isEmpty() &&
+                    SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
+                    !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL );
             }
+            catch (const uno::Exception&)
+            {
+                bEnableOK = sal_False;
+            }
+            m_aDBData = rCurrentData;
         }
     }
+
     m_aOK.Enable(m_aListLB.GetEntryCount()>0 && bEnableOK);
     m_aEditPB.Enable(bEnableEdit);
     m_aListLB.SetSelectHdl(LINK(this, SwAddressListDialog, ListBoxSelectHdl_Impl));
diff --git a/sw/source/ui/dbui/addresslistdialog.hxx b/sw/source/ui/dbui/addresslistdialog.hxx
index 8a0e19c..7046822 100644
--- a/sw/source/ui/dbui/addresslistdialog.hxx
+++ b/sw/source/ui/dbui/addresslistdialog.hxx
@@ -41,6 +41,9 @@ namespace com{namespace sun{namespace star{
     namespace container{
         class XNameAccess;
     }
+    namespace sdb{
+        class XDatabaseContext;
+    }
     namespace sdbc{
         class XDataSource;
     }
@@ -81,9 +84,9 @@ class SwAddressListDialog : public SfxModalDialog
 
     SwMailMergeAddressBlockPage* m_pAddressPage;
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>     m_xDBContext;
+    ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XDatabaseContext> m_xDBContext;
 
-    SwDBData                                                                        m_aDBData;
+    SwDBData                                                                   m_aDBData;
 
     void DetectTablesAndQueries(SvLBoxEntry* pSelect, bool bWidthDialog);
 
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index 63d7c47..563f888 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -38,6 +38,7 @@
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/XEventListener.hpp>
 #include <com/sun/star/util/NumberFormatter.hpp>
+#include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XCompletedConnection.hpp>
 #include <com/sun/star/sdb/XCompletedExecution.hpp>
 #include <com/sun/star/container/XChild.hpp>
@@ -1571,9 +1572,10 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData
 {
     Reference< sdbc::XConnection> xConnection;
     Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+    Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     try
     {
-        Reference<XCompletedConnection> xComplConnection(SwNewDBMgr::GetDbtoolsClient().getDataSource(rDataSource, xMgr),UNO_QUERY);
+        Reference<XCompletedConnection> xComplConnection(SwNewDBMgr::GetDbtoolsClient().getDataSource(rDataSource, xContext),UNO_QUERY);
         if ( xComplConnection.is() )
         {
             rxSource.set(xComplConnection,UNO_QUERY);
@@ -2173,18 +2175,9 @@ const SwDBData& SwNewDBMgr::GetAddressDBName()
 
 Sequence<rtl::OUString> SwNewDBMgr::GetExistingDatabaseNames()
 {
-    uno::Reference<XNameAccess> xDBContext;
-    uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
-    if( xMgr.is() )
-    {
-        uno::Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
-        xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ;
-    }
-    if(xDBContext.is())
-    {
-        return xDBContext->getElementNames();
-    }
-    return Sequence<rtl::OUString>();
+    Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+    Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
+    return xDBContext->getElementNames();
 }
 
 String SwNewDBMgr::LoadAndRegisterDataSource()
@@ -2297,9 +2290,9 @@ String SwNewDBMgr::LoadAndRegisterDataSource()
 #endif
         try
         {
-            Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
-            Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
-            Reference<XNameAccess> xDBContext(xInstance, UNO_QUERY_THROW);
+            Reference<XMultiServiceFactory> xMgr( ::comphelper::getProcessServiceFactory() );
+            Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
+            Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
             Reference<XSingleServiceFactory> xFact( xDBContext, UNO_QUERY);
 
             String sNewName = INetURLObject::decode( aURL.getName(),
@@ -2569,13 +2562,13 @@ void SwNewDBMgr::InsertText(SwWrtShell& rSh,
         OSL_FAIL("PropertyValues missing or unset");
         return;
     }
-    uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+    Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     uno::Reference<XDataSource> xSource;
     uno::Reference<XChild> xChild(xConnection, UNO_QUERY);
     if(xChild.is())
         xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
     if(!xSource.is())
-        xSource = SwNewDBMgr::GetDbtoolsClient().getDataSource(sDataSource, xMgr);
+        xSource = SwNewDBMgr::GetDbtoolsClient().getDataSource(sDataSource, xContext);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list