From ea638e605616a2db08f88e2e14d4928854834694 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 4 Jan 2013 11:38:08 +0200 Subject: fdo#46808, convert DataSourceInfoConverter to XComponentContext and change it from a class to a simple method, there is no need for it to be a class. Change-Id: Ia8c263682d81371767f43acf1028c815923b4845 --- dbaccess/source/ui/dlg/DbAdminImpl.hxx | 14 ++++++-------- dbaccess/source/ui/dlg/dbwiz.cxx | 3 +-- dbaccess/source/ui/dlg/dbwizsetup.cxx | 7 +++---- 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.hxx b/dbaccess/source/ui/dlg/DbAdminImpl.hxx index 9c21c83e1f53..2fe1bfd98a6b 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.hxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.hxx @@ -37,15 +37,13 @@ class Window; namespace dbaui { //......................................................................... - class DataSourceInfoConverter + namespace DataSourceInfoConverter { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; - public: - DataSourceInfoConverter(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory) - :m_xFactory(_xFactory) - { - } - void convert(const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource); + void convert(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> & xContext, + const ::dbaccess::ODsnTypeCollection* _pCollection, + const ::rtl::OUString& _sOldURLPrefix, + const ::rtl::OUString& _sNewURLPrefix, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource); }; class IItemSetHelper; //======================================================================== diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index 8dc1c61064d1..d788d2a4bcbf 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -343,11 +343,10 @@ sal_Bool ODbTypeWizDialog::saveDatasource() if ( pPage ) pPage->FillItemSet(*m_pOutSet); - DataSourceInfoConverter aConverter( Reference(getORB()->getServiceManager(), UNO_QUERY_THROW) ); ::rtl::OUString sOldURL; if ( m_pImpl->getCurrentDataSource().is() ) m_pImpl->getCurrentDataSource()->getPropertyValue(PROPERTY_URL) >>= sOldURL; - aConverter.convert(m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource()); + DataSourceInfoConverter::convert( getORB(), m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource()); return sal_True; } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 90fb5f0c9d5d..7d5d6f2a2273 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -318,7 +318,7 @@ void lcl_removeUnused(const ::comphelper::NamedValueCollection& _aOld,const ::co } } // ----------------------------------------------------------------------------- -void DataSourceInfoConverter::convert(const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource) +void DataSourceInfoConverter::convert(const Reference & xContext, const ::dbaccess::ODsnTypeCollection* _pCollection,const ::rtl::OUString& _sOldURLPrefix,const ::rtl::OUString& _sNewURLPrefix,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDatasource) { if ( _pCollection->getPrefix(_sOldURLPrefix) == _pCollection->getPrefix(_sNewURLPrefix) ) return ; @@ -326,7 +326,7 @@ void DataSourceInfoConverter::convert(const ::dbaccess::ODsnTypeCollection* _pCo _xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo; ::comphelper::NamedValueCollection aDS(aInfo); - ::connectivity::DriversConfig aDriverConfig(comphelper::getComponentContext(m_xFactory)); + ::connectivity::DriversConfig aDriverConfig(xContext); const ::comphelper::NamedValueCollection& aOldProperties = aDriverConfig.getProperties(_sOldURLPrefix); const ::comphelper::NamedValueCollection& aNewProperties = aDriverConfig.getProperties(_sNewURLPrefix); @@ -355,9 +355,8 @@ void ODbTypeWizDialogSetup::activateDatabasePath() case OGeneralPage::eConnectExternal: { ::rtl::OUString sOld = m_sURL; - DataSourceInfoConverter aConverter( uno::Reference(getORB()->getServiceManager(), uno::UNO_QUERY_THROW) ); m_sURL = m_pGeneralPage->GetSelectedType(); - aConverter.convert(m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource()); + DataSourceInfoConverter::convert(getORB(), m_pCollection,sOld,m_sURL,m_pImpl->getCurrentDataSource()); ::dbaccess::DATASOURCE_TYPE eType = VerifyDataSourceType(m_pCollection->determineType(m_sURL)); if (eType == ::dbaccess::DST_UNKNOWN) eType = m_pCollection->determineType(m_sOldURL); -- cgit