LibreOffice Module ucbhelper (master)  1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
ucbhelper::InterceptedInteraction Class Reference

it wraps any other interaction handler and intercept its handle() requests. More...

#include <interceptedinteraction.hxx>

Inheritance diagram for ucbhelper::InterceptedInteraction:
[legend]
Collaboration diagram for ucbhelper::InterceptedInteraction:
[legend]

Classes

struct  InterceptedRequest
 

Public Types

enum  EInterceptionState {
  E_NOT_INTERCEPTED,
  E_NO_CONTINUATION_FOUND,
  E_INTERCEPTED
}
 represent the different states, which can occur as result of an interception. More...
 

Public Member Functions

 InterceptedInteraction ()
 initialize a new instance with default values. More...
 
void setInterceptedHandler (const css::uno::Reference< css::task::XInteractionHandler > &xInterceptedHandler)
 initialize a new instance with the interaction handler, which should be intercepted. More...
 
void setInterceptions (const ::std::vector< InterceptedRequest > &lInterceptions)
 set a new list of intercepted interactions. More...
 
virtual void SAL_CALL handle (const css::uno::Reference< css::task::XInteractionRequest > &xRequest) override
 implements the default handling of this class... More...
 

Static Public Member Functions

static css::uno::Reference< css::task::XInteractionContinuation > extractContinuation (const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &lContinuations, const css::uno::Type &aType)
 extract a requested continuation from the list of available ones. More...
 

Protected Member Functions

virtual EInterceptionState intercepted (const InterceptedRequest &rRequest, const css::uno::Reference< css::task::XInteractionRequest > &xOrgRequest)
 can be overwritten by a derived class to handle interceptions outside. More...
 

Protected Attributes

css::uno::Reference< css::task::XInteractionHandler > m_xInterceptedHandler
 reference to the intercepted interaction handler. More...
 
::std::vector< InterceptedRequestm_lInterceptions
 these list contains the requests, which should be intercepted. More...
 

Private Member Functions

UCBHELPER_DLLPRIVATE void impl_handleDefault (const css::uno::Reference< css::task::XInteractionRequest > &xRequest)
 implements the default handling: More...
 
UCBHELPER_DLLPRIVATE EInterceptionState impl_interceptRequest (const css::uno::Reference< css::task::XInteractionRequest > &xRequest)
 implements the interception of requests. More...
 

Detailed Description

it wraps any other interaction handler and intercept its handle() requests.

This class can be used as:

Definition at line 44 of file interceptedinteraction.hxx.

Member Enumeration Documentation

represent the different states, which can occur as result of an interception.

See also
impl_interceptRequest()
Enumerator
E_NOT_INTERCEPTED 

none of the specified interceptions match the incoming request

E_NO_CONTINUATION_FOUND 

the request could be intercepted - but the specified continuation could not be located.

That's normally an error of the programmer. May be the interaction request does not use the right set of continuations ... or the interception list contains the wrong continuation.

E_INTERCEPTED 

the request could be intercepted and the specified continuation could be selected successfully.

Definition at line 96 of file interceptedinteraction.hxx.

Constructor & Destructor Documentation

ucbhelper::InterceptedInteraction::InterceptedInteraction ( )

initialize a new instance with default values.

Definition at line 26 of file interceptedinteraction.cxx.

Member Function Documentation

css::uno::Reference< css::task::XInteractionContinuation > ucbhelper::InterceptedInteraction::extractContinuation ( const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &  lContinuations,
const css::uno::Type &  aType 
)
static

extract a requested continuation from the list of available ones.

Parameters
lContinuationsthe list of available continuations.
aTypeis used to locate the right continuation, by checking its interface type.
Returns
A valid reference to the continuation, if it could be located... or an empty reference otherwise.

Definition at line 48 of file interceptedinteraction.cxx.

Referenced by impl_interceptRequest().

void SAL_CALL ucbhelper::InterceptedInteraction::handle ( const css::uno::Reference< css::task::XInteractionRequest > &  xRequest)
overridevirtual

implements the default handling of this class...

or can be overwritten by any derived class.

If no further class is derived from this one -> the default implementation is used. Then the internal list of requests is used to handle different interactions automatically. (see impl_interceptRequest())

If this method was overwritten by a derived implementation -> the new implementation has to do everything by itself. Of course it can access all members/helpers and work with it. But the default implementation is not used automatically then.

Parameters
xRequestthe interaction request, which should be intercepted.

Definition at line 62 of file interceptedinteraction.cxx.

References impl_handleDefault().

void ucbhelper::InterceptedInteraction::impl_handleDefault ( const css::uno::Reference< css::task::XInteractionRequest > &  xRequest)
private

implements the default handling:

  • intercept or forward to internal handler.

Definition at line 67 of file interceptedinteraction.cxx.

References E_INTERCEPTED, E_NO_CONTINUATION_FOUND, E_NOT_INTERCEPTED, impl_interceptRequest(), and m_xInterceptedHandler.

Referenced by handle().

InterceptedInteraction::EInterceptionState ucbhelper::InterceptedInteraction::impl_interceptRequest ( const css::uno::Reference< css::task::XInteractionRequest > &  xRequest)
private

implements the interception of requests.

The incoming request will be analyzed, if it match any request of the m_lIntercepions list. If an interception could be found, its continuation will be searched and selected.

The method return the state of that operation. But it doesn't call the intercepted and here set interaction handler. That has to be done in the outside method.

Parameters
xRequestthe interaction request, which should be intercepted.
Returns
A identifier, which indicates if the request was intercepted, the continuation was found and selected... or not.

Definition at line 96 of file interceptedinteraction.cxx.

References ucbhelper::InterceptedInteraction::InterceptedRequest::Continuation, E_INTERCEPTED, E_NO_CONTINUATION_FOUND, E_NOT_INTERCEPTED, extractContinuation(), intercepted(), and m_lInterceptions.

Referenced by impl_handleDefault().

InterceptedInteraction::EInterceptionState ucbhelper::InterceptedInteraction::intercepted ( const InterceptedRequest rRequest,
const css::uno::Reference< css::task::XInteractionRequest > &  xOrgRequest 
)
protectedvirtual

can be overwritten by a derived class to handle interceptions outside.

This base implementation checks, if the request could be intercepted successfully. Then this method intercepted() is called. The default implementation returns "NOT_INTERCEPTED" every time. So the method impl_interceptRequest() uses the right continuation automatically.

If this method was overwritten and something different "NO_INTERCEPTED" is returned, the method impl_interceptRequest() will return immediately with the result, which is returned by this intercepted() method. Then the continuations must be selected inside the intercepted() call!

Parameters
rRequestit points to the intercepted request (means the item of the set interception list). e.g. its "Handle" member can be used to identify it and react very easy, without the need to check the type of the exception ...
xOrgRequestpoints to the original interaction, which was intercepted. It provides access to the exception and the list of possible continuations.
Returns
The result of this operation. Note: If E_NOT_INTERCEPTED is returned the default handling of the base class will be used automatically for this request!

Definition at line 40 of file interceptedinteraction.cxx.

References E_NOT_INTERCEPTED.

Referenced by impl_interceptRequest().

void ucbhelper::InterceptedInteraction::setInterceptedHandler ( const css::uno::Reference< css::task::XInteractionHandler > &  xInterceptedHandler)

initialize a new instance with the interaction handler, which should be intercepted.

Attention:
If such interaction handler isn't set here, all incoming requests will be aborted ... if the right continuation is available!
Parameters
xInterceptedHandlerthe outside interaction handler, which should be intercepted here.

Definition at line 30 of file interceptedinteraction.cxx.

References m_xInterceptedHandler.

void ucbhelper::InterceptedInteraction::setInterceptions ( const ::std::vector< InterceptedRequest > &  lInterceptions)

set a new list of intercepted interactions.

Attention:
If the interface method handle() will be overwritten by a derived class, the functionality behind these static list can't be used.
Parameters
lInterceptionsthe list of intercepted requests.

Definition at line 35 of file interceptedinteraction.cxx.

References m_lInterceptions.

Member Data Documentation

::std::vector< InterceptedRequest > ucbhelper::InterceptedInteraction::m_lInterceptions
protected

these list contains the requests, which should be intercepted.

Definition at line 125 of file interceptedinteraction.hxx.

Referenced by impl_interceptRequest(), and setInterceptions().

css::uno::Reference< css::task::XInteractionHandler > ucbhelper::InterceptedInteraction::m_xInterceptedHandler
protected

reference to the intercepted interaction handler.

NULL is allowed for this member! All interaction will be aborted then ... expecting th handle() was overwritten by a derived class.

Definition at line 120 of file interceptedinteraction.hxx.

Referenced by impl_handleDefault(), and setInterceptedHandler().


The documentation for this class was generated from the following files: