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 | |
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
84 files changed, 370 insertions, 435 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 20b4bcd99105..f14611836c2d 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/script/XLibraryContainer2.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <com/sun/star/script/XLibraryContainerExport.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include "com/sun/star/ucb/XCommandEnvironment.hpp" @@ -1253,21 +1254,16 @@ void LibPage::ExportAsPackage( const String& aLibName ) { // file open dialog Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< task::XInteractionHandler > xHandler; - Reference< XSimpleFileAccess2 > xSFA; - Reference < XFilePicker > xFP; - if( xMSF.is() ) - { - xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY ); + Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createDefault(xContext), UNO_QUERY ); + Reference< XSimpleFileAccess2 > xSFA = SimpleFileAccess::create(xContext); - xSFA = SimpleFileAccess::create(comphelper::getProcessComponentContext()); + Reference < XFilePicker > xFP; + Sequence <Any> aServiceType(1); + aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE; + xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - Sequence <Any> aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } xFP->setTitle( String( IDEResId( RID_STR_EXPORTPACKAGE ) ) ); // filter @@ -1387,16 +1383,10 @@ void LibPage::ExportAsBasic( const String& aLibName ) { // Folder picker Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< XFolderPicker > xFolderPicker; - Reference< task::XInteractionHandler > xHandler; - if( xMSF.is() ) - { - xFolderPicker = Reference< XFolderPicker >( xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY ); - - xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY ); - } + Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XFolderPicker > xFolderPicker( xMSF->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY ); + Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); if( xFolderPicker.is() ) { diff --git a/comphelper/inc/comphelper/ihwrapnofilter.hxx b/comphelper/inc/comphelper/ihwrapnofilter.hxx index 539e41ef5921..2ac1ac93d761 100644 --- a/comphelper/inc/comphelper/ihwrapnofilter.hxx +++ b/comphelper/inc/comphelper/ihwrapnofilter.hxx @@ -20,6 +20,7 @@ #ifndef _COMPHELPER_INTERACTIONHANDLERWRAPPER_HXX_ #define _COMPHELPER_INTERACTIONHANDLERWRAPPER_HXX_ +#include <com/sun/star/task/XInteractionHandler2.hpp> #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_ #include <com/sun/star/task/XInteractionHandler.hpp> #endif @@ -36,14 +37,13 @@ #include <com/sun/star/frame/DoubleInitializationException.hpp> #endif -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.hxx> #include "comphelper/comphelperdllapi.h" namespace comphelper { - class COMPHELPER_DLLPUBLIC OIHWrapNoFilterDialog : public ::cppu::WeakImplHelper3 - < ::com::sun::star::task::XInteractionHandler - , ::com::sun::star::lang::XInitialization + class COMPHELPER_DLLPUBLIC OIHWrapNoFilterDialog : public ::cppu::WeakImplHelper2 + < ::com::sun::star::task::XInteractionHandler2 , ::com::sun::star::lang::XServiceInfo > { com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter; @@ -64,6 +64,13 @@ namespace comphelper { throw( com::sun::star::uno::RuntimeException ); //____________________________________________________________________________________________________ + // XInteractionHandler2 + //____________________________________________________________________________________________________ + + virtual sal_Bool SAL_CALL handleInteractionRequest( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest) + throw( com::sun::star::uno::RuntimeException ); + + //____________________________________________________________________________________________________ // XInitialization //____________________________________________________________________________________________________ diff --git a/comphelper/source/misc/ihwrapnofilter.cxx b/comphelper/source/misc/ihwrapnofilter.cxx index 238a2d5fb1c5..57c55d8dfde3 100644 --- a/comphelper/source/misc/ihwrapnofilter.cxx +++ b/comphelper/source/misc/ihwrapnofilter.cxx @@ -69,6 +69,26 @@ namespace comphelper } //---------------------------------------------------------------------------------------------------- + // XInteractionHandler2 + //---------------------------------------------------------------------------------------------------- + sal_Bool SAL_CALL OIHWrapNoFilterDialog::handleInteractionRequest( const uno::Reference< task::XInteractionRequest >& xRequest) + throw( com::sun::star::uno::RuntimeException ) + { + if( !m_xInter.is() ) + return sal_False; + + uno::Any aRequest = xRequest->getRequest(); + document::NoSuchFilterRequest aNoSuchFilterRequest; + if ( aRequest >>= aNoSuchFilterRequest ) + return sal_False; + else + { + m_xInter->handle( xRequest ); + return sal_True; + } + } + + //---------------------------------------------------------------------------------------------------- // XInitialization //---------------------------------------------------------------------------------------------------- void SAL_CALL OIHWrapNoFilterDialog::initialize( const uno::Sequence< uno::Any >& ) diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index a0f8bc515db1..7f48e14a68c1 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -201,7 +201,7 @@ namespace dbtools const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext) SAL_THROW ( (::com::sun::star::sdbc::SQLException) ); diff --git a/connectivity/inc/connectivity/virtualdbtools.hxx b/connectivity/inc/connectivity/virtualdbtools.hxx index dafaa45c4988..0f6f6520ed7b 100644 --- a/connectivity/inc/connectivity/virtualdbtools.hxx +++ b/connectivity/inc/connectivity/virtualdbtools.hxx @@ -120,7 +120,7 @@ namespace connectivity const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ) = 0; virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset( diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index 4674fe4d2571..e5800bc9dc4d 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -55,7 +55,7 @@ #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XKeysSupplier.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/task/XInteractionRequest.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/uno/XNamingService.hpp> @@ -279,9 +279,9 @@ Reference< XConnection > getConnection_allowException( const ::rtl::OUString& _rsTitleOrPath, const ::rtl::OUString& _rsUser, const ::rtl::OUString& _rsPwd, - const Reference< XMultiServiceFactory>& _rxFactory) + const Reference< XComponentContext>& _rxContext) { - Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, comphelper::getComponentContext(_rxFactory)) ); + Reference< XDataSource> xDataSource( getDataSource_allowException(_rsTitleOrPath, _rxContext) ); Reference<XConnection> xConnection; if (xDataSource.is()) { @@ -306,12 +306,9 @@ Reference< XConnection > getConnection_allowException( Reference<XCompletedConnection> xConnectionCompletion(xProp, UNO_QUERY); if (xConnectionCompletion.is()) { // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(_rxFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler"))), UNO_QUERY); - OSL_ENSURE(xHandler.is(), "dbtools::getConnection service com.sun.star.task.InteractionHandler not available!"); - if (xHandler.is()) - { - xConnection = xConnectionCompletion->connectWithCompletion(xHandler); - } + Reference< XInteractionHandler > xHandler( + InteractionHandler::createDefault(_rxContext), UNO_QUERY_THROW ); + xConnection = xConnectionCompletion->connectWithCompletion(xHandler); } } else @@ -325,13 +322,13 @@ Reference< XConnection > getConnection_allowException( //------------------------------------------------------------------------------ Reference< XConnection> getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName, - const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) + const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, const Reference< XComponentContext>& _rxContext) SAL_THROW ( (SQLException) ) { Reference< XConnection > xReturn; try { - xReturn = getConnection_allowException(_rDataSourceName, _rUser, _rPwd, _rxFactory); + xReturn = getConnection_allowException(_rDataSourceName, _rUser, _rPwd, _rxContext); } catch(SQLException&) { @@ -350,12 +347,12 @@ Reference< XConnection> getConnection( const ::rtl::OUString& _rsTitleOrPath, const ::rtl::OUString& _rsUser, const ::rtl::OUString& _rsPwd, - const Reference< XMultiServiceFactory>& _rxFactory) + const Reference< XComponentContext>& _rxContext) { Reference< XConnection > xReturn; try { - xReturn = getConnection_allowException(_rsTitleOrPath, _rsUser, _rsPwd, _rxFactory); + xReturn = getConnection_allowException(_rsTitleOrPath, _rsUser, _rsPwd, _rxContext); } catch(Exception&) { @@ -434,7 +431,7 @@ SharedConnection lcl_connectRowSet(const Reference< XRowSet>& _rxRowSet, const R if (hasProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD), xRowSetProps)) xRowSetProps->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_PASSWORD)) >>= sPwd; - xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, _rxFactory ); + xPureConnection = getConnection_allowException( sDataSourceName, sUser, sPwd, comphelper::getComponentContext(_rxFactory) ); } else if (!sURL.isEmpty()) { // the row set has no data source, but a connection url set diff --git a/connectivity/source/simpledbt/staticdbtools_s.cxx b/connectivity/source/simpledbt/staticdbtools_s.cxx index 797555c0c996..1d8939052326 100644 --- a/connectivity/source/simpledbt/staticdbtools_s.cxx +++ b/connectivity/source/simpledbt/staticdbtools_s.cxx @@ -84,9 +84,9 @@ namespace connectivity //---------------------------------------------------------------- Reference< XConnection> ODataAccessStaticTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser, - const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) const SAL_THROW ( (SQLException) ) + const ::rtl::OUString& _rPwd, const Reference< XComponentContext>& _rxContext) const SAL_THROW ( (SQLException) ) { - return ::dbtools::getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxFactory); + return ::dbtools::getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxContext); } //---------------------------------------------------------------- diff --git a/connectivity/source/simpledbt/staticdbtools_s.hxx b/connectivity/source/simpledbt/staticdbtools_s.hxx index 3132f00e36b4..a8597209084b 100644 --- a/connectivity/source/simpledbt/staticdbtools_s.hxx +++ b/connectivity/source/simpledbt/staticdbtools_s.hxx @@ -70,7 +70,7 @@ namespace connectivity const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ); // ------------------------------------------------ diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index f0158b61ec1d..95b2eb13f0d5 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/embed/XInsertObjectDialog.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include "insdlg.hxx" #include <dialmgr.hxx> @@ -341,24 +341,13 @@ short SvInsertOleDlg::Execute() aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); aMedium[0].Value <<= ::rtl::OUString( aFileName ); - uno::Reference< task::XInteractionHandler > xInteraction; - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - xInteraction = uno::Reference< task::XInteractionHandler >( - xFactory->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), - uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference< task::XInteractionHandler > xInteraction( + task::InteractionHandler::createDefault(xContext), + uno::UNO_QUERY_THROW ); - if ( xInteraction.is() ) - { - aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ); - aMedium[1].Value <<= xInteraction; - } - else - { - OSL_FAIL( "Can not get InteractionHandler!\n" ); - aMedium.realloc( 1 ); - } + aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ); + aMedium[1].Value <<= xInteraction; // create object from media descriptor if ( bLink ) diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index 0bfdd2527cbf..5b4ca5fcb09f 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -29,6 +29,7 @@ #include <dialmgr.hxx> #include <cuires.hrc> #include <sal/macros.h> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/PasswordContainer.hpp> #include <com/sun/star/task/UrlRecord.hpp> #include <com/sun/star/task/XPasswordContainer2.hpp> @@ -187,9 +188,8 @@ void WebConnectionInfoDialog::FillPasswordList() if ( xMasterPasswd->isPersistentStoringAllowed() ) { uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY_THROW ); + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW); uno::Sequence< task::UrlRecord > aURLEntries = xMasterPasswd->getAllPersistent( xInteractionHandler ); sal_Int32 nCount = 0; @@ -297,9 +297,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl) uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.InteractionHandler" ) ) ), + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW ); xInteractionHandler->handle( rRequest ); diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index 4ca37127c2ca..717661d57e46 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/ucb/InteractiveIOException.hpp> #include <com/sun/star/ucb/IOErrorCode.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <basic/basmgr.hxx> @@ -362,7 +363,7 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin ::comphelper::NamedValueCollection aArgs; aArgs.put( "URL", _sURL ); aArgs.put( "MacroExecutionMode", MacroExecMode::USE_CONFIG ); - aArgs.put( "InteractionHandler", m_aContext.createComponent( "com.sun.star.task.InteractionHandler" ) ); + aArgs.put( "InteractionHandler", task::InteractionHandler::createDefault(m_aContext.getUNOContext()) ); Sequence< PropertyValue > aResource( aArgs.getPropertyValues() ); xLoad->load( aResource ); diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 4593269de978..fd1ded798872 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -68,7 +68,7 @@ #include "intercept.hxx" #include <com/sun/star/sdb/ErrorCondition.hpp> #include <com/sun/star/sdb/XInteractionDocumentSave.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/sdb/DocumentSaveRequest.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/MacroExecMode.hpp> @@ -1301,9 +1301,8 @@ sal_Bool ODocumentDefinition::save(sal_Bool _bApprove) pRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler( m_aContext.createComponent( (::rtl::OUString)SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); - if ( xHandler.is() ) - xHandler->handle(xRequest); + Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(m_aContext.getUNOContext()), UNO_QUERY_THROW ); + xHandler->handle(xRequest); if ( pAbort->wasSelected() ) return sal_False; @@ -1376,9 +1375,8 @@ sal_Bool ODocumentDefinition::saveAs() pRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler(m_aContext.createComponent(::rtl::OUString(SERVICE_TASK_INTERACTION_HANDLER)), UNO_QUERY); - if ( xHandler.is() ) - xHandler->handle(xRequest); + Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(m_aContext.getUNOContext()), UNO_QUERY_THROW); + xHandler->handle(xRequest); if ( pAbort->wasSelected() ) return sal_False; diff --git a/dbaccess/source/ext/macromigration/docinteraction.cxx b/dbaccess/source/ext/macromigration/docinteraction.cxx index d0554ed0c3cd..f2f9dc5938fd 100644 --- a/dbaccess/source/ext/macromigration/docinteraction.cxx +++ b/dbaccess/source/ext/macromigration/docinteraction.cxx @@ -21,6 +21,7 @@ #include "docinteraction.hxx" #include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/DocumentPasswordRequest.hpp> #include <comphelper/componentcontext.hxx> @@ -65,7 +66,7 @@ namespace dbmm } InteractionHandler_Data( const ::comphelper::ComponentContext& _rContext ) - :xHandler( _rContext.createComponent( "com.sun.star.task.InteractionHandler" ), UNO_QUERY_THROW ) + :xHandler( ::com::sun::star::task::InteractionHandler::createDefault(_rContext.getUNOContext()), UNO_QUERY_THROW ) { } }; diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index 8b2d3939b767..52562d997540 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/sdb/XDocumentDataSource.hpp> #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> @@ -428,9 +429,8 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: // not touch it. if ( !aMediaDesc.has( "InteractionHandler" ) ) { - Reference< XInteractionHandler > xHandler; - if ( m_aContext.createComponent( "com.sun.star.task.InteractionHandler", xHandler ) ) - aMediaDesc.put( "InteractionHandler", xHandler ); + Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(m_aContext.getUNOContext()), UNO_QUERY_THROW ); + aMediaDesc.put( "InteractionHandler", xHandler ); } // it's allowed to pass an existing document diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc index d24bdffa7710..d8a9ceb6ff8d 100644 --- a/dbaccess/source/inc/stringconstants.hrc +++ b/dbaccess/source/inc/stringconstants.hrc @@ -372,7 +372,6 @@ DECLARE_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES); DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERIES); DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER); DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL); -DECLARE_CONSTASCII_USTRING(SERVICE_TASK_INTERACTION_HANDLER); DECLARE_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP); DECLARE_CONSTASCII_USTRING(SERVICE_UI_FOLDERPICKER); DECLARE_CONSTASCII_USTRING(SERVICE_I18N_COLLATOR); diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc index 515ab6748b7c..133a06038360 100644 --- a/dbaccess/source/inc/stringconstants.inc +++ b/dbaccess/source/inc/stringconstants.inc @@ -211,7 +211,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER, "com.sun.star.sdbc.Driv IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL, "com.sun.star.sdbc.ConnectionPool"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_INDEXCOLUMN, "com.sun.star.sdbcx.IndexColumn"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_KEYCOLUMN, "com.sun.star.sdbcx.KeyColumn"); -IMPLEMENT_CONSTASCII_USTRING(SERVICE_TASK_INTERACTION_HANDLER, "com.sun.star.task.InteractionHandler"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP, "com.sun.star.frame.Desktop"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_UI_FOLDERPICKER, "com.sun.star.ui.dialogs.FolderPicker"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_I18N_COLLATOR, "com.sun.star.i18n.Collator"); diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index c918fa04a3b8..d03cd2abd0bd 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -57,7 +57,7 @@ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/sdbcx/XRowLocate.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/uno/TypeClass.hpp> #include <com/sun/star/util/NumberFormatter.hpp> #include <com/sun/star/util/XCancellable.hpp> @@ -1471,9 +1471,8 @@ sal_Bool SbaXDataBrowserController::approveParameter(const ::com::sun::star::for pParamRequest->addContinuation(pAbort); // create the handler, let it handle the request - Reference< XInteractionHandler > xHandler(getORB()->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); - if (xHandler.is()) - xHandler->handle(xParamRequest); + Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(comphelper::ComponentContext(getORB()).getUNOContext()), UNO_QUERY_THROW); + xHandler->handle(xParamRequest); if (!pParamValues->wasSelected()) { // canceled diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 2b47defe48ad..23148ba2a812 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -84,12 +84,14 @@ #include <com/sun/star/sdbcx/XDrop.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdbcx/XViewsSupplier.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/util/XFlushable.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/ui/XContextMenuInterceptor.hpp> +#include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> @@ -3528,11 +3530,9 @@ void SbaTableQueryBrowser::implAdministrate( SvLBoxEntry* _pApplyTo ) if ( xDocumentModel.is() ) { - Reference< XInteractionHandler > xInteractionHandler( - getORB()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), - UNO_QUERY ); - OSL_ENSURE( xInteractionHandler.is(), "SbaTableQueryBrowser::implAdministrate: no interaction handler available!" ); + Reference< XInteractionHandler2 > xInteractionHandler( + InteractionHandler::createDefault(comphelper::getComponentContext(getORB())), + UNO_QUERY_THROW ); ::comphelper::NamedValueCollection aLoadArgs; aLoadArgs.put( "Model", xDocumentModel ); diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 5dd965614e77..3c11de710096 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -23,6 +23,7 @@ #include <tools/diagnose_ex.h> #include "moduledbu.hxx" #include "dbu_dlg.hrc" +#include <comphelper/processfactory.hxx> #include <comphelper/interaction.hxx> #include <cppuhelper/exc_hlp.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -38,7 +39,7 @@ #include <com/sun/star/container/XHierarchicalNameContainer.hpp> #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> #include <com/sun/star/ucb/IOErrorCode.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/sdbc/SQLException.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -169,23 +170,22 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click) InteractiveAugmentedIOException aException(sTemp,Reference<XInterface>(),eClass,eError,aValues); - Reference<XInitialization> xIni(m_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler"))),UNO_QUERY); - if ( xIni.is() ) - { - aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent")); - aValue.Value <<= VCLUnoHelper::GetInterface( this ); - Sequence< Any > aArgs(1); - aArgs[0] <<= makeAny(aValue); - xIni->initialize(aArgs); - OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aException)); - Reference< XInteractionRequest > xRequest(pRequest); + Reference<XInitialization> xIni( + InteractionHandler::createDefault(comphelper::getComponentContext(m_xORB)), UNO_QUERY_THROW); + aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent")); + aValue.Value <<= VCLUnoHelper::GetInterface( this ); + Sequence< Any > aArgs(1); + aArgs[0] <<= makeAny(aValue); + xIni->initialize(aArgs); + OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aException)); + Reference< XInteractionRequest > xRequest(pRequest); - OInteractionApprove* pApprove = new OInteractionApprove; - pRequest->addContinuation(pApprove); + OInteractionApprove* pApprove = new OInteractionApprove; + pRequest->addContinuation(pApprove); + + Reference< XInteractionHandler > xHandler(xIni,UNO_QUERY); + xHandler->handle(xRequest); - Reference< XInteractionHandler > xHandler(xIni,UNO_QUERY); - xHandler->handle(xRequest); - } return 0; } } diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 26b32f24a33a..f3cab0081558 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> #include "UITools.hxx" #include <unotools/localfilehelper.hxx> @@ -71,6 +71,7 @@ #endif //_ADO_DATALINK_BROWSE_ #include <com/sun/star/mozilla/XMozillaBootstrap.hpp> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> @@ -522,8 +523,8 @@ DBG_NAME(OConnectionHelper) ::ucbhelper::Content aCheckExistence; sal_Bool bExists = sal_False; IS_PATH_EXIST eExists = PATH_NOT_EXIST; - Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = Reference< ::com::sun::star::task::XInteractionHandler >( - m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY ); + Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler( + task::InteractionHandler::createDefault(comphelper::getComponentContext(m_xORB)), UNO_QUERY_THROW ); OFilePickerInteractionHandler* pHandler = new OFilePickerInteractionHandler(xInteractionHandler); xInteractionHandler = pHandler; diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index 2150c6b283a3..30118af634d3 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/XDriver.hpp> #include <com/sun/star/sdbc/XDriverAccess.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> #include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp> #include <com/sun/star/ucb/AuthenticationRequest.hpp> @@ -255,9 +255,7 @@ sal_Bool ODbDataSourceAdministrationHelper::getCurrentSettings(Sequence< Propert if ( !xHandler.is() ) { // instantiate the default SDB interaction handler - xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); - if ( !xHandler.is() ) - ShowServiceNotAvailableError(m_pParent->GetParent(), String(SERVICE_TASK_INTERACTION_HANDLER), sal_True); + xHandler = Reference< XInteractionHandler >( task::InteractionHandler::createDefault(comphelper::getComponentContext(m_xORB)), UNO_QUERY_THROW ); } String sName = pName ? pName->GetValue() : String(); diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 9f05b4e298d9..dfdb2e26bb1e 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -70,6 +70,7 @@ #include <com/sun/star/sdbc/XDriverAccess.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/ucb/IOErrorCode.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XInteractionHandler2.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -734,7 +735,7 @@ namespace //------------------------------------------------------------------------- sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() { - Reference< XInteractionHandler2 > xHandler( getORB()->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); + Reference< XInteractionHandler2 > xHandler( InteractionHandler::createDefault(comphelper::getComponentContext(getORB())), UNO_QUERY_THROW ); try { if (callSaveAsDialog() == sal_True) @@ -993,9 +994,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument() m_xDesktop.set( _rxORB->createInstance( SERVICE_FRAME_DESKTOP ), UNO_QUERY_THROW ); m_xFrameLoader.set( m_xDesktop, UNO_QUERY_THROW ); m_xInteractionHandler.set( - _rxORB->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) - ), + InteractionHandler::createDefault(comphelper::getComponentContext(_rxORB)), UNO_QUERY_THROW ); } catch( const Exception& ) diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 8f76496d7ea4..3259a87d3f28 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -48,6 +48,7 @@ #include <svtools/imgdef.hxx> #include "TablesSingleDlg.hxx" #include <tools/diagnose_ex.h> +#include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> #include "AutoControls.hrc" @@ -310,7 +311,7 @@ DBG_NAME(OTableSubscriptionPage) xProp->setPropertyValue( PROPERTY_TABLETYPEFILTER, makeAny( Sequence< ::rtl::OUString >() ) ); Reference< ::com::sun::star::lang::XEventListener> xEvt; - aErrorInfo = ::dbaui::createConnection(xProp,m_xORB,xEvt,m_xCurrentConnection); + aErrorInfo = ::dbaui::createConnection(xProp,comphelper::getComponentContext(m_xORB),xEvt,m_xCurrentConnection); xProp->setPropertyValue(PROPERTY_TABLEFILTER,aTableFilter); xProp->setPropertyValue(PROPERTY_TABLETYPEFILTER,aTableTypeFilter); diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 574b3ad231e7..df0c4b18b675 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -80,7 +80,7 @@ namespace dbaui /** creates a new connection and appends the eventlistener @param _rsDataSourceName name of the datasource @param _xDatabaseContext the database context - @param _rMF the multi service factory + @param _rxContext the UNO component context @param _rEvtLst the eventlistener which will be added to the new created connection @param _rOUTConnection this parameter will be filled with the new created connection @return SQLExceptionInfo contains a SQLException, SQLContext or a SQLWarning when they araised else .isValid() will return false @@ -88,19 +88,19 @@ namespace dbaui ::dbtools::SQLExceptionInfo createConnection( const ::rtl::OUString& _rsDataSourceName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xDatabaseContext, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rMF, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rEvtLst, ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rOUTConnection ); /** creates a new connection and appends the eventlistener @param _xDataSource the datasource - @param _rMF the multi service factory + @param _rxContext the UNO component context @param _rEvtLst the eventlistener which will be added to the new created connection @param _rOUTConnection this parameter will be filled with the new created connection @return SQLExceptionInfo contains a SQLException, SQLContext or a SQLWarning when they araised else .isValid() will return false */ ::dbtools::SQLExceptionInfo createConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xDataSource, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rMF, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rEvtLst, ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rOUTConnection ); diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 16615e4c478b..90522f2e8f80 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -281,7 +281,7 @@ void ODatabaseImportExport::initialize() Reference< XEventListener> xEvt((::cppu::OWeakObject*)this,UNO_QUERY); Reference< XConnection > xConnection; - SQLExceptionInfo aInfo = ::dbaui::createConnection( m_sDataSourceName, xDatabaseContext, m_xFactory, xEvt, xConnection ); + SQLExceptionInfo aInfo = ::dbaui::createConnection( m_sDataSourceName, xDatabaseContext, comphelper::getComponentContext(m_xFactory), xEvt, xConnection ); m_xConnection.reset( xConnection ); if(aInfo.isValid() && aInfo.getType() == SQLExceptionInfo::SQL_EXCEPTION) diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 0ac020f5e792..a705c8b7dcdf 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -42,7 +42,7 @@ #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #include <com/sun/star/sdbc/XResultSetMetaData.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XContent.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -138,7 +138,7 @@ using ::com::sun::star::frame::XModel; // ----------------------------------------------------------------------------- SQLExceptionInfo createConnection( const ::rtl::OUString& _rsDataSourceName, const Reference< ::com::sun::star::container::XNameAccess >& _xDatabaseContext, - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rMF, + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, Reference< ::com::sun::star::lang::XEventListener>& _rEvtLst, Reference< ::com::sun::star::sdbc::XConnection>& _rOUTConnection ) { @@ -152,11 +152,11 @@ SQLExceptionInfo createConnection( const ::rtl::OUString& _rsDataSourceName, } SQLExceptionInfo aInfo; - return createConnection(xProp,_rMF,_rEvtLst,_rOUTConnection); + return createConnection(xProp,_rxContext,_rEvtLst,_rOUTConnection); } // ----------------------------------------------------------------------------- SQLExceptionInfo createConnection( const Reference< ::com::sun::star::beans::XPropertySet>& _xDataSource, - const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rMF, + const Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, Reference< ::com::sun::star::lang::XEventListener>& _rEvtLst, Reference< ::com::sun::star::sdbc::XConnection>& _rOUTConnection ) { @@ -192,14 +192,8 @@ SQLExceptionInfo createConnection( const Reference< ::com::sun::star::beans::XP } else { // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(_rMF->createInstance(SERVICE_TASK_INTERACTION_HANDLER), UNO_QUERY); - if (!xHandler.is()) - { - OSL_FAIL("createConnection: could not instantiate an interaction handler!"); - // TODO: a real parent! - } - else - _rOUTConnection = xConnectionCompletion->connectWithCompletion(xHandler); + Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(_rxContext), UNO_QUERY_THROW); + _rOUTConnection = xConnectionCompletion->connectWithCompletion(xHandler); } } else diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 025e7d14cef1..c63f77ce1ad9 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdbcx/XViewsSupplier.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <comphelper/extract.hxx> #include <comphelper/processfactory.hxx> @@ -683,7 +684,7 @@ OCopyTableWizard::OCopyTableWizard( Window* pParent, const ::rtl::OUString& _rDe ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aTypeInfo, m_aTypeInfoIndex ); ::dbaui::fillTypeInfo( _xConnection, m_sTypeNames, m_aDestTypeInfo, m_aDestTypeInfoIndex ); - m_xInteractionHandler.set( m_xFactory->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY); + m_xInteractionHandler.set( InteractionHandler::createDefault(comphelper::getComponentContext(m_xFactory)), UNO_QUERY_THROW ); OCopyTable* pPage1( new OCopyTable( this ) ); pPage1->disallowViews(); diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx index 38a84b5451d9..4f1b4af83014 100644 --- a/dbaccess/source/ui/misc/datasourceconnector.cxx +++ b/dbaccess/source/ui/misc/datasourceconnector.cxx @@ -24,11 +24,12 @@ #include <com/sun/star/sdbc/XWarningsSupplier.hpp> #include <com/sun/star/beans/XPropertySet.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/frame/XModel.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/SQLWarning.hpp> #include <osl/thread.h> +#include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> #include <comphelper/namedvaluecollection.hxx> #include <connectivity/dbexception.hxx> @@ -138,15 +139,10 @@ namespace dbaui if ( !xHandler.is() ) { // instantiate the default SDB interaction handler - xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_TASK_INTERACTION_HANDLER ), UNO_QUERY ); - if ( !xHandler.is() ) - ShowServiceNotAvailableError(m_pErrorMessageParent, (::rtl::OUString)SERVICE_TASK_INTERACTION_HANDLER, sal_True); + xHandler = Reference< XInteractionHandler >( InteractionHandler::createDefault(comphelper::getComponentContext(m_xORB)), UNO_QUERY_THROW ); } - if ( xHandler.is() ) - { - xConnection = xConnectionCompletion->connectWithCompletion(xHandler); - } + xConnection = xConnectionCompletion->connectWithCompletion(xHandler); } else { diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index 820569a903af..d41a4967ddce 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/XDocumentDataSource.hpp> @@ -102,6 +102,7 @@ namespace dbaui using ::com::sun::star::sdbc::XDataSource; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::container::XChild; + using ::com::sun::star::task::InteractionHandler; using ::com::sun::star::task::XInteractionHandler; using ::com::sun::star::frame::XModel; using ::com::sun::star::sdb::DatabaseContext; @@ -1553,7 +1554,7 @@ void SAL_CALL CopyTableWizard::initialize( const Sequence< Any >& _rArguments ) ); } if ( !m_xInteractionHandler.is() ) - m_xInteractionHandler.set( m_aContext.createComponent( "com.sun.star.task.InteractionHandler" ), UNO_QUERY_THROW ); + m_xInteractionHandler.set( InteractionHandler::createDefault(m_aContext.getUNOContext()), UNO_QUERY_THROW ); InteractionHandler xSourceDocHandler; Reference< XPropertySet > xSourceDescriptor( impl_ensureDataAccessDescriptor_throw( _rArguments, 0, m_xSourceConnection, xSourceDocHandler ) ); diff --git a/dbaccess/source/ui/uno/dbinteraction.cxx b/dbaccess/source/ui/uno/dbinteraction.cxx index 0b31334810f7..4a8d80fb4230 100644 --- a/dbaccess/source/ui/uno/dbinteraction.cxx +++ b/dbaccess/source/ui/uno/dbinteraction.cxx @@ -25,6 +25,7 @@ #include <vcl/msgbox.hxx> #include <connectivity/dbexception.hxx> #include "sqlmessage.hxx" +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/task/XInteractionDisapprove.hpp> #include <com/sun/star/task/XInteractionRetry.hpp> @@ -38,6 +39,7 @@ #include <osl/mutex.hxx> #include "CollectionView.hxx" #include "UITools.hxx" +#include <comphelper/processfactory.hxx> //========================================================================== @@ -304,7 +306,7 @@ namespace dbaui { Reference< XInteractionHandler > xFallbackHandler; if ( m_xORB.is() ) - xFallbackHandler = xFallbackHandler.query( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ) ); + xFallbackHandler = xFallbackHandler.query( InteractionHandler::createDefault(comphelper::getComponentContext(m_xORB)) ); if ( xFallbackHandler.is() ) { xFallbackHandler->handle( _rxRequest ); diff --git a/dbaccess/source/ui/uno/dbinteraction.hxx b/dbaccess/source/ui/uno/dbinteraction.hxx index 216c566d1101..f5e7496de485 100644 --- a/dbaccess/source/ui/uno/dbinteraction.hxx +++ b/dbaccess/source/ui/uno/dbinteraction.hxx @@ -73,6 +73,9 @@ namespace dbaui const bool i_bFallbackToGeneric ); + // XInitialization + void SAL_CALL initialize( com::sun::star::uno::Sequence< com::sun::star::uno::Any > const & /*rArguments*/) throw (com::sun::star::uno::Exception) {} + // XInteractionHandler2 virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw (::com::sun::star::uno::RuntimeException); diff --git a/desktop/source/app/configinit.cxx b/desktop/source/app/configinit.cxx index 393a755ea96b..66b1c6e3d4d0 100644 --- a/desktop/source/app/configinit.cxx +++ b/desktop/source/app/configinit.cxx @@ -36,6 +36,7 @@ #include <rtl/ustrbuf.hxx> #include <osl/diagnose.h> #include <stdio.h> +#include <com/sun/star/task/InteractionHandler.hpp> // ---------------------------------------------------------------------------- @@ -45,7 +46,6 @@ using rtl::OUString; using uno::UNO_QUERY; // ---------------------------------------------------------------------------- -static char const CONFIGURATION_ERROR_HANDLER[] = "com.sun.star.configuration.backend.InteractionHandler"; // must be aligned with configmgr/source/misc/configinteractionhandler static char const CONFIG_ERROR_HANDLER[] = "configuration.interaction-handler"; @@ -164,17 +164,8 @@ void ConfigurationErrorHandler::deactivate() ConfigurationErrorHandler::InteractionHandler ConfigurationErrorHandler::getDefaultInteractionHandler() { - uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - - OSL_ENSURE( xServiceManager.is(),"No ServiceManager set for ConfigurationErrorHandler"); - - InteractionHandler xHandler; - - if (xServiceManager.is()) - { - xHandler.set( xServiceManager->createInstance(k_ERRORHANDLER), UNO_QUERY ); - } - + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + InteractionHandler xHandler( com::sun::star::task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); return xHandler; } //------------------------------------------------------------------------------ diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 1ed73d59f48f..091d48465205 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -41,7 +41,7 @@ #include <comphelper/synchronousdispatch.hxx> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/util/CloseVetoException.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/container/XEnumeration.hpp> @@ -73,6 +73,7 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::view; +using namespace ::com::sun::star::task; namespace desktop { @@ -226,9 +227,9 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch } else { - Reference < com::sun::star::task::XInteractionHandler > xInteraction( - ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")) ), - com::sun::star::uno::UNO_QUERY ); + Reference < XInteractionHandler > xInteraction( + InteractionHandler::createDefault(::comphelper::getProcessComponentContext()), + UNO_QUERY_THROW ); aArgs[1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); aArgs[1].Value <<= xInteraction; diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 323778d4c642..b52478146734 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -50,6 +50,7 @@ #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" +#include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/XAbortChannel.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" @@ -536,10 +537,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & handlerArgs[ 0 ] <<= beans::PropertyValue( OUSTR("Context"), -1, uno::Any( m_sTitle ), beans::PropertyState_DIRECT_VALUE ); - m_xHandler.set( m_xContext->getServiceManager() - ->createInstanceWithArgumentsAndContext( - OUSTR("com.sun.star.uui.InteractionHandler"), - handlerArgs, m_xContext ), uno::UNO_QUERY_THROW ); + m_xHandler.set( task::InteractionHandler::createWithParentAndContext(m_xContext, NULL, m_sTitle), uno::UNO_QUERY_THROW ); } m_xHandler->handle( xRequest ); } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 88deb2042ad0..107e7b6017cd 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -66,6 +66,7 @@ #include "com/sun/star/lang/XSingleServiceFactory.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/system/SystemShellExecute.hpp" +#include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/XAbortChannel.hpp" #include "com/sun/star/task/XJob.hpp" #include "com/sun/star/ucb/CommandAbortedException.hpp" @@ -272,16 +273,10 @@ UpdateDialog::Thread::Thread( { if( m_context.is() ) { - uno::Reference< lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); - - if( xServiceManager.is() ) - { - m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( - xServiceManager->createInstanceWithContext( OUSTR( "com.sun.star.task.InteractionHandler" ), m_context), - uno::UNO_QUERY ); - if ( m_xInteractionHdl.is() ) - m_updateInformation->setInteractionHandler( m_xInteractionHdl ); - } + m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( + task::InteractionHandler::createDefault(m_context), + uno::UNO_QUERY_THROW ); + m_updateInformation->setInteractionHandler( m_xInteractionHdl ); } } diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 956d638679ad..1a8f290d0f59 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -58,7 +58,7 @@ #include <com/sun/star/embed/EmbedMapUnits.hpp> #include <com/sun/star/embed/XVisualObject.hpp> #include <com/sun/star/document/MacroExecMode.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <osl/diagnose.h> #include <rtl/process.h> @@ -114,9 +114,8 @@ void DocumentHolder::LoadDocInFrame( sal_Bool bPluginMode ) if( xComponentLoader.is() && m_xDocument.is() ) { uno::Reference< task::XInteractionHandler > xHandler( - m_xFactory->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY ); + task::InteractionHandler::create(comphelper::getComponentContext(m_xFactory)), + uno::UNO_QUERY_THROW ); uno::Any aAny; sal_Int32 nLen = 3; 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 ); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index e46728396089..670e615df960 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -32,7 +32,7 @@ #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/xml/XImportFilter.hpp> #include <com/sun/star/xml/XExportFilter.hpp> @@ -424,8 +424,8 @@ void XMLFilterTestDialog::onExportBrowse() maExportRecentFile = aDlg.GetPath(); Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - Reference< XInteractionHandler > xInter( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" )) ), UNO_QUERY ); - if( xLoader.is() && xInter.is() ) + Reference< XInteractionHandler > xInter( InteractionHandler::createDefault(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW ); + if( xLoader.is() ) { OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); Sequence< PropertyValue > aArguments(1); @@ -619,8 +619,8 @@ void XMLFilterTestDialog::import( const OUString& rURL ) try { Reference< XComponentLoader > xLoader( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), UNO_QUERY ); - Reference< XInteractionHandler > xInter( mxMSF->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" )) ), UNO_QUERY ); - if( xLoader.is() && xInter.is() ) + Reference< XInteractionHandler > xInter( InteractionHandler::createDefault(comphelper::getComponentContext(mxMSF)), UNO_QUERY_THROW ); + if( xLoader.is() ) { OUString aFrame( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ); diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index 9d487cc3c9e9..902ba9cffaf5 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <ucbhelper/content.hxx> using namespace com::sun::star::uno; @@ -129,9 +130,8 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH if( _xHandler.is() ) pHelper->m_aInteractionHandler = _xHandler; else - pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY); - OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); + pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >( + InteractionHandler::createDefault(m_xContext), UNO_QUERY_THROW); CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; pHelper->m_aProgressHandler = Reference< XProgressHandler >(pProgressHelper); diff --git a/forms/source/xforms/submission/submission.hxx b/forms/source/xforms/submission/submission.hxx index 37e0e07d7a58..eb921bc74d98 100644 --- a/forms/source/xforms/submission/submission.hxx +++ b/forms/source/xforms/submission/submission.hxx @@ -123,7 +123,7 @@ protected: CSS::uno::Reference< CSS::xml::xpath::XXPathObject > m_aXPathObject; CSS::uno::Reference< CSS::xml::dom::XDocumentFragment > m_aFragment; CSS::uno::Reference< CSS::io::XInputStream > m_aResultStream; - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; + CSS::uno::Reference< CSS::uno::XComponentContext > m_xContext; rtl::OUString m_aEncoding; ::std::auto_ptr< CSerialization > createSerialization(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler @@ -142,7 +142,7 @@ public: CSubmission(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment) : m_aURLObj(aURL) , m_aFragment(aFragment) - , m_aFactory(::comphelper::getProcessServiceFactory()) + , m_xContext(::comphelper::getProcessComponentContext()) {} virtual ~CSubmission() {} diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx index 9ae7b6803cc9..156972404302 100644 --- a/forms/source/xforms/submission/submission_get.cxx +++ b/forms/source/xforms/submission/submission_get.cxx @@ -39,6 +39,7 @@ #include <comphelper/processfactory.hxx> #include <ucbhelper/content.hxx> #include <com/sun/star/io/Pipe.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> using namespace CSS::uno; using namespace CSS::ucb; @@ -72,9 +73,8 @@ CSubmission::SubmissionResult CSubmissionGet::submit(const CSS::uno::Reference< if( aInteractionHandler.is() ) pHelper->m_aInteractionHandler = aInteractionHandler; else - pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >(m_aFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler"))), UNO_QUERY); - OSL_ENSURE(pHelper->m_aInteractionHandler.is(), "failed to create IntreractionHandler"); + pHelper->m_aInteractionHandler = CSS::uno::Reference< XInteractionHandler >( + CSS::task::InteractionHandler::createDefault(m_xContext), UNO_QUERY_THROW); CProgressHandlerHelper *pProgressHelper = new CProgressHandlerHelper; pHelper->m_aProgressHandler = CSS::uno::Reference< XProgressHandler >(pProgressHelper); @@ -98,8 +98,8 @@ CSubmission::SubmissionResult CSubmissionGet::submit(const CSS::uno::Reference< aUTF8QueryURL.append(aQueryString.makeStringAndClear()); } OUString aQueryURL = OStringToOUString(aUTF8QueryURL.makeStringAndClear(), RTL_TEXTENCODING_UTF8); - ucbhelper::Content aContent(aQueryURL, aEnvironment, comphelper::getComponentContext(m_aFactory)); - CSS::uno::Reference< XOutputStream > aPipe( CSS::io::Pipe::create(comphelper::getComponentContext(m_aFactory)), UNO_QUERY_THROW ); + ucbhelper::Content aContent(aQueryURL, aEnvironment, m_xContext); + CSS::uno::Reference< XOutputStream > aPipe( CSS::io::Pipe::create(m_xContext), UNO_QUERY_THROW ); aContent.openStream(aPipe); // get reply try { diff --git a/forms/source/xforms/submission/submission_get.hxx b/forms/source/xforms/submission/submission_get.hxx index fe7cde8ba984..2e5e6038edcb 100644 --- a/forms/source/xforms/submission/submission_get.hxx +++ b/forms/source/xforms/submission/submission_get.hxx @@ -20,14 +20,14 @@ #ifndef __SUBMISSION_GET_HXX #define __SUBMISSION_GET_HXX -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include "submission.hxx" class CSubmissionGet : public CSubmission { private: - CSS::uno::Reference< CSS::lang::XMultiServiceFactory > m_aFactory; + CSS::uno::Reference< CSS::uno::XComponentContext > m_xContext; public: CSubmissionGet(const rtl::OUString& aURL, const CSS::uno::Reference< CSS::xml::dom::XDocumentFragment >& aFragment); virtual SubmissionResult submit(const CSS::uno::Reference< CSS::task::XInteractionHandler >& aInteractionHandler); diff --git a/fpicker/source/office/fpsmartcontent.cxx b/fpicker/source/office/fpsmartcontent.cxx index 5de4395ed362..98cbd32ae464 100644 --- a/fpicker/source/office/fpsmartcontent.cxx +++ b/fpicker/source/office/fpsmartcontent.cxx @@ -20,6 +20,7 @@ #include "fpsmartcontent.hxx" #include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/ContentInfo.hpp> #include <com/sun/star/ucb/ContentInfoAttribute.hpp> #include <com/sun/star/ucb/XContent.hpp> @@ -79,9 +80,9 @@ namespace svt //-------------------------------------------------------------------- void SmartContent::enableOwnInteractionHandler(::svt::OFilePickerInteractionHandler::EInterceptedInteractions eInterceptions) { - Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >( - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); m_pOwnInteraction = new ::svt::OFilePickerInteractionHandler(xGlobalInteractionHandler); m_pOwnInteraction->enableInterceptions(eInterceptions); @@ -98,9 +99,9 @@ namespace svt m_pOwnInteraction = NULL; m_xOwnInteraction = Reference< XInteractionHandler >(); - Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >( - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); } diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 46e2b708f506..264e673b883d 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -72,7 +72,7 @@ #include <osl/file.h> #include <vcl/waitobj.hxx> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include "com/sun/star/ucb/InteractiveAugmentedIOException.hpp" #include "fpinteraction.hxx" #include <osl/process.h> @@ -2001,13 +2001,10 @@ void SvtFileDialog::displayIOException( const String& _rURL, IOErrorCode _eCode pRequest->addContinuation( new ::comphelper::OInteractionAbort( ) ); Reference< XInteractionHandler > xHandler( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) - ), - UNO_QUERY + InteractionHandler::createDefault( ::comphelper::getProcessComponentContext() ), + UNO_QUERY_THROW ); - if ( xHandler.is() ) - xHandler->handle( xRequest ); + xHandler->handle( xRequest ); } catch( const Exception& ) { diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 104d76c34115..e31beef09ac1 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -270,6 +270,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/system,\ SystemShellExecute \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/task,\ + InteractionHandler \ InteractionRequestStringResolver \ JobExecutor \ OfficeRestartManager \ @@ -1218,7 +1219,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/table,\ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/task,\ AsyncJob \ - InteractionHandler \ Job \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text,\ diff --git a/offapi/com/sun/star/task/InteractionHandler.idl b/offapi/com/sun/star/task/InteractionHandler.idl index 1e603a2a3fac..524c385ce4ac 100644 --- a/offapi/com/sun/star/task/InteractionHandler.idl +++ b/offapi/com/sun/star/task/InteractionHandler.idl @@ -21,8 +21,8 @@ #define __com_sun_star_task_InteractionHandler_idl__ module com { module sun { module star { - module lang { published interface XInitialization; }; - module task { published interface XInteractionHandler; }; + module task { published interface XInteractionHandler2; }; + module awt { published interface XWindow; }; }; }; }; module com { module sun { module star { module task { @@ -147,28 +147,13 @@ module com { module sun { module star { module task { that the types you specify are general enough to cover all requests you want to handle, but also specific enough to not cover requests which other handlers might be interested in.</p> */ -published service InteractionHandler +published service InteractionHandler : XInteractionHandler2 { - /** Handle an interaction request. - */ - interface com::sun::star::task::XInteractionHandler; - - /** Initialize the interaction handler. - - <P>The arguments must be a sequence of - <type scope="com::sun::star::beans">PropertyValue</type>s. The - currently supported properties are: - <UL> - <LI><code>"Parent"</code> of type - <type scope="com::sun::star::awt">XWindow</type> denotes the - parent window for any GUI dialogs the interaction handler pops up; - it is strongly recommended that this property is supplied;</LI> - <LI><code>"Context"</code> of type <atom>string</atom> is a - textual description of the current context (used, e.g., as a first - line of text in error boxes); this property is optional.</LI> - </UL></P> - */ - interface com::sun::star::lang::XInitialization; + createDefault(); + + createWithParent([in] com::sun::star::awt::XWindow parent); + + createWithParentAndContext([in] com::sun::star::awt::XWindow parent, [in] string context); }; }; }; }; }; diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 312d0eb217cc..8a14c1485672 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index cd764ddaf7cb..d95c6a03062d 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -67,6 +67,7 @@ #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/table/ShadowFormat.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/ErrorCodeIOException.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> @@ -2649,8 +2650,8 @@ uno::Reference< embed::XStorage > OReportDefinition::getStorage() const // ----------------------------------------------------------------------------- uno::Reference< task::XInteractionHandler > OReportDefinition::getInteractionHandler() const { - uno::Reference< task::XInteractionHandler > xRet( m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler")) ,m_aProps->m_xContext),uno::UNO_QUERY); + uno::Reference< task::XInteractionHandler > xRet( + task::InteractionHandler::createDefault(m_aProps->m_xContext), uno::UNO_QUERY_THROW); return xRet; } // ----------------------------------------------------------------------------- diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk index 4f761856a68a..3151f14ed5de 100644 --- a/sc/CppunitTest_sc_ucalc.mk +++ b/sc/CppunitTest_sc_ucalc.mk @@ -101,6 +101,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_ucalc,\ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ unoxml/source/service/unoxml \ + uui/util/uui \ )) $(eval $(call gb_CppunitTest_use_configuration,sc_ucalc)) diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 8c5e0c4a0274..c3a034c4f3df 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -66,6 +66,7 @@ #include <com/sun/star/sheet/DataPilotTablePositionData.hpp> #include <com/sun/star/sheet/DataPilotTablePositionType.hpp> #include <com/sun/star/sheet/DimensionFlags.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XSingleComponentFactory.hpp> @@ -102,7 +103,6 @@ using ::com::sun::star::beans::XPropertySet; using ::rtl::OUString; #define SC_SERVICE_ROWSET "com.sun.star.sdb.RowSet" -#define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" #define SC_DBPROP_DATASOURCENAME "DataSourceName" #define SC_DBPROP_COMMAND "Command" @@ -3058,9 +3058,8 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet( if ( xExecute.is() ) { uno::Reference<task::XInteractionHandler> xHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_SERVICE_INTHANDLER )) ), - uno::UNO_QUERY); + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW); xExecute->executeWithCompletion( xHandler ); } else diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 862698318895..117a8e7ef668 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> #include <com/sun/star/sdb/XCompletedConnection.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> using namespace com::sun::star; @@ -54,7 +55,6 @@ using namespace com::sun::star; //------------------------------------------------------------------------- -#define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" // entries in the "type" ListBox #define DP_TYPELIST_TABLE 0 @@ -165,9 +165,8 @@ void ScDataPilotDatabaseDlg::FillObjects() if ( !xSource.is() ) return; uno::Reference<task::XInteractionHandler> xHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_SERVICE_INTHANDLER )) ), - uno::UNO_QUERY); + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW); uno::Reference<sdbc::XConnection> xConnection = xSource->connectWithCompletion( xHandler ); diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 14da13deaeea..5b849909ef23 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/sdbc/XRowSet.hpp> #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> #include <com/sun/star/sdbcx/XRowLocate.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -66,7 +67,6 @@ using namespace com::sun::star; #define SC_SERVICE_ROWSET "com.sun.star.sdb.RowSet" -#define SC_SERVICE_INTHANDLER "com.sun.star.task.InteractionHandler" //! move to a header file? #define SC_DBPROP_DATASOURCENAME "DataSourceName" @@ -252,9 +252,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, if ( xExecute.is() ) { uno::Reference<task::XInteractionHandler> xHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_SERVICE_INTHANDLER )) ), - uno::UNO_QUERY); + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW); xExecute->executeWithCompletion( xHandler ); } else diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 58925b5899be..96f19ec9100b 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -23,7 +23,7 @@ #include <osl/mutex.hxx> #include <svtools/imagemgr.hxx> #include <svtools/miscopt.hxx> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> @@ -439,8 +439,8 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR Sequence< PropertyValue > aArgs(3); Reference < com::sun::star::task::XInteractionHandler > xInteraction( - ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.task.InteractionHandler") ), - com::sun::star::uno::UNO_QUERY ); + task::InteractionHandler::createDefault(::comphelper::getProcessComponentContext()), + com::sun::star::uno::UNO_QUERY_THROW ); aArgs[0].Name = OUString("InteractionHandler"); aArgs[0].Value <<= xInteraction; diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index a2656b7dc62b..248595c2a453 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/ucb/IllegalIdentifierException.hpp> #include <com/sun/star/ucb/NameClash.hpp> @@ -168,9 +169,9 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin StringList_Impl* pProperties = NULL; try { - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > ( - xFactory->createInstance( "com.sun.star.task.InteractionHandler" ), uno::UNO_QUERY ); + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() ); uno::Reference< sdbc::XResultSet > xResultSet; @@ -252,9 +253,9 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL ) String aRet; try { - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > ( - xFactory->createInstance( "com.sun.star.task.InteractionHandler" ), uno::UNO_QUERY ); + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() ); // open the "active help" stream uno::Reference< io::XInputStream > xStream = aCnt.openStream(); diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx index ad414affbb71..40f9208d53ec 100644 --- a/sfx2/source/control/templateremoteview.cxx +++ b/sfx2/source/control/templateremoteview.cxx @@ -20,7 +20,7 @@ #include <ucbhelper/commandenvironment.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> @@ -52,9 +52,9 @@ TemplateRemoteView::TemplateRemoteView (Window *pParent, WinBits nWinStyle, bool mpItemView->SetColor(Color(COL_WHITE)); mpItemView->setChangeNameHdl(LINK(this,TemplateRemoteView,ChangeNameHdl)); - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >( - xFactory->createInstance("com.sun.star.task.InteractionHandler" ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); } diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx index 2a77bde0336c..06ecbbf661a4 100644 --- a/sfx2/source/dialog/templateinfodlg.cxx +++ b/sfx2/source/dialog/templateinfodlg.cxx @@ -19,7 +19,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -71,12 +71,12 @@ void SfxTemplateInfoDlg::loadDocument(const OUString &rURL) { assert(!rURL.isEmpty()); - uno::Reference<lang::XMultiServiceFactory> xContext(comphelper::getProcessServiceFactory()); + uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); try { uno::Reference<task::XInteractionHandler> xInteractionHandler( - xContext->createInstance("com.sun.star.task.InteractionHandler"), uno::UNO_QUERY ); + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); uno::Sequence<beans::PropertyValue> aProps(1); aProps[0].Name = "InteractionHandler"; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index db5887e4220f..666d37fd915d 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -21,7 +21,7 @@ #include "sfx2/signaturestate.hxx" #include <uno/mapping.hxx> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/ucb/XContent.hpp> #include <com/sun/star/container/XChild.hpp> @@ -2526,14 +2526,10 @@ SfxMedium::GetInteractionHandler() return pImp->xInteraction; // create default handler and cache it! - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - pImp->xInteraction = ::com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >( xFactory->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), ::com::sun::star::uno::UNO_QUERY ); - return pImp->xInteraction; - } - - return ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >(); + Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + pImp->xInteraction = Reference< task::XInteractionHandler >( + task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); + return pImp->xInteraction; } //---------------------------------------------------------------- diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 281e1c762e14..bb06eddb1587 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -152,7 +152,7 @@ typedef vector< NamePair_Impl* > NameList_Impl; typedef vector< GroupData_Impl* > GroupList_Impl; //============================================================================= -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> class TplTaskEnvironment : public ::cppu::WeakImplHelper1< ucb::XCommandEnvironment > @@ -389,12 +389,10 @@ public: //----------------------------------------------------------------------------- void SfxDocTplService_Impl::init_Impl() { - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - uno::Reference < task::XInteractionHandler > xInteractionHandler( xFactory->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), uno::UNO_QUERY ); - maCmdEnv = new TplTaskEnvironment( xInteractionHandler ); - } + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference < task::XInteractionHandler > xInteractionHandler( + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); + maCmdEnv = new TplTaskEnvironment( xInteractionHandler ); ::osl::ClearableMutexGuard aGuard( maMutex ); sal_Bool bIsInitialized = sal_False; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 83eb28a3065f..7bbfd072422d 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XDocumentInfoSupplier.hpp> #include <com/sun/star/document/XDocumentInfo.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -441,8 +441,7 @@ void ModelData_Impl::CheckInteractionHandler() try { m_aMediaDescrHM[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) ] <<= uno::Reference< task::XInteractionHandler >( - m_pOwner->GetServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), + task::InteractionHandler::createDefault(comphelper::getComponentContext(m_pOwner->GetServiceFactory())), uno::UNO_QUERY ); } catch( const uno::Exception& ) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 443294aafafd..c6caa28ff4c3 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/frame/DocumentTemplates.hpp> @@ -554,28 +554,20 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SFX_REQUEST_ARG( rReq, pInteractionHandlerItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False ); if ( !pInteractionHandlerItem ) { - uno::Reference< task::XInteractionHandler > xInteract; - uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - if( xServiceManager.is() ) - { - xInteract = Reference< XInteractionHandler >( - xServiceManager->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), - UNO_QUERY ); - } + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference< task::XInteractionHandler > xInteract( + task::InteractionHandler::createDefault(xContext), + UNO_QUERY_THROW ); - OSL_ENSURE( xInteract.is(), "Can not retrieve default status indicator!\n" ); - if ( xInteract.is() ) + SfxUnoAnyItem aInteractionItem( SID_INTERACTIONHANDLER, uno::makeAny( xInteract ) ); + if ( nId == SID_SAVEDOC ) { - SfxUnoAnyItem aInteractionItem( SID_INTERACTIONHANDLER, uno::makeAny( xInteract ) ); - if ( nId == SID_SAVEDOC ) - { - // in case of saving it is not possible to transport the parameters from here - // but it is not clear here whether the saving will be done or saveAs operation - GetMedium()->GetItemSet()->Put( aInteractionItem ); - } - - rReq.AppendItem( aInteractionItem ); + // in case of saving it is not possible to transport the parameters from here + // but it is not clear here whether the saving will be done or saveAs operation + GetMedium()->GetItemSet()->Put( aInteractionItem ); } + + rReq.AppendItem( aInteractionItem ); } else if ( nId == SID_SAVEDOC ) { diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 213856fc00e0..092b2bac0d3a 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -22,9 +22,11 @@ #include <unotools/pathoptions.hxx> #include <cppuhelper/factory.hxx> +#include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <com/sun/star/registry/XSimpleRegistry.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/MasterPasswordRequest.hpp> #include <com/sun/star/task/NoMasterException.hpp> @@ -1124,7 +1126,8 @@ sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::R if ( !xTmpHandler.is() ) { uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( "com.sun.star.task.InteractionHandler" ) ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( comphelper::getComponentContext(xFactory) ); + xTmpHandler.set( InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); } if ( !m_aMasterPasswd.isEmpty() ) @@ -1168,7 +1171,8 @@ sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< if ( !xTmpHandler.is() ) { uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( "com.sun.star.task.InteractionHandler" ) ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( comphelper::getComponentContext(xFactory) ); + xTmpHandler.set( InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); } sal_Bool bCanChangePassword = sal_True; @@ -1284,7 +1288,8 @@ void SAL_CALL PasswordContainer::removeMasterPassword() if ( !xTmpHandler.is() ) { uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW ); - xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( "com.sun.star.task.InteractionHandler" ) ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( comphelper::getComponentContext(xFactory) ); + xTmpHandler.set( InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); } sal_Bool bCanChangePassword = sal_True; diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index a390c458fd40..dc182678dd05 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -40,7 +40,7 @@ #include <svtools/AccessibleBrowseBoxObjType.hxx> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> @@ -698,9 +698,9 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( Window* pParentWin, maResetQuickSearch.SetTimeout( QUICK_SEARCH_TIMEOUT ); maResetQuickSearch.SetTimeoutHdl( LINK( this, ViewTabListBox_Impl, ResetQuickSearch_Impl ) ); - Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > ( - xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); mxCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); @@ -1160,8 +1160,9 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, if ( bMultiSelection ) nFlags |= FILEVIEW_MULTISELECTION; + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > ( - ::comphelper::getProcessServiceFactory()->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, bOnlyFolder ); @@ -1177,8 +1178,9 @@ SvtFileView::SvtFileView( Window* pParent, const ResId& rResId, sal_uInt8 nFlags Control( pParent, rResId ) { + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > ( - ::comphelper::getProcessServiceFactory()->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); Reference < XCommandEnvironment > xCmdEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); mpImp = new SvtFileView_Impl( this, xCmdEnv, nFlags, nFlags & FILEVIEW_ONLYFOLDER ); diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 9a77b770a851..9579759419b3 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -71,6 +71,7 @@ #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <unotools/localedatawrapper.hxx> #include <com/sun/star/container/XNameContainer.hpp> #include <vcl/waitobj.hxx> @@ -669,8 +670,9 @@ void SvtFrameWindow_Impl::ShowDocInfo( const String& rURL ) { try { - uno::Reference < task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" )) ), uno::UNO_QUERY ); + uno::Reference < task::XInteractionHandler > xInteractionHandler( + task::InteractionHandler::createDefault(::comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW ); uno::Sequence < beans::PropertyValue> aProps(1); aProps[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); aProps[0].Value <<= xInteractionHandler; @@ -752,8 +754,8 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B aArgs[1].Value.setValue( &b, ::getBooleanCppuType() ); aArgs[2].Name = ASCII_STR("AsTemplate"); // prevents getting an empty URL with getURL()! - uno::Reference < task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" )) ), uno::UNO_QUERY ); + uno::Reference < task::XInteractionHandler > xInteractionHandler( + task::InteractionHandler::createDefault(::comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW ); aArgs[3].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); aArgs[3].Value <<= xInteractionHandler; diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx index e93be567293b..3417d5531606 100644 --- a/svtools/source/dialogs/ServerDetailsControls.cxx +++ b/svtools/source/dialogs/ServerDetailsControls.cxx @@ -27,7 +27,7 @@ */ #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> @@ -292,9 +292,9 @@ CmisDetailsContainer::CmisDetailsContainer( ) : m_sUsername( ), m_xCmdEnv( ) { - Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >( - xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY ); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); } diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 49f7ca5204ba..a59b378746a4 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -52,7 +52,7 @@ #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/SQLWarning.hpp> #include <com/sun/star/sdbc/XConnection.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdb/CommandType.hpp> @@ -847,15 +847,17 @@ void AssignmentPersistentData::Commit() m_aDatasource.SaveValue(); // create an interaction handler (may be needed for connecting) - const rtl::OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler"); Reference< XInteractionHandler > xHandler; try { - xHandler = Reference< XInteractionHandler >(m_xORB->createInstance(sInteractionHandlerServiceName), UNO_QUERY); + xHandler = Reference< XInteractionHandler >( + InteractionHandler::createDefault(comphelper::getComponentContext(m_xORB)), + UNO_QUERY_THROW ); } catch(Exception&) { } if (!xHandler.is()) { + const rtl::OUString sInteractionHandlerServiceName("com.sun.star.task.InteractionHandler"); ShowServiceNotAvailableError(this, sInteractionHandlerServiceName, sal_True); return; } diff --git a/svx/inc/svx/dbtoolsclient.hxx b/svx/inc/svx/dbtoolsclient.hxx index 3568c20396c3..d9464f8bd4a1 100644 --- a/svx/inc/svx/dbtoolsclient.hxx +++ b/svx/inc/svx/dbtoolsclient.hxx @@ -110,7 +110,7 @@ namespace svxform const ::rtl::OUString& _rDataSourceName, const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ); // ------------------------------------------------ diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index f301612431bb..acbf420435a4 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -295,7 +295,8 @@ sal_Int8 FmGridHeader::ExecuteDrop( const ExecuteDropEvent& _rEvt ) try { ::rtl::OUString sSignificantSource( sDatasouce.isEmpty() ? sDatabaseLocation : sDatasouce ); - xConnection = OStaticDataAccessTools().getConnection_withFeedback(sSignificantSource, ::rtl::OUString(),::rtl::OUString(),static_cast<FmGridControl*>(GetParent())->getServiceManager()); + xConnection = OStaticDataAccessTools().getConnection_withFeedback(sSignificantSource, ::rtl::OUString(),::rtl::OUString(), + comphelper::getComponentContext( static_cast<FmGridControl*>(GetParent())->getServiceManager() )); } catch(NoSuchElementException&) { // allowed, means sDatasouce isn't a valid data source name .... diff --git a/svx/source/form/dbtoolsclient.cxx b/svx/source/form/dbtoolsclient.cxx index c07be75cc19e..a7a2b03f5d8f 100644 --- a/svx/source/form/dbtoolsclient.cxx +++ b/svx/source/form/dbtoolsclient.cxx @@ -193,12 +193,12 @@ namespace svxform //-------------------------------------------------------------------- Reference< XConnection> OStaticDataAccessTools::getConnection_withFeedback(const ::rtl::OUString& _rDataSourceName, - const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, const Reference< XMultiServiceFactory>& _rxFactory) const + const ::rtl::OUString& _rUser, const ::rtl::OUString& _rPwd, const Reference<XComponentContext>& _rxContext) const SAL_THROW ( (SQLException) ) { Reference< XConnection > xReturn; if ( ensureLoaded() ) - xReturn = m_xDataAccessTools->getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxFactory); + xReturn = m_xDataAccessTools->getConnection_withFeedback(_rDataSourceName, _rUser, _rPwd, _rxContext); return xReturn; } diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index d55071e7aff6..0814b5f92e2f 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -1185,7 +1185,7 @@ SdrObject* FmXFormView::implCreateFieldControl( const ::svx::ODataAccessDescript sDataSource, ::rtl::OUString(), ::rtl::OUString(), - m_aContext.getLegacyServiceFactory() + m_aContext.getUNOContext() ) ); } catch (const SQLException&) diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index d18e6bb1cc0d..5dbb628d6b2f 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/sdb/XInteractionSupplyParameters.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/form/runtime/FormOperations.hpp> #include <com/sun/star/form/runtime/FormFeature.hpp> @@ -199,6 +200,7 @@ namespace svxform using ::com::sun::star::util::URL; using ::com::sun::star::frame::FeatureStateEvent; using ::com::sun::star::form::runtime::XFormControllerContext; + using ::com::sun::star::task::InteractionHandler; using ::com::sun::star::task::XInteractionHandler; using ::com::sun::star::form::runtime::FormOperations; using ::com::sun::star::container::XContainer; @@ -4272,7 +4274,7 @@ bool FormController::ensureInteractionHandler() return false; m_bAttemptedHandlerCreation = true; - m_xInteractionHandler.set( m_aContext.createComponent( ::rtl::OUString( "com.sun.star.task.InteractionHandler" ) ), UNO_QUERY ); + m_xInteractionHandler.set( InteractionHandler::createDefault(m_aContext.getUNOContext()), UNO_QUERY ); OSL_ENSURE( m_xInteractionHandler.is(), "FormController::ensureInteractionHandler: could not create an interaction handler!" ); return m_xInteractionHandler.is(); } diff --git a/sw/CppunitTest_sw_subsequent_odfexport.mk b/sw/CppunitTest_sw_subsequent_odfexport.mk index 4ba12b90b0db..ed559ba069cd 100644 --- a/sw/CppunitTest_sw_subsequent_odfexport.mk +++ b/sw/CppunitTest_sw_subsequent_odfexport.mk @@ -84,6 +84,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfexport,\ ucb/source/ucp/file/ucpfile1 \ unotools/util/utl \ unoxml/source/service/unoxml \ + uui/util/uui \ $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \ )) diff --git a/sw/CppunitTest_sw_subsequent_odfimport.mk b/sw/CppunitTest_sw_subsequent_odfimport.mk index 9c9a1560d5ca..9cd82706f2cf 100644 --- a/sw/CppunitTest_sw_subsequent_odfimport.mk +++ b/sw/CppunitTest_sw_subsequent_odfimport.mk @@ -83,6 +83,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_odfimport,\ ucb/source/ucp/file/ucpfile1 \ unotools/util/utl \ unoxml/source/service/unoxml \ + uui/util/uui \ $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \ )) diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 8a549263be4c..045436becc2c 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdb/XQueriesSupplier.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <swunohelper.hxx> @@ -559,9 +560,8 @@ void SwAddressListDialog::DetectTablesAndQueries( m_xDBContext->getByName(m_aDBData.sDataSource) >>= xComplConnection; pUserData->xSource = uno::Reference<XDataSource>(xComplConnection, UNO_QUERY); - uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - uno::Reference< XInteractionHandler > xHandler( - xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY); + uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(xContext), UNO_QUERY ); pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) ); } if(pUserData->xConnection.is()) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index f8824aea4db8..276639271d9c 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/text/MailMergeEvent.hpp> #include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> @@ -101,6 +102,7 @@ #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/mail/MailAttachment.hpp> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/property.hxx> #include <comphelper/string.hxx> @@ -1571,7 +1573,6 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData uno::Reference<XDataSource>& rxSource) { Reference< sdbc::XConnection> xConnection; - Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); try { @@ -1579,9 +1580,8 @@ uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rData if ( xComplConnection.is() ) { rxSource.set(xComplConnection,UNO_QUERY); - Reference< XInteractionHandler > xHandler( - xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY); - xConnection = xComplConnection->connectWithCompletion( xHandler ); + Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); + xConnection = xComplConnection->connectWithCompletion( xHandler ); } } catch(const Exception&) @@ -2661,7 +2661,7 @@ uno::Reference<XResultSet> SwNewDBMgr::createCursor(const ::rtl::OUString& _sDat if ( xRowSet.is() ) { - uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")), UNO_QUERY); + uno::Reference< XInteractionHandler > xHandler( InteractionHandler::createDefault(comphelper::getComponentContext(xMgr)), UNO_QUERY_THROW ); xRowSet->executeWithCompletion(xHandler); } xResultSet = uno::Reference<XResultSet>(xRowSet, UNO_QUERY); diff --git a/ucb/workben/ucb/ucbdemo.cxx b/ucb/workben/ucb/ucbdemo.cxx index 00f44655aa75..d24d8e61b1f9 100644 --- a/ucb/workben/ucb/ucbdemo.cxx +++ b/ucb/workben/ucb/ucbdemo.cxx @@ -650,10 +650,8 @@ uno::Any UcbCommandProcessor::executeCommand( const rtl::OUString& rName, if (m_rUCB.getServiceFactory().is()) xInteractionHandler = uno::Reference< task::XInteractionHandler >( - m_rUCB.getServiceFactory()-> - createInstance( - rtl::OUString( "com.sun.star.task.InteractionHandler")), - uno::UNO_QUERY); + task::InteractionHandler::create(m_rUCB.getServiceFactory()), + uno::UNO_QUERY_THROW); uno::Reference< ucb::XProgressHandler > xProgressHandler(new ProgressHandler(m_rUCB)); uno::Reference< ucb::XCommandEnvironment > xEnv( @@ -1308,10 +1306,8 @@ void UcbContent::transfer( const rtl::OUString& rSourceURL, sal_Bool bMove ) if (m_rUCB.getServiceFactory().is()) xInteractionHandler = uno::Reference< task::XInteractionHandler >( - m_rUCB.getServiceFactory()-> - createInstance( - rtl::OUString( "com.sun.star.task.InteractionHandler")), - uno::UNO_QUERY); + task::InteractionHandler::createDefault(comphelper::getComponentContext(m_rUCB.getServiceFactory())), + uno::UNO_QUERY_THROW); uno::Reference< ucb::XProgressHandler > xProgressHandler( new ProgressHandler(m_rUCB)); uno::Reference< ucb::XCommandEnvironment > xEnv( diff --git a/udkapi/com/sun/star/task/XInteractionHandler2.idl b/udkapi/com/sun/star/task/XInteractionHandler2.idl index 5c76ac71edae..7cd1c7190f13 100644 --- a/udkapi/com/sun/star/task/XInteractionHandler2.idl +++ b/udkapi/com/sun/star/task/XInteractionHandler2.idl @@ -34,7 +34,7 @@ @since OOo 3.2 */ -/* published */ interface XInteractionHandler2 : com::sun::star::task::XInteractionHandler +published interface XInteractionHandler2 : com::sun::star::task::XInteractionHandler { /** Handle an interaction request. diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 127f7d42737c..e09256d9027e 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -34,6 +34,7 @@ #include "com/sun/star/task/ErrorCodeIOException.hpp" #include "com/sun/star/task/ErrorCodeRequest.hpp" #include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp" +#include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionAskLater.hpp" @@ -72,6 +73,7 @@ #include "vcl/svapp.hxx" #include "unotools/configmgr.hxx" #include "toolkit/helper/vclunohelper.hxx" +#include "comphelper/processfactory.hxx" #include "comphelper/namedvaluecollection.hxx" #include "typelib/typedescription.hxx" #include "unotools/confignode.hxx" @@ -99,6 +101,7 @@ using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest; using ::com::sun::star::uno::XInterface; using ::com::sun::star::lang::XInitialization; using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::task::InteractionHandler; using ::com::sun::star::task::XInteractionHandler2; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Any; @@ -129,10 +132,12 @@ public: UUIInteractionHelper::UUIInteractionHelper( uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory, - uno::Sequence< uno::Any > const & rArguments) + uno::Reference< awt::XWindow > const & rxWindowParam, + const OUString & rContextParam) SAL_THROW(()): m_xServiceFactory(rServiceFactory), - m_aProperties(rArguments) + m_xWindowParam(rxWindowParam), + m_aContextParam(rContextParam) { } @@ -1092,58 +1097,24 @@ uno::Reference< awt::XWindow> UUIInteractionHelper::getParentXWindow() const SAL_THROW(()) { - osl::MutexGuard aGuard(m_aPropertyMutex); - ::comphelper::NamedValueCollection aProperties( m_aProperties ); - if ( aProperties.has( "Parent" ) ) - { - uno::Reference< awt::XWindow > xWindow; - OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow ); - return xWindow; - } - return 0; + return m_xWindowParam; } rtl::OUString UUIInteractionHelper::getContextProperty() SAL_THROW(()) { - osl::MutexGuard aGuard(m_aPropertyMutex); - for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i) - { - beans::PropertyValue aProperty; - if ((m_aProperties[i] >>= aProperty) && aProperty.Name == "Context" ) - { - rtl::OUString aContext; - aProperty.Value >>= aContext; - return aContext; - } - } - return rtl::OUString(); + return m_aContextParam; } uno::Reference< task::XInteractionHandler > UUIInteractionHelper::getInteractionHandler() SAL_THROW((uno::RuntimeException)) { - uno::Reference< task::XInteractionHandler > xIH; - try - { - xIH.set(m_xServiceFactory->createInstanceWithArguments( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.InteractionHandler")), - m_aProperties), - uno::UNO_QUERY); - } - catch (uno::Exception const &) - {} - - if (!xIH.is()) - throw uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "unable to instanciate Interaction Handler service")), - uno::Reference< uno::XInterface >()); + uno::Reference< task::XInteractionHandler > xIH( + InteractionHandler::createWithParentAndContext(comphelper::getComponentContext(m_xServiceFactory), + m_xWindowParam, m_aContextParam), + UNO_QUERY_THROW); return xIH; } diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index 358bdd5d58ae..3266f0b90216 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -88,7 +88,8 @@ class UUIInteractionHelper private: mutable osl::Mutex m_aPropertyMutex; ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; - ::com::sun::star::uno::Sequence< com::sun::star::uno::Any > m_aProperties; + ::com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xWindowParam; + const OUString m_aContextParam; StringHashMap m_aTypedCustomHandlers; UUIInteractionHelper(UUIInteractionHelper &); // not implemented void operator =(UUIInteractionHelper); // not implemented @@ -97,8 +98,9 @@ public: UUIInteractionHelper( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const & rServiceFactory, - com::sun::star::uno::Sequence< - com::sun::star::uno::Any > const & rArguments) + com::sun::star::uno::Reference< + com::sun::star::awt::XWindow > const & rxWindow, + const OUString & rContextParam) SAL_THROW(()); UUIInteractionHelper( com::sun::star::uno::Reference< diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx index 4054a3825f2c..821b03e632a8 100644 --- a/uui/source/interactionhandler.cxx +++ b/uui/source/interactionhandler.cxx @@ -19,6 +19,8 @@ #include "iahndl.hxx" #include "interactionhandler.hxx" +#include "comphelper/namedvaluecollection.hxx" +#include "com/sun/star/awt/XWindow.hpp" using namespace com::sun::star; @@ -67,7 +69,21 @@ UUIInteractionHandler::initialize( throw (uno::Exception) { delete m_pImpl; - m_pImpl = new UUIInteractionHelper(m_xServiceFactory, rArguments); + + uno::Reference< awt::XWindow > xWindow; + rtl::OUString aContext; + ::comphelper::NamedValueCollection aProperties( rArguments ); + if ( aProperties.has( "Parent" ) ) + { + OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow ); + } + if ( aProperties.has( "Context" ) ) + { + OSL_VERIFY( aProperties.get( "Context" ) >>= aContext ); + } + + + m_pImpl = new UUIInteractionHelper(m_xServiceFactory, xWindow, aContext); } void SAL_CALL diff --git a/uui/source/interactionhandler.hxx b/uui/source/interactionhandler.hxx index 39acd8624a22..8d2147b74641 100644 --- a/uui/source/interactionhandler.hxx +++ b/uui/source/interactionhandler.hxx @@ -20,16 +20,14 @@ #ifndef UUI_INTERACTIONHANDLER_HXX #define UUI_INTERACTIONHANDLER_HXX -#include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/task/XInteractionHandler2.hpp" -#include "cppuhelper/implbase3.hxx" +#include "cppuhelper/implbase2.hxx" class UUIInteractionHelper; class UUIInteractionHandler: - public cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo, - com::sun::star::lang::XInitialization, + public cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo, com::sun::star::task::XInteractionHandler2 > { public: diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 7f56603ecc2b..74ac0a3078a5 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -46,7 +46,7 @@ #include <comphelper/docpasswordrequest.hxx> #include <xmlsecurity/biginteger.hxx> #include <rtl/logfile.h> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <vector> #include "boost/scoped_array.hpp" #include <osl/thread.h> @@ -104,33 +104,27 @@ struct UsageDescription char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - if ( xMSF.is() ) - { - uno::Reference < task::XInteractionHandler > xInteractionHandler( - xMSF->createInstance( rtl::OUString("com.sun.star.task.InteractionHandler") ), uno::UNO_QUERY ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference < task::XInteractionHandler2 > xInteractionHandler( + task::InteractionHandler::createDefault(xContext) ); - if ( xInteractionHandler.is() ) - { - task::PasswordRequestMode eMode = bRetry ? task::PasswordRequestMode_PASSWORD_REENTER : task::PasswordRequestMode_PASSWORD_ENTER; - ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( - ::comphelper::DocPasswordRequestType_STANDARD, eMode, ::rtl::OUString::createFromAscii(PK11_GetTokenName(pSlot)) ); + task::PasswordRequestMode eMode = bRetry ? task::PasswordRequestMode_PASSWORD_REENTER : task::PasswordRequestMode_PASSWORD_ENTER; + ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest( + ::comphelper::DocPasswordRequestType_STANDARD, eMode, ::rtl::OUString::createFromAscii(PK11_GetTokenName(pSlot)) ); - uno::Reference< task::XInteractionRequest > xRequest( pPasswordRequest ); - xInteractionHandler->handle( xRequest ); + uno::Reference< task::XInteractionRequest > xRequest( pPasswordRequest ); + xInteractionHandler->handle( xRequest ); - if ( pPasswordRequest->isPassword() ) - { - rtl::OString aPassword(rtl::OUStringToOString( - pPasswordRequest->getPassword(), - osl_getThreadTextEncoding())); - sal_Int32 nLen = aPassword.getLength(); - char* pPassword = (char*) PORT_Alloc( nLen+1 ) ; - pPassword[nLen] = 0; - memcpy( pPassword, aPassword.getStr(), nLen ); - return pPassword; - } - } + if ( pPasswordRequest->isPassword() ) + { + rtl::OString aPassword(rtl::OUStringToOString( + pPasswordRequest->getPassword(), + osl_getThreadTextEncoding())); + sal_Int32 nLen = aPassword.getLength(); + char* pPassword = (char*) PORT_Alloc( nLen+1 ) ; + pPassword[nLen] = 0; + memcpy( pPassword, aPassword.getStr(), nLen ); + return pPassword; } return NULL; } |