diff options
author | Noel Grandin <noel@peralex.com> | 2015-08-13 13:24:28 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-08-14 07:15:01 +0000 |
commit | adbc556c91ea4afaf3e952aa0a8329e004add63e (patch) | |
tree | b5d03e056f129abcddf6a53934db07ec611ac19f | |
parent | c8f0b37528b69b77dbe8596915e34fd915e34b8d (diff) |
make Link<> instances typed
and remove some unused code
Change-Id: I934824401b5c528b07ad76f753f78440c4492885
Reviewed-on: https://gerrit.libreoffice.org/17703
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | basic/source/runtime/ddectrl.cxx | 3 | ||||
-rw-r--r-- | basic/source/runtime/ddectrl.hxx | 2 | ||||
-rw-r--r-- | include/svl/svdde.hxx | 44 | ||||
-rw-r--r-- | sfx2/source/appl/impldde.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/appl/impldde.hxx | 4 | ||||
-rw-r--r-- | svl/source/svdde/ddecli.cxx | 5 | ||||
-rw-r--r-- | svl/source/svdde/ddesvr.cxx | 25 | ||||
-rw-r--r-- | svl/unx/source/svdde/ddedummy.cxx | 8 |
8 files changed, 24 insertions, 76 deletions
diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index 7f7d2a792357..4e965d3c9a84 100644 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -67,10 +67,9 @@ SbError SbiDdeControl::GetLastErr( DdeConnection* pConv ) return nDdeErrMap[ 2 * (nErr - DDE_FIRSTERR) + 1 ]; } -IMPL_LINK( SbiDdeControl,Data , DdeData*, pData ) +IMPL_LINK_TYPED( SbiDdeControl, Data, const DdeData*, pData, void ) { aData = OUString::createFromAscii( static_cast<const char*>(static_cast<const void*>(*pData)) ); - return 1; } SbiDdeControl::SbiDdeControl() diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx index 0bcfd32d94d5..0eaac2123b51 100644 --- a/basic/source/runtime/ddectrl.hxx +++ b/basic/source/runtime/ddectrl.hxx @@ -29,7 +29,7 @@ class DdeData; class SbiDdeControl { private: - DECL_LINK( Data, DdeData* ); + DECL_LINK_TYPED( Data, const DdeData*, void ); static SbError GetLastErr( DdeConnection* ); size_t GetFreeChannel(); std::vector<DdeConnection*> aConvList; diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx index a616268b5a75..9889774f3226 100644 --- a/include/svl/svdde.hxx +++ b/include/svl/svdde.hxx @@ -98,8 +98,8 @@ protected: short nType; sal_IntPtr nId; sal_IntPtr nTime; - Link<> aData; - Link<> aDone; + Link<const DdeData*,void> aData; + Link<bool,void> aDone; bool bBusy; DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER long = 0 ); @@ -112,11 +112,11 @@ public: void Execute(); - void SetDataHdl( const Link<>& rLink ) { aData = rLink; } - const Link<>& GetDataHdl() const { return aData; } + void SetDataHdl( const Link<const DdeData*,void>& rLink ) { aData = rLink; } + const Link<const DdeData*,void>& GetDataHdl() const { return aData; } - void SetDoneHdl( const Link<>& rLink ) { aDone = rLink; } - const Link<>& GetDoneHdl() const { return aDone; } + void SetDoneHdl( const Link<bool,void>& rLink ) { aDone = rLink; } + const Link<bool,void>& GetDoneHdl() const { return aDone; } void SetFormat( SotClipboardFormatId nFmt ) { aDdeData.SetFormat( nFmt ); } SotClipboardFormatId GetFormat() const { return aDdeData.GetFormat(); } @@ -138,14 +138,14 @@ private: class SVL_DLLPUBLIC DdeLink : public DdeTransaction { - Link<> aNotify; + Link<void*,void> aNotify; public: DdeLink( DdeConnection&, const OUString&, long = 0 ); virtual ~DdeLink(); - void SetNotifyHdl( const Link<>& rLink ) { aNotify = rLink; } - const Link<>& GetNotifyHdl() const { return aNotify; } + void SetNotifyHdl( const Link<void*,void>& rLink ) { aNotify = rLink; } + const Link<void*,void>& GetNotifyHdl() const { return aNotify; } void Notify(); }; @@ -288,8 +288,6 @@ class SVL_DLLPUBLIC DdeTopic SVL_DLLPRIVATE void _Disconnect( sal_IntPtr ); public: - void Connect( sal_IntPtr ); - void Disconnect( sal_IntPtr ); virtual DdeData* Get(SotClipboardFormatId); virtual bool Put( const DdeData* ); virtual bool Execute( const OUString* ); @@ -306,40 +304,24 @@ private: friend class DdeItem; private: - DdeString* pName; - OUString aItem; + DdeString* pName; + OUString aItem; std::vector<DdeItem*> aItems; - Link<> aConnectLink; - Link<> aDisconnectLink; - Link<> aGetLink; - Link<> aPutLink; - Link<> aExecLink; public: DdeTopic( SAL_UNUSED_PARAMETER const OUString& ); virtual ~DdeTopic(); - const OUString GetName() const; + const OUString GetName() const; long GetConvId(); - void SetConnectHdl( const Link<>& rLink ) { aConnectLink = rLink; } - const Link<>& GetConnectHdl() const { return aConnectLink; } - void SetDisconnectHdl( const Link<>& rLink ) { aDisconnectLink = rLink; } - const Link<>& GetDisconnectHdl() const { return aDisconnectLink; } - void SetGetHdl( const Link<>& rLink ) { aGetLink = rLink; } - const Link<>& GetGetHdl() const { return aGetLink; } - void SetPutHdl( const Link<>& rLink ) { aPutLink = rLink; } - const Link<>& GetPutHdl() const { return aPutLink; } - void SetExecuteHdl( const Link<>& rLink ) { aExecLink = rLink; } - const Link<>& GetExecuteHdl() const { return aExecLink; } - void NotifyClient( const OUString& ); bool IsSystemTopic(); void InsertItem( DdeItem* ); // For own superclasses DdeItem* AddItem( const DdeItem& ); // Will be cloned void RemoveItem( const DdeItem& ); - const OUString& GetCurItem() { return aItem; } + const OUString& GetCurItem() { return aItem; } const std::vector<DdeItem*>& GetItems() const { return aItems; } private: diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx index 12bd1ccacb52..70ed17d20957 100644 --- a/sfx2/source/appl/impldde.cxx +++ b/sfx2/source/appl/impldde.cxx @@ -326,7 +326,7 @@ bool SvDDEObject::IsDataComplete() const return bWaitForData; } -IMPL_LINK( SvDDEObject, ImplGetDDEData, DdeData*, pData ) +IMPL_LINK_TYPED( SvDDEObject, ImplGetDDEData, const DdeData*, pData, void ) { SotClipboardFormatId nFmt = pData->GetFormat(); switch( nFmt ) @@ -358,13 +358,10 @@ IMPL_LINK( SvDDEObject, ImplGetDDEData, DdeData*, pData ) } } } - - return 0; } -IMPL_LINK( SvDDEObject, ImplDoneDDEData, void*, pData ) +IMPL_LINK_TYPED( SvDDEObject, ImplDoneDDEData, bool, bValid, void ) { - bool bValid = (bool)reinterpret_cast<sal_uIntPtr>(pData); if( !bValid && ( pRequest || pLink )) { DdeTransaction* pReq = 0; @@ -388,8 +385,6 @@ IMPL_LINK( SvDDEObject, ImplDoneDDEData, void*, pData ) else // End waiting bWaitForData = sal_False; - - return 0; } } diff --git a/sfx2/source/appl/impldde.hxx b/sfx2/source/appl/impldde.hxx index b6c66eadf966..0185c0a88b35 100644 --- a/sfx2/source/appl/impldde.hxx +++ b/sfx2/source/appl/impldde.hxx @@ -45,8 +45,8 @@ class SvDDEObject : public SvLinkSource static bool ImplHasOtherFormat( DdeTransaction& ); - DECL_LINK( ImplGetDDEData, DdeData* ); - DECL_LINK( ImplDoneDDEData, void* ); + DECL_LINK_TYPED( ImplGetDDEData, const DdeData*, void ); + DECL_LINK_TYPED( ImplDoneDDEData, bool, void ); protected: virtual ~SvDDEObject(); diff --git a/svl/source/svdde/ddecli.cxx b/svl/source/svdde/ddecli.cxx index f771075a333d..ada0d241be30 100644 --- a/svl/source/svdde/ddecli.cxx +++ b/svl/source/svdde/ddecli.cxx @@ -335,15 +335,14 @@ void DdeTransaction::Data( const DdeData* p ) { if ( ::tools::SolarMutex::Acquire() ) { - aData.Call( (void*)p ); + aData.Call( p ); ::tools::SolarMutex::Release(); } } void DdeTransaction::Done( bool bDataValid ) { - const sal_uIntPtr nDataValid(bDataValid); - aDone.Call( reinterpret_cast<void*>(nDataValid) ); + aDone.Call( bDataValid ); } DdeLink::DdeLink( DdeConnection& d, const OUString& aItemName, long n ) diff --git a/svl/source/svdde/ddesvr.cxx b/svl/source/svdde/ddesvr.cxx index 9e62e12f8afe..9af669bfbf53 100644 --- a/svl/source/svdde/ddesvr.cxx +++ b/svl/source/svdde/ddesvr.cxx @@ -678,16 +678,6 @@ void DdeTopic::NotifyClient( const OUString& rItem ) } } -void DdeTopic::Connect( sal_IntPtr nId ) -{ - aConnectLink.Call( (void*)nId ); -} - -void DdeTopic::Disconnect( sal_IntPtr nId ) -{ - aDisconnectLink.Call( (void*)nId ); -} - void DdeTopic::_Disconnect( sal_IntPtr nId ) { std::vector<DdeItem*>::iterator iter; @@ -699,26 +689,17 @@ void DdeTopic::_Disconnect( sal_IntPtr nId ) DdeData* DdeTopic::Get(SotClipboardFormatId nFmt) { - if ( aGetLink.IsSet() ) - return (DdeData*)aGetLink.Call( (void*)nFmt ); - else - return NULL; + return NULL; } bool DdeTopic::Put( const DdeData* r ) { - if ( aPutLink.IsSet() ) - return aPutLink.Call( (void*) r ); - else - return false; + return false; } bool DdeTopic::Execute( const OUString* r ) { - if ( aExecLink.IsSet() ) - return aExecLink.Call( (void*)r ); - else - return false; + return false; } long DdeTopic::GetConvId() diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx index 4813dc36b5da..b504b5fe38fd 100644 --- a/svl/unx/source/svdde/ddedummy.cxx +++ b/svl/unx/source/svdde/ddedummy.cxx @@ -145,14 +145,6 @@ DdeTopic::~DdeTopic() { } -void DdeTopic::Connect( SAL_UNUSED_PARAMETER long ) -{ -} - -void DdeTopic::Disconnect( SAL_UNUSED_PARAMETER long ) -{ -} - void DdeTopic::InsertItem( SAL_UNUSED_PARAMETER DdeItem* ) { } |