diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-02 15:03:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 14:42:52 +0200 |
commit | c25cb8a641723ab098980bb842caf75c0dc9b059 (patch) | |
tree | e264e2727309789e06147a7275b91abd05f9fcff /extensions | |
parent | 0f3f9cb63056715845d9c3565bde69470c73efb2 (diff) |
fdo#46808, Adapt task::InteractionHandler UNO service to new style
Since we don't need to expose XInitialisation, we can make the new-style
service implement XInteractionHandler2.
Change-Id: Ib27beed1c12df17592c6472d6f58c233d2c41558
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/abpilot/datasourcehandling.cxx | 8 | ||||
-rw-r--r-- | extensions/source/bibliography/datman.cxx | 7 | ||||
-rw-r--r-- | extensions/source/dbpilots/controlwizard.cxx | 8 | ||||
-rw-r--r-- | extensions/source/update/check/updatehdl.cxx | 7 |
4 files changed, 13 insertions, 17 deletions
diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index c37139b48e46..9b23732e70e9 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/sdb/XDocumentDataSource.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/uno/XNamingService.hpp> #include <comphelper/interaction.hxx> @@ -524,13 +524,12 @@ namespace abp // ................................................................ // create the interaction handler (needed for authentication and error handling) - static ::rtl::OUString s_sInteractionHandlerServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")); Reference< XInteractionHandler > xInteractions; try { xInteractions = Reference< XInteractionHandler >( - m_pImpl->xORB->createInstance( s_sInteractionHandlerServiceName ), - UNO_QUERY + InteractionHandler::createDefault(comphelper::getComponentContext(m_pImpl->xORB)), + UNO_QUERY_THROW ); } catch(const Exception&) @@ -541,6 +540,7 @@ namespace abp // failure to create the interaction handler is a serious issue ... if (!xInteractions.is()) { + ::rtl::OUString s_sInteractionHandlerServiceName(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")); if ( _pMessageParent ) ShowServiceNotAvailableError( _pMessageParent, s_sInteractionHandlerServiceName, sal_True ); return sal_False; diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 05628020b236..1146aaf64d13 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdb/XCompletedConnection.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/form/XLoadable.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/form/XGridColumnFactory.hpp> @@ -96,7 +96,6 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL) // first get the sdb::DataSource corresponding to the url Reference< XDataSource > xDataSource; // is it a favorite title ? - Reference< XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); Reference< XDatabaseContext > xNamingContext = DatabaseContext::create(xContext); if (xNamingContext->hasByName(_rURL)) @@ -120,9 +119,7 @@ Reference< XConnection > getConnection(const ::rtl::OUString& _rURL) Reference< XCompletedConnection > xComplConn(xDataSource, UNO_QUERY); try { - - Reference<XInterface> xHdl = xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")); - Reference<task::XInteractionHandler> xIHdl(xHdl, UNO_QUERY); + Reference<task::XInteractionHandler> xIHdl( task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW); xConn = xComplConn->connectWithCompletion(xIHdl); } catch (const SQLException&) diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index 47c6bb55ed48..cb5a0d4721f1 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -42,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 <com/sun/star/task/InteractionHandler.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> @@ -514,16 +515,17 @@ namespace dbp //--------------------------------------------------------------------- Reference< XInteractionHandler > OControlWizard::getInteractionHandler(Window* _pWindow) const { - const ::rtl::OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler"); Reference< XInteractionHandler > xHandler; try { - if (getServiceFactory().is()) - xHandler = Reference< XInteractionHandler >(getServiceFactory()->createInstance(sInteractionHandlerServiceName), UNO_QUERY); + xHandler = Reference< XInteractionHandler >( InteractionHandler::createDefault(comphelper::getComponentContext(getServiceFactory())), UNO_QUERY_THROW ); } catch(const Exception&) { } if (!xHandler.is()) + { + const ::rtl::OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler"); ShowServiceNotAvailableError(_pWindow, sInteractionHandlerServiceName, sal_True); + } return xHandler; } //--------------------------------------------------------------------- diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index 2dc19c9e1e61..6ee4458f411f 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -65,6 +65,7 @@ #include "com/sun/star/frame/XDesktop.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/InteractionRequestStringResolver.hpp" #include <com/sun/star/resource/XResourceBundleLoader.hpp> @@ -450,12 +451,8 @@ void SAL_CALL UpdateHandler::handle( uno::Reference< task::XInteractionRequest > throw uno::RuntimeException( UNISTRING( "UpdateHandler: unable to obtain service manager from component context" ), *this ); mxInteractionHdl = uno::Reference<task::XInteractionHandler> ( - xServiceManager->createInstanceWithContext( - UNISTRING( "com.sun.star.task.InteractionHandler" ), - mxContext), + task::InteractionHandler::createDefault(mxContext), uno::UNO_QUERY_THROW); - if( !mxInteractionHdl.is() ) - throw uno::RuntimeException( UNISTRING( "UpdateHandler:: could not get default interaction handler" ), *this ); } uno::Reference< task::XInteractionRequestStringResolver > xStrResolver = task::InteractionRequestStringResolver::create( mxContext ); |