20#ifndef INCLUDED_COMPHELPER_SERVICEHELPER_HXX
21#define INCLUDED_COMPHELPER_SERVICEHELPER_HXX
24#include <com/sun/star/lang/XUnoTunnel.hpp>
25#include <com/sun/star/uno/Sequence.hxx>
34 css::uno::Sequence< sal_Int8 >
m_aSeq;
38 rtl_createUuid(
reinterpret_cast<sal_uInt8*
>(
m_aSeq.getArray()),
nullptr,
true);
40 const css::uno::Sequence< sal_Int8 >&
getSeq()
const {
return m_aSeq; }
45 return sal::static_int_cast<sal_Int64>(
reinterpret_cast<sal_IntPtr
>(
p));
50 return reinterpret_cast<T*
>(sal::static_int_cast<sal_IntPtr>(
n));
53 template <
class T> T*
getFromUnoTunnel(
const css::uno::Reference<css::lang::XUnoTunnel>& xUT)
58 return getSomething_cast<T>(xUT->getSomething(T::getUnoTunnelId()));
62 template <
class T> T*
getFromUnoTunnel(
const css::uno::Reference<css::uno::XInterface>& xIface)
64 return getFromUnoTunnel<T>(
65 css::uno::Reference<css::lang::XUnoTunnel>{ xIface, css::uno::UNO_QUERY });
71 return rId.getLength() == 16
72 && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
77 static sal_Int64
get(
const css::uno::Sequence<sal_Int8>& rId, Base* p)
79 return p->Base::getSomething(rId);
85 static sal_Int64
get(
const css::uno::Sequence<sal_Int8>&,
void*) {
return 0; }
88 template <
class T,
class Base =
void>
92 if (isUnoTunnelId<T>(rId))
114#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
115 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; \
116 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
118#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
119const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
121 static const comphelper::UnoIdInit aId; \
122 return aId.getSeq(); \
125#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
126UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
127sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
129 return comphelper::getSomethingImpl(rId, this); \
132#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
133UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
134sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
136 return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
css::uno::Sequence< sal_Int8 > m_aSeq
const css::uno::Sequence< sal_Int8 > & getSeq() const
T * getFromUnoTunnel(const css::uno::Reference< css::lang::XUnoTunnel > &xUT)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
sal_Int64 getSomething_cast(void *p)
bool isUnoTunnelId(const css::uno::Sequence< sal_Int8 > &rId)
static sal_Int64 get(const css::uno::Sequence< sal_Int8 > &, void *)
static sal_Int64 get(const css::uno::Sequence< sal_Int8 > &rId, Base *p)