summaryrefslogtreecommitdiff
path: root/ucbhelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-09-23 13:42:44 +0200
committerNoel Grandin <noel@peralex.com>2016-09-26 08:29:38 +0200
commit7f97b5e72c61066ea1ddd0f782e50070ce5f6363 (patch)
tree410d4ff48adff9a3ec535e96efe8240d660f0a05 /ucbhelper
parent69c29c9f895fa58c923af5e6dee1226f8bbfeceb (diff)
convert CONTINUATION constants to typed_flags_set
Change-Id: I38333e5d229aa520fbe0a8ad72007c503853956e
Diffstat (limited to 'ucbhelper')
-rw-r--r--ucbhelper/source/provider/simpleinteractionrequest.cxx71
1 files changed, 19 insertions, 52 deletions
diff --git a/ucbhelper/source/provider/simpleinteractionrequest.cxx b/ucbhelper/source/provider/simpleinteractionrequest.cxx
index ea4d7ef5bb5f..69f8ba4906f3 100644
--- a/ucbhelper/source/provider/simpleinteractionrequest.cxx
+++ b/ucbhelper/source/provider/simpleinteractionrequest.cxx
@@ -18,6 +18,7 @@
*/
#include <ucbhelper/simpleinteractionrequest.hxx>
+#include <comphelper/sequence.hxx>
#include <osl/diagnose.h>
@@ -27,69 +28,35 @@ using namespace ucbhelper;
SimpleInteractionRequest::SimpleInteractionRequest(
const uno::Any & rRequest,
- const sal_Int32 nContinuations )
+ const ContinuationFlags nContinuations )
: InteractionRequest( rRequest )
{
// Set continuations.
- OSL_ENSURE( nContinuations != CONTINUATION_UNKNOWN,
+ OSL_ENSURE( nContinuations != ContinuationFlags::NONE,
"SimpleInteractionRequest - No continuation!" );
- sal_Int32 nLength = 0;
-
- uno::Reference< task::XInteractionContinuation > xAbort;
- uno::Reference< task::XInteractionContinuation > xRetry;
- uno::Reference< task::XInteractionContinuation > xApprove;
- uno::Reference< task::XInteractionContinuation > xDisapprove;
-
- if ( nContinuations & CONTINUATION_ABORT )
+ std::vector< uno::Reference< task::XInteractionContinuation > > aContinuations;
+ if ( nContinuations & ContinuationFlags::Abort )
{
- ++nLength;
- xAbort = new InteractionAbort( this );
+ aContinuations.push_back( new InteractionAbort( this ) );
}
-
- if ( nContinuations & CONTINUATION_RETRY )
+ if ( nContinuations & ContinuationFlags::Retry )
{
- ++nLength;
- xRetry = new InteractionRetry( this );
+ aContinuations.push_back( new InteractionRetry( this ) );
}
-
- if ( nContinuations & CONTINUATION_APPROVE )
+ if ( nContinuations & ContinuationFlags::Approve )
{
- ++nLength;
- xApprove = new InteractionApprove( this );
+ aContinuations.push_back( new InteractionApprove( this ) );
}
-
- if ( nContinuations & CONTINUATION_DISAPPROVE )
+ if ( nContinuations & ContinuationFlags::Disapprove )
{
- ++nLength;
- xDisapprove = new InteractionDisapprove( this );
+ aContinuations.push_back( new InteractionDisapprove( this ) );
}
-
- OSL_ENSURE( nLength > 0,
- "SimpleInteractionRequest - No continuation!" );
-
- uno::Sequence< uno::Reference< task::XInteractionContinuation > >
- aContinuations( nLength );
-
- nLength = 0;
-
- if ( xAbort.is() )
- aContinuations[ nLength++ ] = xAbort;
-
- if ( xRetry.is() )
- aContinuations[ nLength++ ] = xRetry;
-
- if ( xApprove.is() )
- aContinuations[ nLength++ ] = xApprove;
-
- if ( xDisapprove.is() )
- aContinuations[ nLength++ ] = xDisapprove;
-
- setContinuations( aContinuations );
+ setContinuations( comphelper::containerToSequence(aContinuations) );
}
-sal_Int32 SimpleInteractionRequest::getResponse() const
+ContinuationFlags SimpleInteractionRequest::getResponse() const
{
rtl::Reference< InteractionContinuation > xSelection = getSelection();
if ( xSelection.is() )
@@ -99,26 +66,26 @@ sal_Int32 SimpleInteractionRequest::getResponse() const
uno::Reference< task::XInteractionAbort > xAbort(
pSelection, uno::UNO_QUERY );
if ( xAbort.is() )
- return CONTINUATION_ABORT;
+ return ContinuationFlags::Abort;
uno::Reference< task::XInteractionRetry > xRetry(
pSelection, uno::UNO_QUERY );
if ( xRetry.is() )
- return CONTINUATION_RETRY;
+ return ContinuationFlags::Retry;
uno::Reference< task::XInteractionApprove > xApprove(
pSelection, uno::UNO_QUERY );
if ( xApprove.is() )
- return CONTINUATION_APPROVE;
+ return ContinuationFlags::Approve;
uno::Reference< task::XInteractionDisapprove > xDisapprove(
pSelection, uno::UNO_QUERY );
if ( xDisapprove.is() )
- return CONTINUATION_DISAPPROVE;
+ return ContinuationFlags::Disapprove;
OSL_FAIL( "SimpleInteractionRequest::getResponse - Unknown continuation!" );
}
- return CONTINUATION_UNKNOWN;
+ return ContinuationFlags::NONE;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */