1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _DBAUI_INTERACTION_HXX_ 32*cdf0e10cSrcweir #include "dbinteraction.hxx" 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _DBU_REGHELPER_HXX_ 35*cdf0e10cSrcweir #include "dbu_reghelper.hxx" 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 38*cdf0e10cSrcweir #include <tools/debug.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H 41*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX 44*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #ifndef _DBHELPER_DBEXCEPTION_HXX_ 47*cdf0e10cSrcweir #include <connectivity/dbexception.hxx> 48*cdf0e10cSrcweir #endif 49*cdf0e10cSrcweir #ifndef _DBAUI_SQLMESSAGE_HXX_ 50*cdf0e10cSrcweir #include "sqlmessage.hxx" 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONAPPROVE_HPP_ 53*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionApprove.hpp> 54*cdf0e10cSrcweir #endif 55*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONDISAPPROVE_HPP_ 56*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionDisapprove.hpp> 57*cdf0e10cSrcweir #endif 58*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONRETRY_HPP_ 59*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionRetry.hpp> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_TASK_XINTERACTIONABORT_HPP_ 62*cdf0e10cSrcweir #include <com/sun/star/task/XInteractionAbort.hpp> 63*cdf0e10cSrcweir #endif 64*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDB_XINTERACTIONSUPPLYPARAMETERS_HPP_ 65*cdf0e10cSrcweir #include <com/sun/star/sdb/XInteractionSupplyParameters.hpp> 66*cdf0e10cSrcweir #endif 67*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDB_XINTERACTIONDOCUMENTSAVE_HPP_ 68*cdf0e10cSrcweir #include <com/sun/star/sdb/XInteractionDocumentSave.hpp> 69*cdf0e10cSrcweir #endif 70*cdf0e10cSrcweir #ifndef SFX_QUERYSAVEDOCUMENT_HXX 71*cdf0e10cSrcweir #include <sfx2/QuerySaveDocument.hxx> 72*cdf0e10cSrcweir #endif 73*cdf0e10cSrcweir #ifndef _DBU_UNO_HRC_ 74*cdf0e10cSrcweir #include "dbu_uno.hrc" 75*cdf0e10cSrcweir #endif 76*cdf0e10cSrcweir #ifndef _DBAUI_PARAMDIALOG_HXX_ 77*cdf0e10cSrcweir #include "paramdialog.hxx" 78*cdf0e10cSrcweir #endif 79*cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX 80*cdf0e10cSrcweir #include <vcl/svapp.hxx> 81*cdf0e10cSrcweir #endif 82*cdf0e10cSrcweir #ifndef _VOS_MUTEX_HXX_ 83*cdf0e10cSrcweir #include <vos/mutex.hxx> 84*cdf0e10cSrcweir #endif 85*cdf0e10cSrcweir #ifndef DBAUI_COLLECTIONVIEW_HXX 86*cdf0e10cSrcweir #include "CollectionView.hxx" 87*cdf0e10cSrcweir #endif 88*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX 89*cdf0e10cSrcweir #include "UITools.hxx" 90*cdf0e10cSrcweir #endif 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir //========================================================================== 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_OInteractionHandler() 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::SQLExceptionInteractionHandler > aSQLExceptionInteractionHandler_AutoRegistration; 98*cdf0e10cSrcweir static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::LegacyInteractionHandler > aLegacyInteractionHandler_AutoRegistration; 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir //......................................................................... 102*cdf0e10cSrcweir namespace dbaui 103*cdf0e10cSrcweir { 104*cdf0e10cSrcweir //......................................................................... 105*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 106*cdf0e10cSrcweir using namespace ::com::sun::star::ucb; 107*cdf0e10cSrcweir using namespace ::com::sun::star::sdb; 108*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 109*cdf0e10cSrcweir using namespace ::com::sun::star::task; 110*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 111*cdf0e10cSrcweir using namespace ::dbtools; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir //========================================================================= 114*cdf0e10cSrcweir //= BasicInteractionHandler 115*cdf0e10cSrcweir //========================================================================= 116*cdf0e10cSrcweir //------------------------------------------------------------------------- 117*cdf0e10cSrcweir BasicInteractionHandler::BasicInteractionHandler( const Reference< XMultiServiceFactory >& _rxORB, const bool i_bFallbackToGeneric ) 118*cdf0e10cSrcweir :m_xORB( _rxORB ) 119*cdf0e10cSrcweir ,m_bFallbackToGeneric( i_bFallbackToGeneric ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir OSL_ENSURE( !m_bFallbackToGeneric, 122*cdf0e10cSrcweir "BasicInteractionHandler::BasicInteractionHandler: enabling legacy behavior, there should be no clients of this anymore!" ); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir //------------------------------------------------------------------------- 126*cdf0e10cSrcweir ::sal_Bool SAL_CALL BasicInteractionHandler::handleInteractionRequest( const Reference< XInteractionRequest >& i_rRequest ) throw (RuntimeException) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir return impl_handle_throw( i_rRequest ); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir //------------------------------------------------------------------------- 132*cdf0e10cSrcweir void SAL_CALL BasicInteractionHandler::handle( const Reference< XInteractionRequest >& i_rRequest ) throw(RuntimeException) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir impl_handle_throw( i_rRequest ); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir //------------------------------------------------------------------------- 138*cdf0e10cSrcweir sal_Bool BasicInteractionHandler::impl_handle_throw( const Reference< XInteractionRequest >& i_Request ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir Any aRequest( i_Request->getRequest() ); 141*cdf0e10cSrcweir DBG_ASSERT(aRequest.hasValue(), "BasicInteractionHandler::handle: invalid request!"); 142*cdf0e10cSrcweir if ( !aRequest.hasValue() ) 143*cdf0e10cSrcweir // no request -> no handling 144*cdf0e10cSrcweir return sal_False; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir Sequence< Reference< XInteractionContinuation > > aContinuations( i_Request->getContinuations() ); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir // try to extract an SQLException (or one of it's derived members 149*cdf0e10cSrcweir SQLExceptionInfo aInfo( aRequest ); 150*cdf0e10cSrcweir if ( aInfo.isValid() ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir implHandle( aInfo, aContinuations ); 153*cdf0e10cSrcweir return sal_True; 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir ParametersRequest aParamRequest; 157*cdf0e10cSrcweir if ( aRequest >>= aParamRequest ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir implHandle( aParamRequest, aContinuations ); 160*cdf0e10cSrcweir return sal_True; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir DocumentSaveRequest aDocuRequest; 164*cdf0e10cSrcweir if ( aRequest >>= aDocuRequest ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir implHandle( aDocuRequest, aContinuations ); 167*cdf0e10cSrcweir return sal_True; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir if ( m_bFallbackToGeneric ) 171*cdf0e10cSrcweir return implHandleUnknown( i_Request ); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir return sal_False; 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir //------------------------------------------------------------------------- 177*cdf0e10cSrcweir void BasicInteractionHandler::implHandle(const ParametersRequest& _rParamRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 180*cdf0e10cSrcweir // want to open a dialog .... 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir sal_Int32 nAbortPos = getContinuation(ABORT, _rContinuations); 183*cdf0e10cSrcweir sal_Int32 nParamPos = getContinuation(SUPPLY_PARAMETERS, _rContinuations); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir Reference< XInteractionSupplyParameters > xParamCallback; 186*cdf0e10cSrcweir if (-1 != nParamPos) 187*cdf0e10cSrcweir xParamCallback = Reference< XInteractionSupplyParameters >(_rContinuations[nParamPos], UNO_QUERY); 188*cdf0e10cSrcweir DBG_ASSERT(xParamCallback.is(), "BasicInteractionHandler::implHandle(ParametersRequest): can't set the parameters without an appropriate interaction handler!s"); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir // determine the style of the dialog, dependent on the present continuation types 191*cdf0e10cSrcweir WinBits nDialogStyle = WB_OK | WB_DEF_OK; 192*cdf0e10cSrcweir if (-1 != nAbortPos) 193*cdf0e10cSrcweir nDialogStyle = WB_OK_CANCEL; 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir OParameterDialog aDlg(NULL, _rParamRequest.Parameters, _rParamRequest.Connection, m_xORB); 196*cdf0e10cSrcweir sal_Int16 nResult = aDlg.Execute(); 197*cdf0e10cSrcweir try 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir switch (nResult) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir case RET_OK: 202*cdf0e10cSrcweir if (xParamCallback.is()) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir xParamCallback->setParameters(aDlg.getValues()); 205*cdf0e10cSrcweir xParamCallback->select(); 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir break; 208*cdf0e10cSrcweir default: 209*cdf0e10cSrcweir if (-1 != nAbortPos) 210*cdf0e10cSrcweir _rContinuations[nAbortPos]->select(); 211*cdf0e10cSrcweir break; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir catch( const Exception& ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir //------------------------------------------------------------------------- 221*cdf0e10cSrcweir void BasicInteractionHandler::implHandle(const SQLExceptionInfo& _rSqlInfo, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 224*cdf0e10cSrcweir // want to open a dialog .... 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir sal_Int32 nApprovePos = getContinuation(APPROVE, _rContinuations); 227*cdf0e10cSrcweir sal_Int32 nDisapprovePos = getContinuation(DISAPPROVE, _rContinuations); 228*cdf0e10cSrcweir sal_Int32 nAbortPos = getContinuation(ABORT, _rContinuations); 229*cdf0e10cSrcweir sal_Int32 nRetryPos = getContinuation(RETRY, _rContinuations); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // determine the style of the dialog, dependent on the present continuation types 232*cdf0e10cSrcweir WinBits nDialogStyle = 0; 233*cdf0e10cSrcweir bool bHaveCancel = nAbortPos != -1; 234*cdf0e10cSrcweir // "approve" means "Yes", "disapprove" means "No" 235*cdf0e10cSrcweir // VCL only supports having both (which makes sense ...) 236*cdf0e10cSrcweir if ( ( nApprovePos != -1 ) || ( nDisapprovePos != -1 ) ) 237*cdf0e10cSrcweir nDialogStyle = ( bHaveCancel ? WB_YES_NO_CANCEL : WB_YES_NO ) | WB_DEF_YES; 238*cdf0e10cSrcweir else 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir // if there's no yes/no, then use a default OK button 241*cdf0e10cSrcweir nDialogStyle = ( bHaveCancel ? WB_OK_CANCEL : WB_OK ) | WB_DEF_OK; 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir // If there's a "Retry" continuation, have a "Retry" button 245*cdf0e10cSrcweir if ( nRetryPos != -1 ) 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir nDialogStyle = WB_RETRY_CANCEL | WB_DEF_RETRY; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir // excute the dialog 251*cdf0e10cSrcweir OSQLMessageBox aDialog(NULL, _rSqlInfo, nDialogStyle); 252*cdf0e10cSrcweir // TODO: need a way to specify the parent window 253*cdf0e10cSrcweir sal_Int16 nResult = aDialog.Execute(); 254*cdf0e10cSrcweir try 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir switch (nResult) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir case RET_YES: 259*cdf0e10cSrcweir case RET_OK: 260*cdf0e10cSrcweir if ( nApprovePos != -1 ) 261*cdf0e10cSrcweir _rContinuations[ nApprovePos ]->select(); 262*cdf0e10cSrcweir else 263*cdf0e10cSrcweir OSL_ENSURE( nResult != RET_YES, "BasicInteractionHandler::implHandle: no handler for YES!" ); 264*cdf0e10cSrcweir break; 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir case RET_NO: 267*cdf0e10cSrcweir if ( nDisapprovePos != -1 ) 268*cdf0e10cSrcweir _rContinuations[ nDisapprovePos ]->select(); 269*cdf0e10cSrcweir else 270*cdf0e10cSrcweir OSL_ENSURE( false, "BasicInteractionHandler::implHandle: no handler for NO!" ); 271*cdf0e10cSrcweir break; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir case RET_CANCEL: 274*cdf0e10cSrcweir if ( nAbortPos != -1 ) 275*cdf0e10cSrcweir _rContinuations[ nAbortPos ]->select(); 276*cdf0e10cSrcweir else if ( nDisapprovePos != -1 ) 277*cdf0e10cSrcweir _rContinuations[ nDisapprovePos ]->select(); 278*cdf0e10cSrcweir else 279*cdf0e10cSrcweir OSL_ENSURE( false, "BasicInteractionHandler::implHandle: no handler for CANCEL!" ); 280*cdf0e10cSrcweir break; 281*cdf0e10cSrcweir case RET_RETRY: 282*cdf0e10cSrcweir if ( nRetryPos != -1 ) 283*cdf0e10cSrcweir _rContinuations[ nRetryPos ]->select(); 284*cdf0e10cSrcweir else 285*cdf0e10cSrcweir OSL_ENSURE( false, "BasicInteractionHandler::implHandle: where does the RETRY come from?" ); 286*cdf0e10cSrcweir break; 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir catch( const Exception& ) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir //------------------------------------------------------------------------- 295*cdf0e10cSrcweir void BasicInteractionHandler::implHandle(const DocumentSaveRequest& _rDocuRequest, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir ::vos::OGuard aGuard(Application::GetSolarMutex()); 298*cdf0e10cSrcweir // want to open a dialog .... 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir sal_Int32 nApprovePos = getContinuation(APPROVE, _rContinuations); 301*cdf0e10cSrcweir sal_Int32 nDisApprovePos = getContinuation(DISAPPROVE, _rContinuations); 302*cdf0e10cSrcweir sal_Int32 nAbortPos = getContinuation(ABORT, _rContinuations); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir short nRet = RET_YES; 305*cdf0e10cSrcweir if ( -1 != nApprovePos ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir // fragen, ob gespeichert werden soll 308*cdf0e10cSrcweir nRet = ExecuteQuerySaveDocument(NULL,_rDocuRequest.Name); 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir if ( RET_CANCEL == nRet ) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir if (-1 != nAbortPos) 314*cdf0e10cSrcweir _rContinuations[nAbortPos]->select(); 315*cdf0e10cSrcweir return; 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir else if ( RET_YES == nRet ) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir sal_Int32 nDocuPos = getContinuation(SUPPLY_DOCUMENTSAVE, _rContinuations); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir if (-1 != nDocuPos) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir Reference< XInteractionDocumentSave > xCallback(_rContinuations[nDocuPos], UNO_QUERY); 324*cdf0e10cSrcweir DBG_ASSERT(xCallback.is(), "BasicInteractionHandler::implHandle(DocumentSaveRequest): can't save document without an appropriate interaction handler!s"); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir // determine the style of the dialog, dependent on the present continuation types 327*cdf0e10cSrcweir WinBits nDialogStyle = WB_OK | WB_DEF_OK; 328*cdf0e10cSrcweir if (-1 != nAbortPos) 329*cdf0e10cSrcweir nDialogStyle = WB_OK_CANCEL; 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir OCollectionView aDlg(NULL,_rDocuRequest.Content,_rDocuRequest.Name,m_xORB); 332*cdf0e10cSrcweir sal_Int16 nResult = aDlg.Execute(); 333*cdf0e10cSrcweir try 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir switch (nResult) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir case RET_OK: 338*cdf0e10cSrcweir if (xCallback.is()) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir xCallback->setName(aDlg.getName(),aDlg.getSelectedFolder()); 341*cdf0e10cSrcweir xCallback->select(); 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir break; 344*cdf0e10cSrcweir default: 345*cdf0e10cSrcweir if (-1 != nAbortPos) 346*cdf0e10cSrcweir _rContinuations[nAbortPos]->select(); 347*cdf0e10cSrcweir break; 348*cdf0e10cSrcweir } 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir catch( const Exception& ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir else if ( -1 != nApprovePos ) 356*cdf0e10cSrcweir _rContinuations[nApprovePos]->select(); 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir else if ( -1 != nDisApprovePos ) 359*cdf0e10cSrcweir _rContinuations[nDisApprovePos]->select(); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir //------------------------------------------------------------------------- 363*cdf0e10cSrcweir bool BasicInteractionHandler::implHandleUnknown( const Reference< XInteractionRequest >& _rxRequest ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir Reference< XInteractionHandler > xFallbackHandler; 366*cdf0e10cSrcweir if ( m_xORB.is() ) 367*cdf0e10cSrcweir xFallbackHandler = xFallbackHandler.query( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ) ); 368*cdf0e10cSrcweir if ( xFallbackHandler.is() ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir xFallbackHandler->handle( _rxRequest ); 371*cdf0e10cSrcweir return true; 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir return false; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir //------------------------------------------------------------------------- 377*cdf0e10cSrcweir sal_Int32 BasicInteractionHandler::getContinuation(Continuation _eCont, const Sequence< Reference< XInteractionContinuation > >& _rContinuations) 378*cdf0e10cSrcweir { 379*cdf0e10cSrcweir const Reference< XInteractionContinuation >* pContinuations = _rContinuations.getConstArray(); 380*cdf0e10cSrcweir for (sal_Int32 i=0; i<_rContinuations.getLength(); ++i, ++pContinuations) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir switch (_eCont) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir case APPROVE: 385*cdf0e10cSrcweir if (Reference< XInteractionApprove >(*pContinuations, UNO_QUERY).is()) 386*cdf0e10cSrcweir return i; 387*cdf0e10cSrcweir break; 388*cdf0e10cSrcweir case DISAPPROVE: 389*cdf0e10cSrcweir if (Reference< XInteractionDisapprove >(*pContinuations, UNO_QUERY).is()) 390*cdf0e10cSrcweir return i; 391*cdf0e10cSrcweir break; 392*cdf0e10cSrcweir case RETRY: 393*cdf0e10cSrcweir if (Reference< XInteractionRetry >(*pContinuations, UNO_QUERY).is()) 394*cdf0e10cSrcweir return i; 395*cdf0e10cSrcweir break; 396*cdf0e10cSrcweir case ABORT: 397*cdf0e10cSrcweir if (Reference< XInteractionAbort >(*pContinuations, UNO_QUERY).is()) 398*cdf0e10cSrcweir return i; 399*cdf0e10cSrcweir break; 400*cdf0e10cSrcweir case SUPPLY_PARAMETERS: 401*cdf0e10cSrcweir if (Reference< XInteractionSupplyParameters >(*pContinuations, UNO_QUERY).is()) 402*cdf0e10cSrcweir return i; 403*cdf0e10cSrcweir break; 404*cdf0e10cSrcweir case SUPPLY_DOCUMENTSAVE: 405*cdf0e10cSrcweir if (Reference< XInteractionDocumentSave >(*pContinuations, UNO_QUERY).is()) 406*cdf0e10cSrcweir return i; 407*cdf0e10cSrcweir break; 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir return -1; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir //========================================================================== 415*cdf0e10cSrcweir //= SQLExceptionInteractionHandler 416*cdf0e10cSrcweir //========================================================================== 417*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO1_STATIC( SQLExceptionInteractionHandler, "com.sun.star.comp.dbaccess.DatabaseInteractionHandler", "com.sun.star.sdb.DatabaseInteractionHandler" ); 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir //========================================================================== 420*cdf0e10cSrcweir //= LegacyInteractionHandler 421*cdf0e10cSrcweir //========================================================================== 422*cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO1_STATIC( LegacyInteractionHandler, "com.sun.star.comp.dbaccess.LegacyInteractionHandler", "com.sun.star.sdb.InteractionHandler" ); 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir //......................................................................... 425*cdf0e10cSrcweir } // namespace dbaui 426*cdf0e10cSrcweir //......................................................................... 427*cdf0e10cSrcweir 428