diff options
author | obo <obo@openoffice.org> | 2010-06-21 13:45:10 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-21 13:45:10 +0200 |
commit | 2e08b6be7ef70c1eae7db47edd5b0a642250f10a (patch) | |
tree | e9070ef8a8d2d3d83a43d7e097207b161a033257 /sw | |
parent | e707be43cb1f6e4be7c40927a525b25d428d1224 (diff) | |
parent | bb22bf7de9046aa9fedc691414f3c5cb1125fc5c (diff) |
CWS-TOOLING: integrate CWS cbosdo03
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unotext.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 32 |
2 files changed, 37 insertions, 2 deletions
diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx index 76fa7ee3befe..d6ada94d5396 100644 --- a/sw/inc/unotext.hxx +++ b/sw/inc/unotext.hxx @@ -31,6 +31,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextCopy.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> #include <com/sun/star/text/XRelativeTextContentInsert.hpp> #include <com/sun/star/text/XRelativeTextContentRemove.hpp> @@ -62,6 +63,7 @@ class SwXText , public ::com::sun::star::lang::XUnoTunnel , public ::com::sun::star::beans::XPropertySet , public ::com::sun::star::text::XTextAppendAndConvert + , public ::com::sun::star::text::XTextCopy , public ::com::sun::star::text::XTextRangeCompare , public ::com::sun::star::text::XRelativeTextContentInsert , public ::com::sun::star::text::XRelativeTextContentRemove @@ -333,6 +335,11 @@ public: throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + // XTextCopy + virtual void SAL_CALL copyText( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextCopy >& xSource ) + throw (::com::sun::star::uno::RuntimeException); }; #endif // SW_UNOTEXT_HXX diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index d8682062f039..3ddcfc1d2ed7 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -76,8 +76,6 @@ #include <stdlib.h> #include <iostream> - - using namespace ::com::sun::star; using ::rtl::OUString; @@ -277,6 +275,10 @@ SwXText::queryInterface(const uno::Type& rType) throw (uno::RuntimeException) { aRet <<= uno::Reference< text::XTextContentAppend >(this); } + else if(rType == text::XTextCopy::static_type()) + { + aRet <<= uno::Reference< text::XTextCopy >( this ); + } return aRet; } /* -----------------------------15.03.00 17:42-------------------------------- @@ -1860,6 +1862,32 @@ static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 ) return abs( nPos1 - nPos2 ) < COL_POS_FUZZY; } +void SwXText::copyText( + const uno::Reference< text::XTextCopy >& xSource ) + throw ( uno::RuntimeException ) +{ + uno::Reference< lang::XUnoTunnel > xTTunnel( xSource, uno::UNO_QUERY_THROW ); + SwXText* pText = 0; + pText = reinterpret_cast< SwXText* >( + sal::static_int_cast< sal_IntPtr >( xTTunnel->getSomething( SwXText::getUnoTunnelId()) )); + + uno::Reference< text::XText > xText( xSource, uno::UNO_QUERY_THROW ); + uno::Reference< text::XTextCursor > xCursor = xText->createTextCursor( ); + xCursor->gotoEnd( sal_True ); + + uno::Reference< lang::XUnoTunnel > xTunnel( xCursor, uno::UNO_QUERY_THROW ); + + OTextCursorHelper* pCursor = 0; + pCursor = reinterpret_cast< OTextCursorHelper* >( + sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) )); + if ( pCursor ) + { + SwNodeIndex rNdIndex( *GetStartNode( ), 1 ); + SwPosition rPos( rNdIndex ); + m_pImpl->m_pDoc->CopyRange( *pCursor->GetPaM( ), rPos, false ); + } +} + void SwXText::Impl::ConvertCell( const bool bFirstCell, const uno::Sequence< uno::Reference< text::XTextRange > > & rCell, |