diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-06 16:37:57 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-10 08:05:36 +0200 |
commit | 9fc4553b6433fbb6565a5b946c4256c0bfe345f1 (patch) | |
tree | 347cd116da96a13f9087685017f6ee4a5fc7aca7 /extensions/source | |
parent | d01fba6afc39092ae3ae85c38ac21bb7d26d63e2 (diff) |
fdo#46808, Adapt sdbc::DriverManager UNO service to new style
Change-Id: Ic2be6bd08aaabc81d0fbe0269ca577868defe934
Diffstat (limited to 'extensions/source')
4 files changed, 18 insertions, 13 deletions
diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx index a6720abeaf5b..003f70bb4736 100644 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ b/extensions/source/abpilot/admininvokationimpl.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/sdbc/DriverManager.hpp> #include <vcl/stdtext.hxx> #include <toolkit/unohlp.hxx> #include "abpresid.hrc" @@ -39,19 +40,20 @@ namespace abp using namespace ::com::sun::star::beans; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::ui::dialogs; + using namespace ::com::sun::star::sdbc; //===================================================================== //= OAdminDialogInvokation //===================================================================== //--------------------------------------------------------------------- - OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XMultiServiceFactory >& _rxORB + OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XComponentContext >& _rxContext , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xDataSource , Window* _pMessageParent) - :m_xORB(_rxORB) + :m_xContext(_rxContext) ,m_xDataSource(_xDataSource) ,m_pMessageParent(_pMessageParent) { - DBG_ASSERT(m_xORB.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); + DBG_ASSERT(m_xContext.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); DBG_ASSERT(m_xDataSource.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid preferred name!"); DBG_ASSERT(m_pMessageParent, "OAdminDialogInvokation::OAdminDialogInvokation: invalid message parent!"); } @@ -59,7 +61,7 @@ namespace abp //--------------------------------------------------------------------- sal_Bool OAdminDialogInvokation::invokeAdministration( sal_Bool _bFixedType ) { - if (!m_xORB.is()) + if (!m_xContext.is()) return sal_False; try @@ -89,7 +91,7 @@ namespace abp // creating the dialog service is potentially expensive (if all the libraries invoked need to be loaded) // so we display a wait cursor WaitObject aWaitCursor(m_pMessageParent); - xDialog = Reference< XExecutableDialog >( m_xORB->createInstanceWithArguments( _bFixedType ? s_sAdministrationServiceName : s_sDataSourceTypeChangeDialog, aArguments ), UNO_QUERY ); + xDialog = Reference< XExecutableDialog >( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(_bFixedType ? s_sAdministrationServiceName : s_sDataSourceTypeChangeDialog, aArguments, m_xContext), UNO_QUERY ); // just for a smoother UI: What the dialog does upon execution, is (amongst other things) creating // the DriverManager service @@ -99,7 +101,7 @@ namespace abp // context needs to be freshly created // Thus, we access the context here (within the WaitCursor), which means the user sees a waitcursor // while his/her office blocks a few seconds .... - m_xORB->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdbc.DriverManager" )) ); + DriverManager::create( m_xContext ); } if (xDialog.is()) diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx index 8196944047bc..de19a6bb08d5 100644 --- a/extensions/source/abpilot/admininvokationimpl.hxx +++ b/extensions/source/abpilot/admininvokationimpl.hxx @@ -20,7 +20,7 @@ #ifndef EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX #define EXTENSIONS_ABP_ADMININVOKATIONIMPL_HXX -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -39,14 +39,14 @@ namespace abp class OAdminDialogInvokation { private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource; Window* m_pMessageParent; public: OAdminDialogInvokation( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xDataSource, Window* _pMessageParent ); diff --git a/extensions/source/abpilot/admininvokationpage.cxx b/extensions/source/abpilot/admininvokationpage.cxx index c64f5a9b1dbb..0528191f9d91 100644 --- a/extensions/source/abpilot/admininvokationpage.cxx +++ b/extensions/source/abpilot/admininvokationpage.cxx @@ -20,6 +20,7 @@ #include "admininvokationpage.hxx" #include "abspilot.hxx" #include "admininvokationimpl.hxx" +#include "comphelper/processfactory.hxx" //......................................................................... namespace abp @@ -88,7 +89,7 @@ namespace abp //--------------------------------------------------------------------- IMPL_LINK( AdminDialogInvokationPage, OnInvokeAdminDialog, void*, /*NOTINTERESTEDIN*/ ) { - OAdminDialogInvokation aInvokation( getORB(), getDialog()->getDataSource().getDataSource(), getDialog() ); + OAdminDialogInvokation aInvokation( comphelper::getComponentContext(getORB()), getDialog()->getDataSource().getDataSource(), getDialog() ); if ( aInvokation.invokeAdministration( AST_LDAP == getSettings().eType ) ) { // try to connect to this data source diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index 6ce6280753f7..199125179c2d 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -21,7 +21,9 @@ #include "addresssettings.hxx" #include "abspilot.hxx" #include <vcl/msgbox.hxx> -#include <com/sun/star/sdbc/XDriverAccess.hpp> +#include <com/sun/star/sdbc/XDriver.hpp> +#include <com/sun/star/sdbc/DriverManager.hpp> +#include <comphelper/processfactory.hxx> //......................................................................... namespace abp @@ -98,7 +100,7 @@ namespace abp bWithMozilla = true; #endif - Reference< XDriverAccess> xManager(_pParent->getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdbc.DriverManager"))), UNO_QUERY); + Reference< XDriverManager2 > xManager = DriverManager::create( comphelper::getComponentContext( _pParent->getORB() ) ); try { |