LibreOffice Module ucbhelper (master) 1
simpleinteractionrequest.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
22
23#include <osl/diagnose.h>
24#include <rtl/ref.hxx>
25
26using namespace com::sun::star;
27using namespace ucbhelper;
28
29
30SimpleInteractionRequest::SimpleInteractionRequest(
31 const uno::Any & rRequest,
32 const ContinuationFlags nContinuations )
33: InteractionRequest( rRequest )
34{
35 // Set continuations.
36 OSL_ENSURE( nContinuations != ContinuationFlags::NONE,
37 "SimpleInteractionRequest - No continuation!" );
38
39 std::vector< uno::Reference< task::XInteractionContinuation > > aContinuations;
40 if ( nContinuations & ContinuationFlags::Abort )
41 {
42 aContinuations.push_back( new InteractionAbort( this ) );
43 }
44 if ( nContinuations & ContinuationFlags::Retry )
45 {
46 aContinuations.push_back( new InteractionRetry( this ) );
47 }
48 if ( nContinuations & ContinuationFlags::Approve )
49 {
50 aContinuations.push_back( new InteractionApprove( this ) );
51 }
52 if ( nContinuations & ContinuationFlags::Disapprove )
53 {
54 aContinuations.push_back( new InteractionDisapprove( this ) );
55 }
57}
58
59
61{
63 if ( xSelection.is() )
64 {
65 InteractionContinuation * pSelection = xSelection.get();
66
67 uno::Reference< task::XInteractionAbort > xAbort(
68 pSelection, uno::UNO_QUERY );
69 if ( xAbort.is() )
71
72 uno::Reference< task::XInteractionRetry > xRetry(
73 pSelection, uno::UNO_QUERY );
74 if ( xRetry.is() )
76
77 uno::Reference< task::XInteractionApprove > xApprove(
78 pSelection, uno::UNO_QUERY );
79 if ( xApprove.is() )
81
82 uno::Reference< task::XInteractionDisapprove > xDisapprove(
83 pSelection, uno::UNO_QUERY );
84 if ( xDisapprove.is() )
86
87 OSL_FAIL( "SimpleInteractionRequest::getResponse - Unknown continuation!" );
88 }
90}
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class implements a standard interaction continuation, namely the interface XInteractionAbort.
This class implements a standard interaction continuation, namely the interface XInteractionApprove.
This class is the base for implementations of the interface XInteractionContinuation.
This class implements a standard interaction continuation, namely the interface XInteractionDisapprov...
rtl::Reference< InteractionContinuation > const & getSelection() const
After passing this request to XInteractionHandler::handle, this method returns the continuation that ...
void setContinuations(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &rContinuations)
This method sets the continuations for the request.
This class implements a standard interaction continuation, namely the interface XInteractionRetry.
ContinuationFlags getResponse() const
After passing this request to XInteractionHandler::handle, this method returns the continuation that ...
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
ContinuationFlags
These are the constants that can be passed to the constructor of class SimpleInteractionRequest and t...
@ Disapprove
The interaction handler selected XInteractionDisapprove.
@ Retry
The interaction handler selected XInteractionRetry.
@ Approve
The interaction handler selected XInteractionApprove.
@ Abort
The interaction handler selected XInteractionAbort.
@ NONE
The request was not (yet) handled by the interaction handler.