merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / uno / dbinteraction.hxx
blobfdaa9b4755d2e8cce67ddd3c92b6e62de9a7fb9b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbinteraction.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_INTERACTION_HXX_
32 #define _DBAUI_INTERACTION_HXX_
34 #ifndef _CPPUHELPER_IMPLBASE2_HXX_
35 #include <cppuhelper/implbase2.hxx>
36 #endif
38 #ifndef _DBAUI_MODULE_DBU_HXX_
39 #include "moduledbu.hxx"
40 #endif
41 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #endif
44 #ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
45 #include <com/sun/star/task/XInteractionHandler.hpp>
46 #endif
47 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
48 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
49 #endif
50 #ifndef _COM_SUN_STAR_UCB_AUTHENTICATIONREQUEST_HPP_
51 #include <com/sun/star/ucb/AuthenticationRequest.hpp>
52 #endif
53 #ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_
54 #include <com/sun/star/sdb/ParametersRequest.hpp>
55 #endif
56 #ifndef _COM_SUN_STAR_SDB_DOCUMENTSAVEREQUEST_HPP_
57 #include <com/sun/star/sdb/DocumentSaveRequest.hpp>
58 #endif
59 #ifndef _DBASHARED_APITOOLS_HXX_
60 #include "apitools.hxx"
61 #endif
63 namespace dbtools
65 class SQLExceptionInfo;
68 //.........................................................................
69 namespace dbaui
71 //.........................................................................
73 //=========================================================================
74 //= OInteractionHandler
75 //=========================================================================
76 typedef ::cppu::WeakImplHelper2 < ::com::sun::star::lang::XServiceInfo
77 , ::com::sun::star::task::XInteractionHandler
78 > OInteractionHandler_Base;
79 /** implements an <type scope="com.sun.star.task">XInteractionHandler</type> for
80 database related interaction requests.
81 <p/>
82 Supported interaction requests by now (specified by an exception: The appropriate exception
83 has to be returned by the getRequest method of the object implementing the
84 <type scope="com.sun.star.task">XInteractionRequest</type> interface.
85 <ul>
86 <li><b><type scope="com.sun.star.sdbc">SQLException</type></b>: requests to display a
87 standard error dialog for the (maybe chained) exception given</li>
88 </ul>
90 class OInteractionHandler
91 :public OInteractionHandler_Base
93 OModuleClient m_aModuleClient;
94 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
95 m_xORB;
96 public:
97 OInteractionHandler(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
99 // XServiceInfo
100 DECLARE_SERVICE_INFO_STATIC();
102 // XInteractionHandler
103 virtual void SAL_CALL handle( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& Request ) throw(::com::sun::star::uno::RuntimeException);
105 protected:
106 /// handle SQLExceptions (and derived classes)
107 void implHandle(
108 const ::dbtools::SQLExceptionInfo& _rSqlInfo,
109 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
111 /// handle parameter requests
112 void implHandle(
113 const ::com::sun::star::sdb::ParametersRequest& _rParamRequest,
114 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
116 /// handle document save requests
117 void implHandle(
118 const ::com::sun::star::sdb::DocumentSaveRequest& _rParamRequest,
119 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
121 /// handles requests which are not SDB-specific
122 bool implHandleUnknown(
123 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& _rxRequest );
125 /// known continuation types
126 enum Continuation
128 APPROVE,
129 DISAPPROVE,
130 RETRY,
131 ABORT,
132 SUPPLY_PARAMETERS,
133 SUPPLY_DOCUMENTSAVE
135 /** check if a given continuation sequence contains a given continuation type<p/>
136 @return the index within <arg>_rContinuations</arg> of the first occurence of a continuation
137 of the requested type, -1 of no such continuation exists
139 sal_Int32 getContinuation(
140 Continuation _eCont,
141 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >& _rContinuations);
144 //.........................................................................
145 } // namespace dbaui
146 //.........................................................................
148 #endif // _DBAUI_INTERACTION_HXX_