diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-27 13:43:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-27 15:03:32 +0200 |
commit | a00c4e02acd1b7a3ab126941166aa2d12c7eb3fc (patch) | |
tree | 124a0877db6e0921b9a1237261106b63d94c1c9f /dbaccess | |
parent | 9c00e38b431b57c3760f6c0aa774424b3239eeda (diff) |
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
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/inc/genericcontroller.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/dbloader2.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/genericcontroller.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.cxx | 7 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DbAdminImpl.hxx | 10 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/dbwizsetup.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/TokenWriter.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/WCopyTable.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/querycontroller.cxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RelationController.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TableController.cxx | 4 |
14 files changed, 22 insertions, 30 deletions
diff --git a/dbaccess/inc/genericcontroller.hxx b/dbaccess/inc/genericcontroller.hxx index 86fcd0d5ef1c..2316566ec616 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 c4ac4ef2f09b..136992e1750d 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 a0480dfeb376..3139e2004498 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@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 6441d8d9f46e..8b2d3939b767 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 ed7fadf037f8..3131ad131e3c 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 0be575a803e7..6000c5a49538 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 da713f32d1d6..2150c6b283a3 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 bdba410f1364..305aa8a7cdbf 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 664879d7807f..9f05b4e298d9 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 9c30b73dbf91..16615e4c478b 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 e7e0ae95ccdf..025e7d14cef1 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 6d46ff69c348..9bdd3a7f6208 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 8a72e9082919..abe665bd88b2 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 f7b969f09378..ea9b022653f4 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() ) { |