diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-05 14:17:14 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-07 08:23:41 +0200 |
commit | 30caf94d816dfcf9a5bc8cb5198c977d7021c369 (patch) | |
tree | 11e0d97b0dbe3d1ee2aeebf8107766c1dd6799fc /svtools | |
parent | c98a1fa04884c7fa34dfeb5e2eae706e57c09123 (diff) |
fdo#46808, Convert ui::dialogs::AddressBookSourceDialog to new style
The service already existed, it just needed an IDL file.
Change-Id: I6b9a5a5fd02985bfdd29bb42f032265d0b5498c7
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/inc/svtools/addresstemplate.hxx | 7 | ||||
-rw-r--r-- | svtools/source/dialogs/addresstemplate.cxx | 27 | ||||
-rw-r--r-- | svtools/source/uno/addrtempuno.cxx | 4 |
3 files changed, 16 insertions, 22 deletions
diff --git a/svtools/inc/svtools/addresstemplate.hxx b/svtools/inc/svtools/addresstemplate.hxx index 7d716f644f38..c5e93c112b88 100644 --- a/svtools/inc/svtools/addresstemplate.hxx +++ b/svtools/inc/svtools/addresstemplate.hxx @@ -29,7 +29,6 @@ #include <vcl/lstbox.hxx> #include <vcl/scrbar.hxx> #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> @@ -70,7 +69,7 @@ namespace svt ::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 > + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xCurrentDatasourceTables; @@ -80,7 +79,7 @@ namespace svt public: AddressBookSourceDialog( Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB ); /** if you use this ctor, the dialog <ul><li>will not store it's data in the configuration (nor initially retrieve it from there)</li> @@ -102,7 +101,7 @@ namespace svt obtained from <arg>_rxTransientDS</arg> */ AddressBookSourceDialog( Window* _pParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _rxTransientDS, const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rTable, diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index c0c84718a4d1..2865e991d46c 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -34,7 +34,7 @@ #include <vcl/waitobj.hxx> #include <vcl/msgbox.hxx> #include <toolkit/helper/vclunohelper.hxx> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/ui/dialogs/AddressBookSourcePilot.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -562,7 +562,7 @@ void AssignmentPersistentData::Commit() // ------------------------------------------------------------------- AddressBookSourceDialog::AddressBookSourceDialog(Window* _pParent, - const Reference< XMultiServiceFactory >& _rxORB ) + const Reference< XComponentContext >& _rxORB ) :INIT_FIELDS() ,m_pImpl( new AddressBookSourceDialogData ) { @@ -570,7 +570,7 @@ void AssignmentPersistentData::Commit() } // ------------------------------------------------------------------- - AddressBookSourceDialog::AddressBookSourceDialog( Window* _pParent, const Reference< XMultiServiceFactory >& _rxORB, + AddressBookSourceDialog::AddressBookSourceDialog( Window* _pParent, const Reference< XComponentContext >& _rxORB, const Reference< XDataSource >& _rxTransientDS, const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rTable, const Sequence< AliasProgrammaticPair >& _rMapping ) :INIT_FIELDS() @@ -791,9 +791,9 @@ void AssignmentPersistentData::Commit() try { - m_xDatabaseContext = DatabaseContext::create(comphelper::getComponentContext(m_xORB)); + m_xDatabaseContext = DatabaseContext::create(m_xORB); } - catch(Exception&) { } + catch(const Exception&) { } if (!m_xDatabaseContext.is()) { const rtl::OUString sContextServiceName("com.sun.star.sdb.DatabaseContext"); @@ -842,10 +842,10 @@ void AssignmentPersistentData::Commit() try { xHandler.set( - InteractionHandler::createWithParent(comphelper::getComponentContext(m_xORB), 0), + InteractionHandler::createWithParent(m_xORB, 0), UNO_QUERY_THROW ); } - catch(Exception&) { } + catch(const Exception&) { } if (!xHandler.is()) { const rtl::OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler"); @@ -1212,21 +1212,16 @@ void AssignmentPersistentData::Commit() // ------------------------------------------------------------------- IMPL_LINK_NOARG(AddressBookSourceDialog, OnAdministrateDatasources) { - // collect some initial arguments for the dialog - Sequence< Any > aArgs(1); - aArgs[0] <<= PropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")), 0, makeAny(VCLUnoHelper::GetInterface(this)), PropertyState_DIRECT_VALUE); - // create the dialog object - const rtl::OUString sDialogServiceName("com.sun.star.ui.dialogs.AddressBookSourcePilot"); Reference< XExecutableDialog > xAdminDialog; try { - xAdminDialog = Reference< XExecutableDialog >(m_xORB->createInstanceWithArguments(sDialogServiceName, aArgs), UNO_QUERY); + xAdminDialog = AddressBookSourcePilot::createWithParent( m_xORB, VCLUnoHelper::GetInterface(this) ); } - catch(Exception&) { } + catch(const Exception&) { } if (!xAdminDialog.is()) { - ShowServiceNotAvailableError(this, sDialogServiceName, sal_True); + ShowServiceNotAvailableError(this, rtl::OUString("com.sun.star.ui.dialogs.AddressBookSourcePilot"), sal_True); return 1L; } @@ -1256,7 +1251,7 @@ void AssignmentPersistentData::Commit() } } } - catch(Exception&) + catch(const Exception&) { OSL_FAIL("AddressBookSourceDialog::OnAdministrateDatasources: an error occurred while executing the administration dialog!"); } diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx index da4fa51dd5bd..ca255facf1c1 100644 --- a/svtools/source/uno/addrtempuno.cxx +++ b/svtools/source/uno/addrtempuno.cxx @@ -252,9 +252,9 @@ namespace svt Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent) { if ( m_xDataSource.is() && !m_sTable.isEmpty() ) - return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); + return new AddressBookSourceDialog(_pParent, m_aContext.getUNOContext(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases ); else - return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() ); + return new AddressBookSourceDialog( _pParent, m_aContext.getUNOContext() ); } // ....................................................................... |