Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / ucbhelper / simpleinteractionrequest.hxx
blob64b892ae801de612615d07e1e94347f29d65d39e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
21 #define INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX
23 #include <ucbhelper/interactionrequest.hxx>
24 #include <ucbhelper/ucbhelperdllapi.h>
25 #include <o3tl/typed_flags_set.hxx>
27 /** These are the constants that can be passed to the constructor of class
28 * SimpleInteractionRequest and that are returned by method
29 * SimpleInteractionRequest::getResponse().
32 enum class ContinuationFlags {
33 /** The request was not (yet) handled by the interaction handler. */
34 NONE = 0,
35 /** The interaction handler selected XInteractionAbort. */
36 Abort = 1,
37 /** The interaction handler selected XInteractionRetry. */
38 Retry = 2,
39 /** The interaction handler selected XInteractionApprove. */
40 Approve = 4,
41 /** The interaction handler selected XInteractionDisapprove. */
42 Disapprove = 8,
44 namespace o3tl
46 template<> struct typed_flags<ContinuationFlags> : is_typed_flags<ContinuationFlags, 0x0f> {};
49 namespace ucbhelper {
51 /**
52 * This class implements a simple interaction request. The user must not deal
53 * with XInteractionContinuations directly, but can use constants that are
54 * mapped internally to the according objects. This class encapsulates the
55 * standard Interaction Continuations "Abort", "Retry", "Approve" and
56 * "Disapprove". Instances can be passed directly to
57 * XInteractionHandler::handle(...).
59 * @see InteractionRequest
60 * @see InteractionAbort
61 * @see InteractionRetry
62 * @see InteractionApprove
63 * @see InteractionDisapprove
65 class UCBHELPER_DLLPUBLIC SimpleInteractionRequest : public ucbhelper::InteractionRequest
67 public:
68 /**
69 * Constructor.
71 * @param rRequest is the exception describing the error.
72 * @param nContinuations contains the possible "answers" for the request.
73 * This can be any of the CONTINUATION_* constants combinations
74 * listed above.
76 SimpleInteractionRequest( const css::uno::Any & rRequest,
77 const ContinuationFlags nContinuations );
79 /**
80 * After passing this request to XInteractionHandler::handle, this method
81 * returns the continuation that was chosen by the interaction handler.
83 * @return the continuation chosen by an interaction handler or
84 * ContinuationFlags::NONE, if the request was not (yet) handled.
86 ContinuationFlags getResponse() const;
89 } // namespace ucbhelper
91 #endif /* ! INCLUDED_UCBHELPER_SIMPLEINTERACTIONREQUEST_HXX */
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */