diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-10-07 17:44:02 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-10-07 17:48:37 +0200 |
commit | d211dafa9e35d9af26acc274b18a32b8ca0b937a (patch) | |
tree | da24d477d3f3b55ff68ae599f9600f4425f62267 /svl/source/svdde | |
parent | ce650fc1cd83ff94183b783c95b9f20aaa14f942 (diff) |
svl: remove #include windows.h from svdde.hxx
Move Win32 stuff over to DdeInternal class where it can be better
encapsulated.
Change-Id: Ia3d4c72cf7ad1b7d54bef5d175c579cd426407e7
Diffstat (limited to 'svl/source/svdde')
-rw-r--r-- | svl/source/svdde/ddeimp.hxx | 3 | ||||
-rw-r--r-- | svl/source/svdde/ddesvr.cxx | 56 |
2 files changed, 35 insertions, 24 deletions
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<DdeItem*>::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<DdeGetPutItem*>(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<DdeGetPutItem*>(pItem)->AdviseLoop(false); + } } } return ; |