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