LibreOffice Module toolkit (master) 1
Macros
macros.hxx File Reference
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <comphelper/diagnose_ex.hxx>
Include dependency graph for macros.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IMPL_IMPLEMENTATION_ID(ClassName)
 
#define DECL_LISTENERMULTIPLEXER_START(ClassName, InterfaceName)
 
#define DECL_LISTENERMULTIPLEXER_START_DLLPUB(ClassName, InterfaceName)
 
#define DECL_LISTENERMULTIPLEXER_END   };
 
#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS(ClassName, InterfaceName)
 
#define DISPLAY_EXCEPTION(ClassName, MethodName)
 
#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM(ClassName, InterfaceName, MethodName, ParamType1)
 
#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY(ClassName, InterfaceName, MethodName, EventType)
 
#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION(ClassName, InterfaceName, MethodName, EventType, Exception)
 
#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD(ClassName, InterfaceName, MethodName, EventType)
 
#define DECLIMPL_SERVICEINFO_DERIVED(ImplName, BaseClass, ServiceName)
 

Macro Definition Documentation

◆ DECL_LISTENERMULTIPLEXER_END

#define DECL_LISTENERMULTIPLEXER_END   };

Definition at line 56 of file macros.hxx.

◆ DECL_LISTENERMULTIPLEXER_START

#define DECL_LISTENERMULTIPLEXER_START (   ClassName,
  InterfaceName 
)
Value:
class ClassName final : public ListenerMultiplexerBase<InterfaceName>, public InterfaceName \
{ \
public: \
ClassName( ::cppu::OWeakObject& rSource ); \
css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \
void SAL_CALL acquire() noexcept override; \
void SAL_CALL release() noexcept override; \
void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)

Definition at line 34 of file macros.hxx.

◆ DECL_LISTENERMULTIPLEXER_START_DLLPUB

#define DECL_LISTENERMULTIPLEXER_START_DLLPUB (   ClassName,
  InterfaceName 
)
Value:
class TOOLKIT_DLLPUBLIC ClassName final : public ListenerMultiplexerBase<InterfaceName>, public InterfaceName \
{ \
public: \
ClassName( ::cppu::OWeakObject& rSource ); \
css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; \
void SAL_CALL acquire() noexcept override; \
void SAL_CALL release() noexcept override; \
void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
#define TOOLKIT_DLLPUBLIC
Definition: dllapi.h:29

Definition at line 45 of file macros.hxx.

◆ DECLIMPL_SERVICEINFO_DERIVED

#define DECLIMPL_SERVICEINFO_DERIVED (   ImplName,
  BaseClass,
  ServiceName 
)
Value:
OUString SAL_CALL getImplementationName( ) override { return "stardiv.Toolkit." #ImplName; } \
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override \
{ \
css::uno::Sequence< OUString > aNames = BaseClass::getSupportedServiceNames( ); \
aNames.realloc( aNames.getLength() + 1 ); \
aNames.getArray()[ aNames.getLength() - 1 ] = ServiceName; \
return aNames; \
} \
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()

Definition at line 154 of file macros.hxx.

◆ DISPLAY_EXCEPTION

#define DISPLAY_EXCEPTION (   ClassName,
  MethodName 
)
Value:
css::uno::Any ex( cppu::getCaughtException() ); \
SAL_WARN( "toolkit", #ClassName "::" #MethodName ": caught an exception! " << exceptionToString(ex));
OString exceptionToString(const css::uno::Any &caught)
Any SAL_CALL getCaughtException()

Definition at line 80 of file macros.hxx.

◆ IMPL_IMPLEMENTATION_ID

#define IMPL_IMPLEMENTATION_ID (   ClassName)
Value:
css::uno::Sequence< sal_Int8 > ClassName::getImplementationId() \
{ \
return css::uno::Sequence<sal_Int8>(); \
}

Definition at line 27 of file macros.hxx.

◆ IMPL_LISTENERMULTIPLEXER_BASEMETHODS

#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS (   ClassName,
  InterfaceName 
)
Value:
ClassName::ClassName( ::cppu::OWeakObject& rSource ) \
{ \
} \
void SAL_CALL ClassName::acquire() noexcept { ListenerMultiplexerBase::acquire(); } \
void SAL_CALL ClassName::release() noexcept { ListenerMultiplexerBase::release(); } \
css::uno::Any ClassName::queryInterface( const css::uno::Type & rType ) \
{ \
css::uno::Any aRet = ::cppu::queryInterface( rType, \
(static_cast< css::lang::XEventListener* >(this)), \
(static_cast< InterfaceName* >(this)) ); \
return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \
} \
void ClassName::disposing( const css::lang::EventObject& ) \
{ \
}

Definition at line 60 of file macros.hxx.

◆ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD

#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD (   ClassName,
  InterfaceName,
  MethodName,
  EventType 
)
Value:
void ClassName::MethodName( const EventType& evt ) \
IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType )

Definition at line 150 of file macros.hxx.

◆ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY

#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY (   ClassName,
  InterfaceName,
  MethodName,
  EventType 
)
Value:
{ \
EventType aMulti( evt ); \
aMulti.Source = &GetContext(); \
std::unique_lock g(m_aMutex); \
g.unlock(); \
while( aIt.hasMoreElements() ) \
{ \
css::uno::Reference<InterfaceName> xListener(aIt.next()); \
try \
{ \
xListener->MethodName( aMulti ); \
} \
catch(const css::lang::DisposedException& e) \
{ \
OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
if ( e.Context == xListener || !e.Context.is() ) \
{ \
std::unique_lock g2(m_aMutex); \
aIt.remove(g2); \
} \
} \
catch(const css::uno::RuntimeException&) \
{ \
DISPLAY_EXCEPTION( ClassName, MethodName ) \
} \
} \
}

Definition at line 116 of file macros.hxx.

◆ IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION

#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION (   ClassName,
  InterfaceName,
  MethodName,
  EventType,
  Exception 
)
Value:
void ClassName::MethodName( const EventType& evt ) \
IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType )

Definition at line 146 of file macros.hxx.

◆ IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM

#define IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM (   ClassName,
  InterfaceName,
  MethodName,
  ParamType1 
)
Value:
{ \
ParamType1 aMulti( evt ); \
std::unique_lock g(m_aMutex); \
g.unlock(); \
while( aIt.hasMoreElements() ) \
{ \
css::uno::Reference<InterfaceName> xListener(aIt.next()); \
try \
{ \
xListener->MethodName( aMulti ); \
} \
catch(const css::lang::DisposedException& e) \
{ \
OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
if ( e.Context == xListener || !e.Context.is() ) \
{ \
std::unique_lock g2(m_aMutex); \
aIt.remove(g2); \
} \
} \
catch(const css::uno::RuntimeException&) \
{ \
DISPLAY_EXCEPTION( ClassName, MethodName ) \
} \
} \
}

Definition at line 87 of file macros.hxx.