diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx index 0e8b96074230..766430f488fc 100644 --- a/include/svl/svdde.hxx +++ b/include/svl/svdde.hxx @@ -28,13 +28,6 @@ #include #include -#if defined _WIN32 -#include -#include -#include -#include -#endif - class DdeString; class DdeData; class DdeConnection; @@ -213,11 +206,6 @@ class SVL_DLLPUBLIC DdeItem DdeTopic* pMyTopic; DdeItemImp* pImpData; -#if defined _WIN32 - void IncMonitor( HCONV ); - void DecMonitor( HCONV ); -#endif - protected: sal_uInt8 nType; @@ -248,9 +236,6 @@ public: class SVL_DLLPUBLIC DdeTopic { -#if defined _WIN32 - SVL_DLLPRIVATE void Disconnect( HCONV ); -#endif public: virtual DdeData* Get(SotClipboardFormatId); diff --git a/svl/source/svdde/ddeimp.hxx b/svl/source/svdde/ddeimp.hxx index 492f1dc74f17..28f611b83896 100644 --- a/svl/source/svdde/ddeimp.hxx +++ b/svl/source/svdde/ddeimp.hxx @@ -49,6 +49,9 @@ public: static DdeService* FindService( HSZ ); static DdeTopic* FindTopic( DdeService&, HSZ ); static DdeItem* FindItem( DdeTopic&, HSZ ); + static void DisconnectTopic(DdeTopic &, HCONV); + static void IncMonitor(DdeItem *pItem, HCONV); + static void DecMonitor(DdeItem *pItem, HCONV); }; diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 36070360ea8f..213990e0a554 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -194,7 +194,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback( found: if ( nCode == XTYP_DISCONNECT) { - pC->pTopic->Disconnect( hConv ); + DisconnectTopic(*pC->pTopic, hConv); for ( ConvList::iterator it = pService->pConv->begin(); it != pService->pConv->end(); ++it @@ -326,13 +326,13 @@ found: if (pItem) { - pItem->IncMonitor( hConv ); + IncMonitor(pItem, hConv); } } return (HDDEDATA)sal_True; case XTYP_ADVSTOP: - pItem->DecMonitor( hConv ); + DecMonitor(pItem, hConv); return (HDDEDATA)sal_True; case XTYP_EXECUTE: @@ -669,11 +669,13 @@ void DdeTopic::NotifyClient( const OUString& rItem ) } } -void DdeTopic::Disconnect( HCONV nId ) +void DdeInternal::DisconnectTopic(DdeTopic & rTopic, HCONV nId) { std::vector::iterator iter; - for (iter = aItems.begin(); iter != aItems.end(); ++iter) - (*iter)->DecMonitor( nId ); + for (iter = rTopic.aItems.begin(); iter != rTopic.aItems.end(); ++iter) + { + DecMonitor(*iter, nId); + } } DdeData* DdeTopic::Get(SotClipboardFormatId /*nFmt*/) @@ -750,47 +752,53 @@ void DdeItem::NotifyClient() } } -void DdeItem::IncMonitor( HCONV nHCnv ) +void DdeInternal::IncMonitor(DdeItem *const pItem, HCONV nHCnv) { - if( !pImpData ) + if (!pItem->pImpData) { - pImpData = new DdeItemImp; - if( DDEGETPUTITEM == nType ) - ((DdeGetPutItem*)this)->AdviseLoop( true ); + pItem->pImpData = new DdeItemImp; + if (DDEGETPUTITEM == pItem->nType) + { + static_cast(pItem)->AdviseLoop( true ); + } } else { - for( sal_uInt16 n = pImpData->size(); n; ) - if( (*pImpData)[ --n ].nHCnv == nHCnv ) + for (size_t n = pItem->pImpData->size(); n; ) + { + if ((*pItem->pImpData)[ --n ].nHCnv == nHCnv) { - ++(*pImpData)[ n ].nHCnv; + ++(*pItem->pImpData)[ n ].nHCnv; return ; } + } } - pImpData->push_back( DdeItemImpData( nHCnv ) ); + pItem->pImpData->push_back( DdeItemImpData( nHCnv ) ); } -void DdeItem::DecMonitor( HCONV nHCnv ) +void DdeInternal::DecMonitor(DdeItem *const pItem, HCONV nHCnv) { - if( pImpData ) + if (pItem->pImpData) { - for( sal_uInt16 n = 0; n < pImpData->size(); ++n ) + for( sal_uInt16 n = 0; n < pItem->pImpData->size(); ++n ) { - DdeItemImpData* pData = &(*pImpData)[n]; + DdeItemImpData* pData = &(*pItem->pImpData)[n]; if( pData->nHCnv == nHCnv ) { if( !pData->nCnt || !--pData->nCnt ) { - if( 1 < pImpData->size() ) + if (1 < pItem->pImpData->size()) { - pImpData->erase(pImpData->begin() + n); + pItem->pImpData->erase(pItem->pImpData->begin() + n); } else { - delete pImpData, pImpData = 0; - if( DDEGETPUTITEM == nType ) - ((DdeGetPutItem*)this)->AdviseLoop( false ); + delete pItem->pImpData, pItem->pImpData = 0; + if (DDEGETPUTITEM == pItem->nType) + { + static_cast(pItem)->AdviseLoop(false); + } } } return ;