*** empty log message ***

This commit is contained in:
Tino Rachui 2001-03-16 08:02:25 +00:00
parent b4bc248aac
commit 3c0b46ee8e
9 changed files with 221 additions and 96 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: WinClipbImpl.cxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: tra $ $Date: 2001-03-15 10:12:12 $
* last change: $Author: tra $ $Date: 2001-03-16 08:59:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -137,6 +137,7 @@ CWinClipbImpl::CWinClipbImpl( const OUString& aClipboardName, CWinClipboard* the
CWinClipbImpl::~CWinClipbImpl( )
{
unregisterClipboardViewer( );
}
//------------------------------------------------------------------------
@ -261,8 +262,6 @@ void SAL_CALL CWinClipbImpl::unregisterClipboardViewer( )
void SAL_CALL CWinClipbImpl::dispose() throw( RuntimeException )
{
unregisterClipboardViewer( );
OSL_ENSURE( !m_rOldClipbContent.is( ) &&
!m_rOldClipbOwner.is( ) &&
!m_rCurrentClipbContent.is( ) &&
@ -276,44 +275,58 @@ void SAL_CALL CWinClipbImpl::dispose() throw( RuntimeException )
void WINAPI CWinClipbImpl::onClipboardContentChanged( void )
{
ClearableMutexGuard aGuard( s_pCWinClipbImpl->m_aMutex );
Reference< XTransferable > xClipbContent;
Reference< XClipboardOwner > xClipbOwner;
if ( s_pCWinClipbImpl->m_rOldClipbContent.is( ) )
try
{
// release the condition because of expected callbacks
// to the clipboard service (remeber: the mutex is already
// released)
s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
ClearableMutexGuard aGuard( s_pCWinClipbImpl->m_aMutex );
// notify the old ClipboardOwner
if ( s_pCWinClipbImpl->m_rOldClipbOwner.is( ) )
s_pCWinClipbImpl->m_rOldClipbOwner->lostOwnership(
s_pCWinClipbImpl->m_pWinClipboard, s_pCWinClipbImpl->m_rOldClipbContent );
Reference< XTransferable > xClipbContent;
Reference< XClipboardOwner > xClipbOwner;
s_pCWinClipbImpl->m_rOldClipbOwner = Reference< XClipboardOwner >( );
s_pCWinClipbImpl->m_rOldClipbContent = Reference< XTransferable >( );
if ( s_pCWinClipbImpl->m_rOldClipbContent.is( ) )
{
xClipbContent = s_pCWinClipbImpl->m_rOldClipbContent;
xClipbOwner = s_pCWinClipbImpl->m_rOldClipbOwner;
s_pCWinClipbImpl->m_rOldClipbOwner = Reference< XClipboardOwner >( );
s_pCWinClipbImpl->m_rOldClipbContent = Reference< XTransferable >( );
// release the condition because of expected callbacks
// to the clipboard service (remeber: the mutex is already
// released)
s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
// notify the old ClipboardOwner
if ( xClipbOwner.is( ) )
xClipbOwner->lostOwnership(
s_pCWinClipbImpl->m_pWinClipboard, xClipbContent );
}
else if ( !s_pCWinClipbImpl->m_bSelfTriggered &&
s_pCWinClipbImpl->m_rCurrentClipbContent.is( ) )
{
// save the state variables locally
xClipbContent = s_pCWinClipbImpl->m_rCurrentClipbContent;
xClipbOwner = s_pCWinClipbImpl->m_rCurrentClipbOwner;
s_pCWinClipbImpl->m_rCurrentClipbOwner = Reference< XClipboardOwner >( );
s_pCWinClipbImpl->m_rCurrentClipbContent = Reference< XTransferable >( );
// release the condition because of expected callbacks
// to the clipboard service (remeber: the mutex is already
// released)
s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
// notify the old ClipboardOwner
if ( xClipbOwner.is( ) )
xClipbOwner->lostOwnership( s_pCWinClipbImpl->m_pWinClipboard, xClipbContent );
}
}
else if ( !s_pCWinClipbImpl->m_bSelfTriggered &&
s_pCWinClipbImpl->m_rCurrentClipbContent.is( ) )
catch( RuntimeException& )
{
// save the state variables locally
xClipbContent = s_pCWinClipbImpl->m_rCurrentClipbContent;
xClipbOwner = s_pCWinClipbImpl->m_rCurrentClipbOwner;
s_pCWinClipbImpl->m_rCurrentClipbOwner = Reference< XClipboardOwner >( );
s_pCWinClipbImpl->m_rCurrentClipbContent = Reference< XTransferable >( );
// release the condition because of expected callbacks
// to the clipboard service (remeber: the mutex is already
// released)
s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );
// notify the old ClipboardOwner
if ( xClipbOwner.is( ) )
xClipbOwner->lostOwnership( s_pCWinClipbImpl->m_pWinClipboard, xClipbContent );
OSL_ENSURE( sal_False, "RuntimeException caught" );
}
catch(...)
{
OSL_ENSURE( sal_False, "Unknown exception caught" );
}
s_pCWinClipbImpl->m_pWinClipboard->m_aCondition.set( );

View file

@ -2,9 +2,9 @@
*
* $RCSfile: WinClipboard.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: tra $ $Date: 2001-03-14 14:43:32 $
* last change: $Author: tra $ $Date: 2001-03-16 08:59:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -140,12 +140,18 @@ CWinClipboard::CWinClipboard( const Reference< XMultiServiceFactory >& rServiceM
Reference< XTransferable > SAL_CALL CWinClipboard::getContents( ) throw( RuntimeException )
{
OSL_ASSERT( m_pImpl.get( ) );
m_aCondition.wait( );
MutexGuard aGuard( m_aMutex );
OSL_ENSURE( !rBHelper.bDisposed, "Object is already disposed" );
return m_pImpl->getContents( );
if ( NULL != m_pImpl.get( ) )
return m_pImpl->getContents( );
return Reference< XTransferable >( );
}
//------------------------------------------------------------------------
@ -156,12 +162,16 @@ void SAL_CALL CWinClipboard::setContents( const Reference< XTransferable >& xTra
const Reference< XClipboardOwner >& xClipboardOwner )
throw( RuntimeException )
{
OSL_ASSERT( m_pImpl.get( ) );
m_aCondition.wait( );
ClearableMutexGuard aGuard( m_aMutex );
OSL_ENSURE( !rBHelper.bDisposed, "Object is already disposed" );
m_pImpl->setContents( xTransferable, xClipboardOwner, aGuard );
if ( NULL != m_pImpl.get( ) )
m_pImpl->setContents( xTransferable, xClipboardOwner, aGuard );
}
//------------------------------------------------------------------------
@ -170,7 +180,12 @@ void SAL_CALL CWinClipboard::setContents( const Reference< XTransferable >& xTra
OUString SAL_CALL CWinClipboard::getName( ) throw( RuntimeException )
{
return m_pImpl->getName( );
OSL_ASSERT( m_pImpl.get( ) );
if ( NULL != m_pImpl.get( ) )
return m_pImpl->getName( );
return OUString::createFromAscii( "" );
}
//========================================================================
@ -179,12 +194,15 @@ OUString SAL_CALL CWinClipboard::getName( ) throw( RuntimeException )
void SAL_CALL CWinClipboard::flushClipboard( ) throw( RuntimeException )
{
OSL_ASSERT( m_pImpl.get( ) );
m_aCondition.wait( );
MutexGuard aGuard( m_aMutex );
OSL_ENSURE( !rBHelper.bDisposed, "Object is already disposed" );
m_pImpl->flushClipboard( );
if ( NULL != m_pImpl.get( ) )
m_pImpl->flushClipboard( );
}
//========================================================================
@ -193,7 +211,12 @@ void SAL_CALL CWinClipboard::flushClipboard( ) throw( RuntimeException )
sal_Int8 SAL_CALL CWinClipboard::getRenderingCapabilities( ) throw( RuntimeException )
{
return m_pImpl->getRenderingCapabilities( );
OSL_ASSERT( m_pImpl.get( ) );
if ( NULL != m_pImpl.get( ) )
return m_pImpl->getRenderingCapabilities( );
return 0;
}
//========================================================================
@ -232,6 +255,8 @@ void SAL_CALL CWinClipboard::removeClipboardListener( const Reference< XClipboar
void SAL_CALL CWinClipboard::notifyAllClipboardListener( )
{
OSL_ASSERT( NULL != m_pImpl.get( ) );
OInterfaceContainerHelper* pICHelper = rBHelper.aLC.getContainer(
getCppuType( ( Reference< XClipboardListener > * ) 0 ) );
@ -278,6 +303,9 @@ void SAL_CALL CWinClipboard::dispose() throw(RuntimeException)
// do my own stuff
m_pImpl->dispose( );
// force destruction of the impl class
m_pImpl.reset( NULL );
// call the base class implementation first
WeakComponentImplHelper4< XClipboardEx,
XFlushableClipboard, XClipboardNotifier,

View file

@ -2,9 +2,9 @@
*
* $RCSfile: DataFmtTransl.cxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: tra $ $Date: 2001-03-15 10:13:24 $
* last change: $Author: tra $ $Date: 2001-03-16 09:00:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -295,28 +295,25 @@ LCID SAL_CALL CDataFormatTranslator::getCurrentLocaleFromClipboard(
const Reference< XTransferable >& refXTransferable ) const
{
Any aAny;
CFormatEtc fetc = getFormatEtcForClipformat( CF_LOCALE );
CFormatEtc fetc = getFormatEtcForClipformat( CF_LOCALE );
DataFlavor aFlavor = getDataFlavorFromFormatEtc( refXTransferable, fetc );
OSL_ASSERT( aFlavor.MimeType.getLength( ) );
LCID lcid;
LCID lcid = 0;
try
{
aAny = refXTransferable->getTransferData( aFlavor );
if ( aAny.hasValue( ) )
{
OSL_ASSERT( aAny.getValueType( ) == CPPUTYPE_SEQSALINT8 );
Sequence< sal_Int8 > byteStream;
aAny >>= byteStream;
OSL_ASSERT( aAny.hasValue( ) && (aAny.getValueType( ) == CPPUTYPE_SEQSALINT8) );
lcid = *reinterpret_cast< LCID* >( byteStream.getArray( ) );
}
Sequence< sal_Int8 > byteStream;
aAny >>= byteStream;
lcid = *reinterpret_cast< LCID* >( byteStream.getArray( ) );
}
catch( UnsupportedFlavorException& )
{
lcid = GetThreadLocale( );
}
catch( ... )
{
@ -324,7 +321,7 @@ LCID SAL_CALL CDataFormatTranslator::getCurrentLocaleFromClipboard(
}
if ( !IsValidLocale( lcid, LCID_SUPPORTED ) )
lcid = GetThreadLocale( );
lcid = GetThreadLocale( );
return lcid;
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: FetcList.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: tra $ $Date: 2001-03-09 08:47:21 $
* last change: $Author: tra $ $Date: 2001-03-16 09:00:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -257,7 +257,12 @@ CFormatRegistrar::CFormatRegistrar( const Reference< XMultiServiceFactory >& Ser
CFormatRegistrar::~CFormatRegistrar( )
{
if ( CFormatRegistrar::m_hEvtEnumLocaleReady )
CloseHandle( CFormatRegistrar::m_hEvtEnumLocaleReady );
{
sal_Bool bRet = CloseHandle(
CFormatRegistrar::m_hEvtEnumLocaleReady );
OSL_ASSERT( bRet );
}
}
//------------------------------------------------------------------------

View file

@ -2,9 +2,9 @@
*
* $RCSfile: MimeAttrib.hxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: tra $ $Date: 2001-02-27 07:51:36 $
* last change: $Author: tra $ $Date: 2001-03-16 09:00:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -77,7 +77,7 @@
const rtl::OUString TEXTPLAIN_PARAM_CHARSET = rtl::OUString::createFromAscii( "charset" );
const rtl::OUString PRE_WINDOWS_CODEPAGE = rtl::OUString::createFromAscii( "windows-" );
const rtl::OUString PRE_WINDOWS_CODEPAGE = rtl::OUString::createFromAscii( "windows" );
const rtl::OUString PRE_OEM_CODEPAGE = rtl::OUString::createFromAscii( "cp" );
const rtl::OUString CHARSET_UTF16 = rtl::OUString::createFromAscii( "utf-16" );
const rtl::OUString CHARSET_UNICODE = rtl::OUString::createFromAscii( "unicode" );

View file

@ -2,9 +2,9 @@
*
* $RCSfile: ftransl.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: tra $ $Date: 2001-03-09 08:48:02 $
* last change: $Author: tra $ $Date: 2001-03-16 09:01:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -214,8 +214,8 @@ DataFlavor SAL_CALL CDataFormatTranslator::getDataFlavorFromSystemDataType( cons
{
sal_Int32 clipformat;
aSysDataType >>= clipformat;
findDataFlavorForStandardFormatId( clipformat, aFlavor );
if ( CF_INVALID != clipformat )
findDataFlavorForStandardFormatId( clipformat, aFlavor );
}
else if ( aSysDataType.getValueType( ) == CPPUTYPE_OUSTR )
{
@ -225,7 +225,7 @@ DataFlavor SAL_CALL CDataFormatTranslator::getDataFlavorFromSystemDataType( cons
findDataFlavorForNativeFormatName( nativeFormatName, aFlavor );
}
else
OSL_ASSERT( false );
OSL_ENSURE( sal_False, "Invalid data type received" );
return aFlavor;
}

View file

@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
# $Revision: 1.2 $
#
# last change: $Author: tra $ $Date: 2001-02-27 06:55:00 $
# last change: $Author: tra $ $Date: 2001-03-16 09:02:00 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@ -93,7 +93,8 @@ SHL1STDLIBS= \
$(SALLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB)\
ole32.lib
ole32.lib\
gdi32.lib
SHL1TARGET=$(TARGET)
SHL1IMPLIB=i$(SHL1TARGET)

View file

@ -2,9 +2,9 @@
*
* $RCSfile: ImplHelper.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: tra $ $Date: 2001-03-15 08:10:38 $
* last change: $Author: tra $ $Date: 2001-03-16 09:02:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -80,6 +80,7 @@
#include <rtl/memory.h>
#endif
#include <memory>
#include <windows.h>
#include <systools/win32/user9x.h>
@ -107,12 +108,23 @@ using ::rtl::OString;
sal_uInt32 SAL_CALL getWinCPFromMimeCharset( const OUString& charset )
{
OString osCharset( charset.getStr( ), charset.getLength( ), CP_ACP );
OString osCharset(
charset.getStr( ), charset.getLength( ), RTL_TEXTENCODING_ASCII_US );
rtl_TextEncoding textEnc =
rtl_TextEncoding txtEnc =
rtl_getTextEncodingFromMimeCharset( osCharset.getStr( ) );
return rtl_getBestPCCodePageFromTextEncoding( textEnc );
sal_uInt32 winChrs = rtl_getBestWindowsCharsetFromTextEncoding( txtEnc );
CHARSETINFO chrsInf;
sal_Bool bRet = TranslateCharsetInfo(
(DWORD*)winChrs, &chrsInf, TCI_SRCCHARSET );
sal_uInt32 winCP = GetACP( );
if ( bRet )
winCP = chrsInf.ciACP;
return winCP;
}
//--------------------------------------------------
@ -127,10 +139,32 @@ OUString SAL_CALL getWinCPFromLocaleId( LCID lcid, LCTYPE lctype )
// we use the GetLocaleInfoA because don't want to provide
// a unicode wrapper function for Win9x in sal/systools
char buff[6];
GetLocaleInfoA( lcid, lctype, buff, sizeof( buff ) );
rtl_TextEncoding tenc = rtl_getTextEncodingFromPCCodePage( CP_ACP );
sal_Int32 nResult = GetLocaleInfoA(
lcid, lctype | LOCALE_USE_CP_ACP, buff, sizeof( buff ) );
return OUString( buff, rtl_str_getLength( buff ), tenc );
OSL_ASSERT( nResult );
OUString winCP;
if ( nResult )
{
sal_Int32 len = MultiByteToWideChar(
CP_ACP, 0, buff, -1, NULL, 0 );
OSL_ASSERT( len > 0 );
std::auto_ptr< sal_Unicode > lpwchBuff( new sal_Unicode[len] );
if ( NULL != lpwchBuff.get( ) )
{
len = MultiByteToWideChar(
CP_ACP, 0, buff, -1, lpwchBuff.get( ), len );
winCP = OUString( lpwchBuff.get( ), (len - 1) );
}
}
return winCP;
}
//--------------------------------------------------

View file

@ -2,9 +2,9 @@
*
* $RCSfile: MtaOleClipb.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: tra $ $Date: 2001-03-15 08:11:12 $
* last change: $Author: tra $ $Date: 2001-03-16 09:01:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -94,7 +94,7 @@ const sal_uInt32 MSG_FLUSHCLIPBOARD = WM_USER + 0x0004;
const sal_uInt32 MSG_SHUTDOWN = WM_USER + 0x0006;
const sal_uInt32 MAX_WAITTIME = 60000;
const sal_uInt32 MAX_OPCOMPLET_WAITTIME = 60000;
const sal_uInt32 MAX_OPCOMPLET_WAITTIME = 30000;
const sal_uInt32 MAX_WAIT_SHUTDOWN = 30000;
const sal_uInt32 MAX_CLIPEVENT_PROCESSING_TIME = 5000;
@ -173,12 +173,17 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
m_hwndMtaOleReqWnd( NULL ),
m_hwndNextClipViewer( NULL ),
m_pfncClipViewerCallback( NULL ),
m_bInCallbackTriggerOperation( sal_False )
m_bInCallbackTriggerOperation( sal_False ),
m_hEvtWmDrawClipboardReady( NULL )
{
// signals that the thread was successfully set up
m_hEvtThrdReady = CreateEvent( 0, MANUAL_RESET, INIT_NONSIGNALED, NULL );
m_hEvtOpComplete = CreateEvent( 0, AUTO_RESET, INIT_NONSIGNALED, NULL );
OSL_ASSERT( (NULL != m_hEvtThrdReady) && (NULL != m_hEvtOpComplete) );
m_hEvtThrdReady = CreateEventA( 0, MANUAL_RESET, INIT_NONSIGNALED, NULL );
m_hEvtOpComplete = CreateEventA( 0, AUTO_RESET, INIT_NONSIGNALED, NULL );
m_hEvtWmDrawClipboardReady = CreateEventA( 0, AUTO_RESET, INIT_NONSIGNALED, NULL );
OSL_ASSERT( (NULL != m_hEvtThrdReady) &&
(NULL != m_hEvtOpComplete) &&
(NULL != m_hEvtWmDrawClipboardReady) );
s_theMtaOleClipboardInst = this;
@ -218,6 +223,9 @@ CMtaOleClipboard::~CMtaOleClipboard( )
if ( NULL != m_hEvtOpComplete )
CloseHandle( m_hEvtOpComplete );
if ( NULL != m_hEvtWmDrawClipboardReady )
CloseHandle( m_hEvtWmDrawClipboardReady );
OSL_ENSURE( ( NULL == m_pfncClipViewerCallback ) &&
!IsWindow( m_hwndNextClipViewer ), \
"Clipboard viewer not properly unregistered" );
@ -249,8 +257,11 @@ HRESULT CMtaOleClipboard::flushClipboard( )
static_cast< WPARAM >( 0 ),
reinterpret_cast< LPARAM >( &hr ) );
if ( !WaitOpComplete( ) )
if ( !WaitCallbackOpComplete( ) )
{
OSL_ENSURE( sal_False, "Operation timeout" );
hr = E_FAIL;
}
}
m_bInCallbackTriggerOperation = sal_False;
@ -275,6 +286,8 @@ HRESULT CMtaOleClipboard::getClipboard( IDataObject** ppIDataObject )
LPSTREAM lpStream;
HRESULT hr;
*ppIDataObject = NULL;
// we don't need to post the request if we are
// the ole thread self
if ( GetCurrentThreadId( ) == m_uOleThreadId )
@ -286,7 +299,10 @@ HRESULT CMtaOleClipboard::getClipboard( IDataObject** ppIDataObject )
reinterpret_cast< LPARAM >( &hr ) );
if ( !WaitOpComplete( ) )
{
OSL_ENSURE( sal_False, "Operation timeout" );
hr = E_FAIL;
}
}
if ( SUCCEEDED( hr ) )
@ -320,8 +336,11 @@ HRESULT CMtaOleClipboard::setClipboard( IDataObject* pIDataObject )
reinterpret_cast< WPARAM >( pIDataObject ),
reinterpret_cast< LPARAM >( &hr ) );
if ( !WaitOpComplete( ) )
if ( !WaitCallbackOpComplete( ) )
{
OSL_ENSURE( sal_False, "Operation timeout" );
hr = E_FAIL;
}
}
m_bInCallbackTriggerOperation = sal_False;
@ -350,8 +369,11 @@ sal_Bool CMtaOleClipboard::registerClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncC
reinterpret_cast<WPARAM>( pfncClipViewerCallback ),
reinterpret_cast<LPARAM>(&bRet) );
if ( !WaitOpComplete( ) )
if ( !WaitCallbackOpComplete( ) )
{
OSL_ENSURE( sal_False, "Operation timeout" );
bRet = sal_False;
}
}
m_bInCallbackTriggerOperation = sal_False;
@ -399,6 +421,7 @@ sal_Bool CMtaOleClipboard::onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfn
// WM_DRAWCLIPBOARD message we have to release the
// waiting thread exclusively
SetEvent( m_hEvtOpComplete );
SetEvent( m_hEvtWmDrawClipboardReady );
}
return bRet;
@ -410,8 +433,7 @@ sal_Bool CMtaOleClipboard::onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfn
LRESULT CMtaOleClipboard::onSetClipboard( IDataObject* pIDataObject )
{
HRESULT hr = OleSetClipboard( pIDataObject );
return static_cast<LRESULT>(hr);
return static_cast<LRESULT>( OleSetClipboard( pIDataObject ) );
}
//--------------------------------------------------------------------
@ -438,9 +460,6 @@ LRESULT CMtaOleClipboard::onGetClipboard( LPSTREAM* ppStream )
LRESULT CMtaOleClipboard::onFlushClipboard( )
{
// the call will be block until the
// WM_DRAWCLIPBOARD message has been
// processed
return static_cast<LRESULT>( OleFlushClipboard( ) );
}
@ -503,7 +522,7 @@ LRESULT CMtaOleClipboard::onDrawClipboard( )
// clipboard operation so the call becomes synchronous
// for the caller
if ( m_bInCallbackTriggerOperation )
SetEvent( m_hEvtOpComplete );
SetEvent( m_hEvtWmDrawClipboardReady );
return 0;
}
@ -546,6 +565,7 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA
case MSG_SETCLIPBOARD:
*(reinterpret_cast< HRESULT* >( lParam )) =
pImpl->onSetClipboard( reinterpret_cast< IDataObject* >(wParam) );
SetEvent( pImpl->m_hEvtOpComplete );
break;
case MSG_GETCLIPBOARD:
@ -556,11 +576,13 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA
case MSG_FLUSHCLIPBOARD:
*(reinterpret_cast< HRESULT* >( lParam )) = pImpl->onFlushClipboard( );
SetEvent( pImpl->m_hEvtOpComplete );
break;
case MSG_REGCLIPVIEWER:
*(reinterpret_cast<sal_Bool*>(lParam)) = pImpl->onRegisterClipViewer(
reinterpret_cast<LPFNC_CLIPVIEWER_CALLBACK_t>(wParam) );
SetEvent( pImpl->m_hEvtOpComplete );
break;
case WM_CHANGECBCHAIN:
@ -662,6 +684,7 @@ unsigned int WINAPI CMtaOleClipboard::oleThreadProc( LPVOID pParam )
//
//--------------------------------------------------------------------
inline
sal_Bool CMtaOleClipboard::WaitForThreadReady( ) const
{
sal_Bool bRet = sal_False;
@ -680,6 +703,7 @@ sal_Bool CMtaOleClipboard::WaitForThreadReady( ) const
//
//--------------------------------------------------------------------
inline
sal_Bool CMtaOleClipboard::WaitOpComplete( ) const
{
sal_Bool bRet = sal_False;
@ -692,4 +716,27 @@ sal_Bool CMtaOleClipboard::WaitOpComplete( ) const
}
return bRet;
}
}
//--------------------------------------------------------------------
//
//--------------------------------------------------------------------
sal_Bool CMtaOleClipboard::WaitCallbackOpComplete( ) const
{
sal_Bool bRet = sal_False;
if ( (NULL != m_hEvtOpComplete) && (NULL != m_hEvtWmDrawClipboardReady) )
{
HANDLE hEvt[2];
hEvt[0] = m_hEvtOpComplete;
hEvt[1] = m_hEvtWmDrawClipboardReady;
DWORD dwResult =
WaitForMultipleObjects( 2, &hEvt[0], TRUE, MAX_OPCOMPLET_WAITTIME );
bRet = ( dwResult == WAIT_OBJECT_0 );
}
return bRet;
}