*** empty log message ***
This commit is contained in:
parent
4b9d3fc23a
commit
bc505f6721
3 changed files with 19 additions and 40 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: DTransHelper.cxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: tra $ $Date: 2001-03-06 12:24:46 $
|
||||
* last change: $Author: tra $ $Date: 2001-03-09 15:20:11 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -77,16 +77,12 @@
|
|||
|
||||
CStgTransferHelper::CStgTransferHelper( sal_Bool bAutoInit,
|
||||
HGLOBAL hGlob,
|
||||
sal_Bool bDelStgOnRelease,
|
||||
sal_Bool bReleaseStreamOnDestr ) :
|
||||
sal_Bool bDelStgOnRelease ) :
|
||||
m_lpStream( NULL ),
|
||||
m_bDelStgOnRelease( bDelStgOnRelease ),
|
||||
m_bReleaseStreamOnDestr( bReleaseStreamOnDestr )
|
||||
m_bDelStgOnRelease( bDelStgOnRelease )
|
||||
{
|
||||
OSL_ASSERT( !(bDelStgOnRelease && !bReleaseStreamOnDestr) );
|
||||
|
||||
if ( bAutoInit )
|
||||
init( hGlob, m_bDelStgOnRelease, m_bReleaseStreamOnDestr );
|
||||
init( hGlob, m_bDelStgOnRelease );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -96,7 +92,7 @@ CStgTransferHelper::CStgTransferHelper( sal_Bool bAutoInit,
|
|||
|
||||
CStgTransferHelper::~CStgTransferHelper( )
|
||||
{
|
||||
if ( m_bReleaseStreamOnDestr && m_lpStream )
|
||||
if ( m_lpStream )
|
||||
m_lpStream->Release( );
|
||||
}
|
||||
|
||||
|
@ -168,6 +164,8 @@ void SAL_CALL CStgTransferHelper::getIStream( LPSTREAM* ppStream )
|
|||
{
|
||||
OSL_ASSERT( ppStream );
|
||||
*ppStream = m_lpStream;
|
||||
if ( *ppStream )
|
||||
static_cast< LPUNKNOWN >( *ppStream )->AddRef( );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -176,15 +174,11 @@ void SAL_CALL CStgTransferHelper::getIStream( LPSTREAM* ppStream )
|
|||
|
||||
void SAL_CALL CStgTransferHelper::init( SIZE_T newSize,
|
||||
sal_uInt32 uiFlags,
|
||||
sal_Bool bDelStgOnRelease,
|
||||
sal_Bool bReleaseStreamOnDestr )
|
||||
sal_Bool bDelStgOnRelease )
|
||||
{
|
||||
OSL_ASSERT( !(bDelStgOnRelease && !bReleaseStreamOnDestr) );
|
||||
|
||||
cleanup( );
|
||||
|
||||
m_bDelStgOnRelease = bDelStgOnRelease;
|
||||
m_bReleaseStreamOnDestr = bReleaseStreamOnDestr;
|
||||
|
||||
HGLOBAL hGlob = GlobalAlloc( uiFlags, newSize );
|
||||
if ( NULL == hGlob )
|
||||
|
@ -210,15 +204,11 @@ void SAL_CALL CStgTransferHelper::init( SIZE_T newSize,
|
|||
//------------------------------------------------------------------------
|
||||
|
||||
void SAL_CALL CStgTransferHelper::init( HGLOBAL hGlob,
|
||||
sal_Bool bDelStgOnRelease,
|
||||
sal_Bool bReleaseStreamOnDestr )
|
||||
sal_Bool bDelStgOnRelease )
|
||||
{
|
||||
OSL_ASSERT( !(bDelStgOnRelease && !bReleaseStreamOnDestr) );
|
||||
|
||||
cleanup( );
|
||||
|
||||
m_bDelStgOnRelease = bDelStgOnRelease;
|
||||
m_bReleaseStreamOnDestr = bReleaseStreamOnDestr;
|
||||
|
||||
HRESULT hr = CreateStreamOnHGlobal( hGlob, m_bDelStgOnRelease, &m_lpStream );
|
||||
if ( FAILED( hr ) )
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: DTransHelper.hxx,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: tra $ $Date: 2001-03-06 12:24:46 $
|
||||
* last change: $Author: tra $ $Date: 2001-03-09 15:20:11 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -104,8 +104,7 @@ public:
|
|||
CStgTransferHelper(
|
||||
sal_Bool bAutoInit = sal_False,
|
||||
HGLOBAL hGlob = NULL,
|
||||
sal_Bool bDelStgOnRelease = sal_False,
|
||||
sal_Bool bReleaseStreamOnDestr = sal_True );
|
||||
sal_Bool bDelStgOnRelease = sal_False );
|
||||
|
||||
~CStgTransferHelper( );
|
||||
|
||||
|
@ -118,13 +117,11 @@ public:
|
|||
void SAL_CALL init(
|
||||
SIZE_T newSize,
|
||||
sal_uInt32 uiFlags = GHND,
|
||||
sal_Bool bDelStgOnRelease = sal_False,
|
||||
sal_Bool bReleasStreamOnDestr = sal_True );
|
||||
sal_Bool bDelStgOnRelease = sal_False );
|
||||
|
||||
void SAL_CALL init(
|
||||
HGLOBAL hGlob,
|
||||
sal_Bool bDelStgOnRelease = sal_False,
|
||||
sal_Bool bReleaseStreamOnDestr = sal_True );
|
||||
sal_Bool bDelStgOnRelease = sal_False );
|
||||
|
||||
// returns the size of the managed memory
|
||||
sal_uInt32 SAL_CALL memSize( ) const;
|
||||
|
@ -136,7 +133,6 @@ public:
|
|||
private:
|
||||
LPSTREAM m_lpStream;
|
||||
sal_Bool m_bDelStgOnRelease;
|
||||
sal_Bool m_bReleaseStreamOnDestr;
|
||||
|
||||
private:
|
||||
CStgTransferHelper( const CStgTransferHelper& );
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: XTDataObject.cxx,v $
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
* last change: $Author: tra $ $Date: 2001-03-08 11:40:20 $
|
||||
* last change: $Author: tra $ $Date: 2001-03-09 15:21:55 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -274,18 +274,11 @@ void SAL_CALL CXTDataObject::renderDataAndSetupStgMedium(
|
|||
OSL_PRECOND( !nInitStgSize || nInitStgSize && (nInitStgSize >= nBytesToTransfer),
|
||||
"Memory size less than number of bytes to transfer" );
|
||||
|
||||
// if the client wants the data only via IStream we setup the storage transfer
|
||||
// helper so that the stream will not be released on destruction
|
||||
sal_Bool bShouldReleaseStream =
|
||||
((fetc.tymed & TYMED_HGLOBAL) || !(fetc.tymed & TYMED_ISTREAM));
|
||||
|
||||
CStgTransferHelper stgTransfHelper(
|
||||
AUTO_INIT, NULL, sal_False, bShouldReleaseStream );
|
||||
CStgTransferHelper stgTransfHelper( AUTO_INIT );
|
||||
|
||||
// setup storage size
|
||||
if ( nInitStgSize > 0 )
|
||||
stgTransfHelper.init(
|
||||
nInitStgSize, GMEM_MOVEABLE | GMEM_ZEROINIT, sal_False, bShouldReleaseStream );
|
||||
stgTransfHelper.init( nInitStgSize, GHND );
|
||||
|
||||
#ifndef _DEBUG
|
||||
stgTransfHelper.write( lpStorage, nBytesToTransfer );
|
||||
|
|
Loading…
Reference in a new issue