[Libreoffice-commits] core.git: basic/source include/svl sfx2/source svl/source svl/unx

Noel Grandin noel at peralex.com
Fri Aug 14 00:15:23 PDT 2015


 basic/source/runtime/ddectrl.cxx  |    3 --
 basic/source/runtime/ddectrl.hxx  |    2 -
 include/svl/svdde.hxx             |   44 +++++++++++---------------------------
 sfx2/source/appl/impldde.cxx      |    9 +------
 sfx2/source/appl/impldde.hxx      |    4 +--
 svl/source/svdde/ddecli.cxx       |    5 +---
 svl/source/svdde/ddesvr.cxx       |   25 ++-------------------
 svl/unx/source/svdde/ddedummy.cxx |    8 ------
 8 files changed, 24 insertions(+), 76 deletions(-)

New commits:
commit adbc556c91ea4afaf3e952aa0a8329e004add63e
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Aug 13 13:24:28 2015 +0200

    make Link<> instances typed
    
    and remove some unused code
    
    Change-Id: I934824401b5c528b07ad76f753f78440c4492885
    Reviewed-on: https://gerrit.libreoffice.org/17703
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx
index 7f7d2a7..4e965d3 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 0bcfd32..0eaac212 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 a616268..9889774 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 12bd1cc..70ed17d 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 b6c66ea..0185c0a 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 f771075..ada0d24 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 9e62e12..9af669b 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 4813dc3..b504b5f 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* )
 {
 }


More information about the Libreoffice-commits mailing list