Tag: cws_src680_odbmacros2 User: fs Date: 2008-01-24 14:12:04+0000 Modified: dba/dbaccess/source/ui/misc/datasourceconnector.cxx
Log: #i49133# connect: use the document's interaction handler, if there is one File Changes: Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: datasourceconnector.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/datasourceconnector.cxx?r1=1.13.82.1&r2=1.13.82.2 Delta lines: +23 -10 --------------------- --- datasourceconnector.cxx 2007-12-19 13:26:25+0000 1.13.82.1 +++ datasourceconnector.cxx 2008-01-24 14:12:01+0000 1.13.82.2 @@ -4,9 +4,9 @@ * * $RCSfile: datasourceconnector.cxx,v $ * - * $Revision: 1.13.82.1 $ + * $Revision: 1.13.82.2 $ * - * last change: $Author: fs $ $Date: 2007/12/19 13:26:25 $ + * last change: $Author: fs $ $Date: 2008/01/24 14:12:01 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,6 +57,9 @@ #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_ #include <com/sun/star/task/XInteractionHandler.hpp> #endif +#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_ +#include <com/sun/star/frame/XModel.hpp> +#endif #ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_ #include <com/sun/star/sdb/SQLContext.hpp> #endif @@ -69,6 +72,9 @@ #ifndef _COMPHELPER_EXTRACT_HXX_ #include <comphelper/extract.hxx> #endif +#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX +#include <comphelper/namedvaluecollection.hxx> +#endif #ifndef _DBHELPER_DBEXCEPTION_HXX_ #include <connectivity/dbexception.hxx> #endif @@ -107,6 +113,7 @@ using namespace ::com::sun::star::task; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; + using namespace ::com::sun::star::frame; using namespace ::dbtools; using ::svt::OFileNotation; @@ -186,13 +193,19 @@ { // password required, but empty -> connect using an interaction handler Reference< XCompletedConnection > xConnectionCompletion( _xDataSource, UNO_QUERY_THROW ); - // instantiate the default SDB interaction handler - Reference< XInteractionHandler > xHandler(m_xORB->createInstance(SERVICE_SDB_INTERACTION_HANDLER), UNO_QUERY); - if (!xHandler.is()) + Reference< XModel > xModel( getDataSourceOrModel( _xDataSource ), UNO_QUERY_THROW ); + ::comphelper::NamedValueCollection aArgs( xModel->getArgs() ); + Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) ); + + if ( !xHandler.is() ) { + // instantiate the default SDB interaction handler + xHandler = Reference< XInteractionHandler >( m_xORB->createInstance( SERVICE_SDB_INTERACTION_HANDLER ), UNO_QUERY ); + if ( !xHandler.is() ) ShowServiceNotAvailableError(m_pErrorMessageParent, String(SERVICE_SDB_INTERACTION_HANDLER), sal_True); } - else + + if ( xHandler.is() ) { xConnection = xConnectionCompletion->connectWithCompletion(xHandler); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
