diff options
author | Tino Rachui <tra@openoffice.org> | 2001-04-04 13:10:12 +0000 |
---|---|---|
committer | Tino Rachui <tra@openoffice.org> | 2001-04-04 13:10:12 +0000 |
commit | 7bd09c0347381e9283ea8890005147e08eb9891d (patch) | |
tree | 021e9377dc26e981b5c14d475e658e82c3771327 /dtrans | |
parent | 6566b942d021fc8ad116c5939cb7a81051dacb4f (diff) |
#85727# determining string len when pasting text
Diffstat (limited to 'dtrans')
-rw-r--r-- | dtrans/source/win32/dtobj/DOTransferable.cxx | 10 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/DOTransferable.hxx | 6 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/DTransHelper.cxx | 29 | ||||
-rw-r--r-- | dtrans/source/win32/dtobj/DTransHelper.hxx | 10 |
4 files changed, 39 insertions, 16 deletions
diff --git a/dtrans/source/win32/dtobj/DOTransferable.cxx b/dtrans/source/win32/dtobj/DOTransferable.cxx index b2fad9cd82bb..fbc01e4aef67 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.cxx +++ b/dtrans/source/win32/dtobj/DOTransferable.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DOTransferable.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: tra $ $Date: 2001-03-22 14:15:51 $ + * last change: $Author: tra $ $Date: 2001-04-04 14:10:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -389,7 +389,7 @@ CDOTransferable::ByteSequence_t SAL_CALL CDOTransferable::getClipboardData( CFor try { - clipDataToByteStream( stgmedium, byteStream ); + clipDataToByteStream( aFormatEtc.getClipformat( ), stgmedium, byteStream ); // format conversion if necessary if ( CF_DIB == aFormatEtc.getClipformat() ) @@ -458,7 +458,7 @@ OUString SAL_CALL CDOTransferable::synthesizeUnicodeText( ) // //------------------------------------------------------------------------ -void CDOTransferable::clipDataToByteStream( STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ) +void CDOTransferable::clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ) { CStgTransferHelper memTransferHelper; @@ -485,7 +485,7 @@ void CDOTransferable::clipDataToByteStream( STGMEDIUM stgmedium, ByteSequence_t& break; } - int nMemSize = memTransferHelper.memSize( ); + int nMemSize = memTransferHelper.memSize( cf ); aByteSequence.realloc( nMemSize ); memTransferHelper.read( aByteSequence.getArray( ), nMemSize ); } diff --git a/dtrans/source/win32/dtobj/DOTransferable.hxx b/dtrans/source/win32/dtobj/DOTransferable.hxx index 00e8205a7681..e5af96d571c2 100644 --- a/dtrans/source/win32/dtobj/DOTransferable.hxx +++ b/dtrans/source/win32/dtobj/DOTransferable.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DOTransferable.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: tra $ $Date: 2001-03-22 14:15:51 $ + * last change: $Author: tra $ $Date: 2001-04-04 14:10:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -133,7 +133,7 @@ private: ByteSequence_t SAL_CALL getClipboardData( CFormatEtc& aFormatEtc ); rtl::OUString SAL_CALL synthesizeUnicodeText( ); - void SAL_CALL clipDataToByteStream( STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ); + void SAL_CALL clipDataToByteStream( CLIPFORMAT cf, STGMEDIUM stgmedium, ByteSequence_t& aByteSequence ); ::com::sun::star::uno::Any SAL_CALL byteStreamToAny( ByteSequence_t& aByteStream, const com::sun::star::uno::Type& aRequestedDataType ); rtl::OUString SAL_CALL byteStreamToOUString( ByteSequence_t& aByteStream ); diff --git a/dtrans/source/win32/dtobj/DTransHelper.cxx b/dtrans/source/win32/dtobj/DTransHelper.cxx index 0720e60dd80f..8e2982fd6a2e 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.cxx +++ b/dtrans/source/win32/dtobj/DTransHelper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DTransHelper.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tra $ $Date: 2001-03-09 15:20:11 $ + * last change: $Author: tra $ $Date: 2001-04-04 14:10:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -239,16 +239,35 @@ void SAL_CALL CStgTransferHelper::cleanup( ) // return the size of memory we point to //------------------------------------------------------------------------ -sal_uInt32 SAL_CALL CStgTransferHelper::memSize( ) const +sal_uInt32 SAL_CALL CStgTransferHelper::memSize( CLIPFORMAT cf ) const { DWORD dwSize = 0; if ( NULL != m_lpStream ) { HGLOBAL hGlob; - GetHGlobalFromStream( m_lpStream, &hGlob ); - dwSize = GlobalSize( hGlob ); + + if ( CF_TEXT == cf ) + { + sal_Char* pText = static_cast< sal_Char* >( GlobalLock( hGlob ) ); + if ( pText ) + { + dwSize = strlen( pText ) + 1; // strlen + trailing '\0' + GlobalUnlock( hGlob ); + } + } + else if ( CF_UNICODETEXT == cf ) + { + sal_Unicode* pText = static_cast< sal_Unicode* >( GlobalLock( hGlob ) ); + if ( pText ) + { + dwSize = wcslen( pText ) * sizeof( sal_Unicode ); + GlobalUnlock( hGlob ); + } + } + else + dwSize = GlobalSize( hGlob ); } return dwSize; diff --git a/dtrans/source/win32/dtobj/DTransHelper.hxx b/dtrans/source/win32/dtobj/DTransHelper.hxx index c2fd0c767018..610db29cfc79 100644 --- a/dtrans/source/win32/dtobj/DTransHelper.hxx +++ b/dtrans/source/win32/dtobj/DTransHelper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: DTransHelper.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: tra $ $Date: 2001-03-09 15:20:11 $ + * last change: $Author: tra $ $Date: 2001-04-04 14:10:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,6 +69,10 @@ #include <windows.h> +#ifndef _WINCLIP_HXX_ +#include "..\misc\WinClip.hxx" +#endif + //------------------------------------------------------------------------ // defines //------------------------------------------------------------------------ @@ -124,7 +128,7 @@ public: sal_Bool bDelStgOnRelease = sal_False ); // returns the size of the managed memory - sal_uInt32 SAL_CALL memSize( ) const; + sal_uInt32 SAL_CALL memSize( CLIPFORMAT cf = CF_INVALID ) const; // free the global memory and necessary // release the internal stream pointer |