diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2009-09-30 00:18:39 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2009-09-30 00:18:39 -0400 |
commit | c363eab53e44378091b4bb7ab653d1eb074d0094 (patch) | |
tree | d8e286a48ed97f06cd597e7ede326900e64ad463 /sc/source/ui/unoobj/textuno.cxx | |
parent | ddf9f3eea0511c5971f88c9b4eb08a63a8a8d7fd (diff) | |
parent | c4c825af22a19fa4aeb17c86df03256a081cb83a (diff) |
rebased to DEV300_m60.
Diffstat (limited to 'sc/source/ui/unoobj/textuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/textuno.cxx | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index bd481dfc49f0..a9e6a799e010 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -897,6 +897,47 @@ uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd() throw(uno:: return xRange; } +// XUnoTunnel + +sal_Int64 SAL_CALL ScDrawTextCursor::getSomething( + const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException) +{ + if ( rId.getLength() == 16 && + 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), + rId.getConstArray(), 16 ) ) + { + return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); + } + return SvxUnoTextCursor::getSomething( rId ); +} + +// static +const uno::Sequence<sal_Int8>& ScDrawTextCursor::getUnoTunnelId() +{ + static uno::Sequence<sal_Int8> * pSeq = 0; + if( !pSeq ) + { + osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); + if( !pSeq ) + { + static uno::Sequence< sal_Int8 > aSeq( 16 ); + rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); + pSeq = &aSeq; + } + } + return *pSeq; +} + +// static +ScDrawTextCursor* ScDrawTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj ) +{ + ScDrawTextCursor* pRet = NULL; + uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY ); + if (xUT.is()) + pRet = reinterpret_cast<ScDrawTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId()))); + return pRet; +} + //------------------------------------------------------------------------ ScSimpleEditSourceHelper::ScSimpleEditSourceHelper() |