20 #ifndef INCLUDED_COMPHELPER_SERVICEHELPER_HXX
21 #define INCLUDED_COMPHELPER_SERVICEHELPER_HXX
24 #include <rtl/instance.hxx>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <com/sun/star/uno/Sequence.hxx>
31 css::uno::Sequence< sal_Int8 >
m_aSeq;
35 rtl_createUuid( reinterpret_cast<sal_uInt8*>(m_aSeq.getArray()),
nullptr,
true );
37 const css::uno::Sequence< sal_Int8 >&
getSeq()
const {
return m_aSeq; }
45 css::uno::Reference< css::lang::XUnoTunnel > xUT( xIface, css::uno::UNO_QUERY );
49 return reinterpret_cast<T*
>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( T::getUnoTunnelId() )));
57 return rId.getLength() == 16
58 && memcmp( T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) == 0;
75 #define UNO3_GETIMPLEMENTATION_DECL( classname ) \
76 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); \
77 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
79 #define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
82 class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \
84 const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
86 return the##classname##UnoTunnelId::get().getSeq(); \
89 #define UNO3_GETIMPLEMENTATION_IMPL( classname )\
90 UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
91 sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
93 if( isUnoTunnelId<classname>(rId) ) \
95 return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
100 #define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
101 UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
102 sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
104 if( isUnoTunnelId<classname>(rId) ) \
106 return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
110 return baseclass::getSomething( rId ); \
115 #endif // INCLUDED_COMPHELPER_SERVICEHELPER_HXX
bool isUnoTunnelId(const css::uno::Sequence< sal_Int8 > &rId)
T * getUnoTunnelImplementation(const css::uno::Reference< css::uno::XInterface > &xIface)
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Sequence< sal_Int8 > m_aSeq