LibreOffice Module framework (master) 1
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
framework::InterceptionHelper Class Referencefinal

implements a helper to support interception with additional functionality. More...

#include <interceptionhelper.hxx>

Inheritance diagram for framework::InterceptionHelper:
[legend]
Collaboration diagram for framework::InterceptionHelper:
[legend]

Classes

struct  InterceptorInfo
 bind an interceptor component to its URL pattern registration. More...
 
class  InterceptorList
 implements a list of items of type InterceptorInfo, and provides some special functions on it. More...
 

Public Member Functions

 InterceptionHelper (const css::uno::Reference< css::frame::XFrame > &xOwner, rtl::Reference< DispatchProvider > xSlave)
 creates a new interception helper instance. More...
 
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch (const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags) override
 query for a dispatch, which implements the requested feature. More...
 
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches (const css::uno::Sequence< css::frame::DispatchDescriptor > &lDescriptor) override
 implements an optimized queryDispatch() for remote. More...
 
virtual void SAL_CALL registerDispatchProviderInterceptor (const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &xInterceptor) override
 register an interceptor. More...
 
virtual void SAL_CALL releaseDispatchProviderInterceptor (const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &xInterceptor) override
 release an interceptor. More...
 
virtual void SAL_CALL disposing (const css::lang::EventObject &aEvent) override
 Is called from our owner frame, in case he will be disposed. More...
 
rtl::Reference< DispatchProviderGetSlave () const
 

Private Member Functions

virtual ~InterceptionHelper () override
 standard destructor. More...
 

Private Attributes

css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak
 reference to the frame, which uses this instance to implement its own interception. More...
 
rtl::Reference< DispatchProviderm_xSlave
 this interception helper implements the top level master of an interceptor list ... but this member is the lowest possible slave! More...
 
InterceptorList m_lInterceptionRegs
 contains all registered interceptor objects. More...
 

Detailed Description

implements a helper to support interception with additional functionality.

@descr This helper implements the complete XDispatchProviderInterception interface with master/slave functionality AND using of optional features like registration of URL pattern!

Attention: \n Don't use this class as direct member - use it dynamically. Do not derive from this class.
We hold a weakreference to our owner not to our superclass.

Definition at line 49 of file interceptionhelper.hxx.

Constructor & Destructor Documentation

◆ InterceptionHelper()

framework::InterceptionHelper::InterceptionHelper ( const css::uno::Reference< css::frame::XFrame > &  xOwner,
rtl::Reference< DispatchProvider xSlave 
)

creates a new interception helper instance.

Parameters
xOwnerpoints to the frame, which use this instances to support its own interception interfaces.
xSlavean outside creates dispatch provider, which has to be used here as lowest slave "interceptor".

Definition at line 34 of file interceptionhelper.cxx.

◆ ~InterceptionHelper()

framework::InterceptionHelper::~InterceptionHelper ( )
overrideprivatevirtual

standard destructor.

@descr This method destruct an instance of this class and clear some member. This method is protected, because it's not allowed to use this class as a direct member! You MUST use a dynamical instance (pointer). That's the reason for a protected dtor.

Definition at line 41 of file interceptionhelper.cxx.

Member Function Documentation

◆ disposing()

void SAL_CALL framework::InterceptionHelper::disposing ( const css::lang::EventObject &  aEvent)
overridevirtual

Is called from our owner frame, in case he will be disposed.

@descr We have to release all references to him then. Normally we will die by ref count too...

Definition at line 222 of file interceptionhelper.cxx.

References aEvent, m_lInterceptionRegs, m_xOwnerWeak, and releaseDispatchProviderInterceptor().

◆ GetSlave()

rtl::Reference< DispatchProvider > framework::InterceptionHelper::GetSlave ( ) const
inline

Definition at line 250 of file interceptionhelper.hxx.

References m_xSlave.

◆ queryDispatch()

css::uno::Reference< css::frame::XDispatch > SAL_CALL framework::InterceptionHelper::queryDispatch ( const css::util::URL &  aURL,
const OUString &  sTargetFrameName,
sal_Int32  nSearchFlags 
)
overridevirtual

query for a dispatch, which implements the requested feature.

@descr We search inside our list of interception registrations, to locate any interested interceptor. In case no interceptor exists or nobody is interested on this URL our lowest slave will be used.

Parameters
aURLdescribes the requested dispatch functionality.
sTargetFrameNamethe name of the target frame or a special name like "_blank", "_top" ... Won't be used here ... but may by one of our registered interceptor objects or our slave.
nSearchFlagsoptional search parameter for targeting, if sTargetFrameName isn't a special one.
Returns
A valid dispatch object, if any interceptor or at least our slave is interested on the given URL; or NULL otherwise.

Definition at line 45 of file interceptionhelper.cxx.

References aURL, framework::InterceptionHelper::InterceptorList::findByPattern(), m_lInterceptionRegs, and m_xSlave.

Referenced by queryDispatches().

◆ queryDispatches()

css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL framework::InterceptionHelper::queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor > &  lDescriptor)
overridevirtual

implements an optimized queryDispatch() for remote.

@descr It capsulate more than one queryDispatch() requests and return a list of dispatch objects as result. Because both lists (in and out) correspond together, it's not allowed to pack it - means suppress NULL references!

Parameters
lDescriptora list of queryDispatch() arguments.
Returns
A list of dispatch objects.

Definition at line 91 of file interceptionhelper.cxx.

References i, and queryDispatch().

◆ registerDispatchProviderInterceptor()

void SAL_CALL framework::InterceptionHelper::registerDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &  xInterceptor)
overridevirtual

register an interceptor.

@descr Somebody can register himself to intercept all or some special dispatches. It's depend from his supported interfaces. If he implement XInterceptorInfo he his called for some special URLs only - otherwise we call it for every request!

Attention: \n We don't check for double registrations here!
Parameters
xInterceptorreference to interceptor, which wishes to be registered here.
Exceptions
ARuntimeException if the given reference is NULL!

Definition at line 104 of file interceptionhelper.cxx.

References framework::InterceptionHelper::InterceptorInfo::lURLPattern, m_lInterceptionRegs, m_xOwnerWeak, m_xSlave, and framework::InterceptionHelper::InterceptorInfo::xInterceptor.

◆ releaseDispatchProviderInterceptor()

void SAL_CALL framework::InterceptionHelper::releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &  xInterceptor)
overridevirtual

release an interceptor.

@descr Remove the registered interceptor from our internal list and delete all special information about it.

Parameters
xInterceptorreference to the interceptor, which wishes to be deregistered.
Exceptions
ARuntimeException if the given reference is NULL!

Definition at line 164 of file interceptionhelper.cxx.

References framework::InterceptionHelper::InterceptorList::findByReference(), m_lInterceptionRegs, m_xOwnerWeak, and TOOLS_WARN_EXCEPTION.

Referenced by disposing().

Member Data Documentation

◆ m_lInterceptionRegs

InterceptorList framework::InterceptionHelper::m_lInterceptionRegs
private

contains all registered interceptor objects.

Definition at line 138 of file interceptionhelper.hxx.

Referenced by disposing(), queryDispatch(), registerDispatchProviderInterceptor(), and releaseDispatchProviderInterceptor().

◆ m_xOwnerWeak

css::uno::WeakReference< css::frame::XFrame > framework::InterceptionHelper::m_xOwnerWeak
private

reference to the frame, which uses this instance to implement its own interception.

@descr We hold a weak reference only, to make disposing operations easy.

Definition at line 131 of file interceptionhelper.hxx.

Referenced by disposing(), registerDispatchProviderInterceptor(), and releaseDispatchProviderInterceptor().

◆ m_xSlave

rtl::Reference< DispatchProvider > framework::InterceptionHelper::m_xSlave
private

this interception helper implements the top level master of an interceptor list ... but this member is the lowest possible slave!

Definition at line 135 of file interceptionhelper.hxx.

Referenced by GetSlave(), queryDispatch(), and registerDispatchProviderInterceptor().


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