1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
25 #define _UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
26 
27 #include <ucbhelper/interactionrequest.hxx>
28 #include "ucbhelper/ucbhelperdllapi.h"
29 
30 namespace ucbhelper {
31 
32 /** These are the constants that can be passed to the constructor of class
33   * SimpleInteractionRequest and that are returned by method
34   * SimpleInteractionRequest::getResponse().
35   */
36 
37 /** The request was not (yet) handled by the interaction handler. */
38 static const sal_Int32 CONTINUATION_UNKNOWN    = 0;
39 
40 /** The interaction handler selected XInteractionAbort. */
41 static const sal_Int32 CONTINUATION_ABORT      = 1;
42 
43 /** The interaction handler selected XInteractionRetry. */
44 static const sal_Int32 CONTINUATION_RETRY      = 2;
45 
46 /** The interaction handler selected XInteractionApprove. */
47 static const sal_Int32 CONTINUATION_APPROVE    = 4;
48 
49 /** The interaction handler selected XInteractionDisapprove. */
50 static const sal_Int32 CONTINUATION_DISAPPROVE = 8;
51 
52 /**
53   * This class implements a simple interaction request. The user must not deal
54   * with XInteractionContinuations directly, but can use constants that are
55   * mapped internally to the according objects. This class encapsulates the
56   * standard Interaction Continuations "Abort", "Retry", "Approve" and
57   * "Disaprrove". Instances can be passed directly to
58   * XInteractionHandler::handle(...).
59   *
60   * @see InteractionRequest
61   * @see InteractionAbort
62   * @see InteractionRetry
63   * @see InteractionApprove
64   * @see InteractionDisapprove
65   */
66 class UCBHELPER_DLLPUBLIC SimpleInteractionRequest : public ucbhelper::InteractionRequest
67 {
68 public:
69     /**
70       * Constructor.
71       *
72       * @param rRequest is the exception describing the error.
73       * @param nContinuations contains the possible "answers" for the request.
74       *        This can be any of the CONTINUATION_* constants combinations
75       *        listed above.
76 	  */
77     SimpleInteractionRequest( const com::sun::star::uno::Any & rRequest,
78                               const sal_Int32 nContinuations );
79 
80     /**
81       * After passing this request to XInteractionHandler::handle, this method
82       * returns the continuation that was chosen by the interaction handler.
83 	  *
84       * @return the continuation chosen by an interaction handler or
85       *         CONTINUATION_UNKNOWN, if the request was not (yet) handled.
86 	  */
87     sal_Int32 getResponse() const;
88 };
89 
90 } // namespace ucbhelper
91 
92 #endif /* !_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX */
93