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)
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 });
73 css::uno::Reference<css::lang::XUnoTunnel> xUnoTunnel;
75 return getFromUnoTunnel<T>(xUnoTunnel);
81 return rId.getLength() == 16
82 && memcmp(T::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16) == 0;
87 static sal_Int64
get(
const css::uno::Sequence<sal_Int8>& rId,
Base*
p)
89 return p->Base::getSomething(rId);
95 static sal_Int64
get(
const css::uno::Sequence<sal_Int8>&,
void*) {
return 0; }
98 template <
class T,
class Base =
void>
102 if (isUnoTunnelId<T>(rId))
124 #define UNO3_GETIMPLEMENTATION_DECL( classname ) \
125 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; \
126 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
128 #define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
129 const css::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() noexcept \
131 static const comphelper::UnoIdInit aId; \
132 return aId.getSeq(); \
135 #define UNO3_GETIMPLEMENTATION_IMPL( classname )\
136 UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
137 sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
139 return comphelper::getSomethingImpl(rId, this); \
142 #define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
143 UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
144 sal_Int64 SAL_CALL classname::getSomething( const css::uno::Sequence< sal_Int8 >& rId ) \
146 return comphelper::getSomethingImpl(rId, this, comphelper::FallbackToGetSomethingOf<baseclass>{}); \
150 #endif // INCLUDED_COMPHELPER_SERVICEHELPER_HXX
T * getFromUnoTunnel(const css::uno::Reference< css::lang::XUnoTunnel > &xUT)
css::uno::Sequence< sal_Int8 > m_aSeq
sal_Int64 getSomething_cast(void *p)
const css::uno::Sequence< sal_Int8 > & getSeq() const
bool isUnoTunnelId(const css::uno::Sequence< sal_Int8 > &rId)
sal_Int64 getSomethingImpl(const css::uno::Sequence< sal_Int8 > &rId, T *pThis, FallbackToGetSomethingOf< Base >={})
static sal_Int64 get(const css::uno::Sequence< sal_Int8 > &rId, Base *p)