summaryrefslogtreecommitdiff
path: root/sw/inc/unobaseclass.hxx
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2010-01-08 17:13:48 +0100
committerMichael Stahl <mst@openoffice.org>2010-01-08 17:13:48 +0100
commita22723dc6276d018fcd2fffa04c143e9c6c04c7a (patch)
tree95873676c7534f1f228e2042d47da8e10aab6ef0 /sw/inc/unobaseclass.hxx
parent5e8eac444983d7fcf8e4c102171179dbb6fffed9 (diff)
swunolocking1: #i105557#: unobaseclass.hxx: add UnoTunnel helpers:
new template UnoTunnelImpl to implement XUnoTunnel::getSomething(). new template UnoTunnelGetImplementation to use XUnoTunnel::getSomething().
Diffstat (limited to 'sw/inc/unobaseclass.hxx')
-rw-r--r--sw/inc/unobaseclass.hxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx
index 5f55115f479e..e9ae3f909a63 100644
--- a/sw/inc/unobaseclass.hxx
+++ b/sw/inc/unobaseclass.hxx
@@ -30,6 +30,7 @@
#ifndef SW_UNOBASECLASS_HXX
#define SW_UNOBASECLASS_HXX
+#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
@@ -137,6 +138,32 @@ namespace sw {
T * get () const { return m_p; }
};
+ template< class C > C *
+ UnoTunnelGetImplementation(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel > const & xUnoTunnel)
+ {
+ if (!xUnoTunnel.is()) { return 0; }
+ C *const pC( reinterpret_cast< C* >(
+ ::sal::static_int_cast< sal_IntPtr >(
+ xUnoTunnel->getSomething(C::getUnoTunnelId()))));
+ return pC;
+ }
+
+ template< class C > sal_Int64
+ UnoTunnelImpl(const ::com::sun::star::uno::Sequence< sal_Int8 > & rId,
+ C *const pThis)
+ {
+ if ((rId.getLength() == 16) &&
+ (0 == rtl_compareMemory(C::getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16)))
+ {
+ return ::sal::static_int_cast< sal_Int64 >(
+ reinterpret_cast< sal_IntPtr >(pThis) );
+ }
+ return 0;
+ }
+
} // namespace sw
#endif // SW_UNOBASECLASS_HXX