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 /dbaccess | |
parent | Related: rhbz#862467 band-aid when creating embedded object fails (diff) | |
download | core-c25cb8a641723ab098980bb842caf75c0dc9b059.tar.gz core-c25cb8a641723ab098980bb842caf75c0dc9b059.zip |
fdo#46808, Adapt task::InteractionHandler UNO service to new style
Since we don't need to expose XInitialisation, we can make the new-style
service implement XInteractionHandler2.
Change-Id: Ib27beed1c12df17592c6472d6f58c233d2c41558
Diffstat (limited to 'dbaccess')
21 files changed, 73 insertions, 80 deletions
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); |