[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source

Noel Grandin noel at peralex.com
Thu Sep 17 23:47:38 PDT 2015


 sw/inc/crsrsh.hxx                           |   18 +++++++++---------
 sw/inc/doc.hxx                              |   12 ++++++------
 sw/inc/docsh.hxx                            |    2 +-
 sw/inc/view.hxx                             |    3 ++-
 sw/source/core/crsr/callnk.cxx              |    2 +-
 sw/source/core/crsr/crsrsh.cxx              |    2 +-
 sw/source/core/crsr/findattr.cxx            |    4 ++--
 sw/source/core/crsr/findcoll.cxx            |    4 ++--
 sw/source/core/crsr/findtxt.cxx             |    4 ++--
 sw/source/core/doc/DocumentStateManager.cxx |   12 ++++--------
 sw/source/core/frmedt/feshview.cxx          |    2 +-
 sw/source/core/swg/SwXMLTextBlocks.cxx      |    4 ++--
 sw/source/core/txtnode/txtatr2.cxx          |    8 ++++----
 sw/source/filter/basflt/shellio.cxx         |    6 +++---
 sw/source/filter/html/swhtml.cxx            |    4 ++--
 sw/source/uibase/app/docsh.cxx              |   13 ++++---------
 sw/source/uibase/app/docshini.cxx           |    2 +-
 sw/source/uibase/dochdl/swdtflvr.cxx        |    8 ++++----
 sw/source/uibase/inc/basesh.hxx             |    5 +++--
 sw/source/uibase/inc/wrtsh.hxx              |    2 +-
 sw/source/uibase/shells/basesh.cxx          |    7 +++----
 sw/source/uibase/uiview/view.cxx            |    4 +---
 sw/source/uibase/wrtsh/select.cxx           |    5 ++---
 23 files changed, 61 insertions(+), 72 deletions(-)

New commits:
commit c8ee3be0e08c435b106f0ac4b76618b33333b040
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Sep 18 08:45:50 2015 +0200

    convert Link<> to typed
    
    Change-Id: I124ed873862684efe7cab52c26d13c6621d49aab

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 1bbca5b..e2966d2 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -250,10 +250,10 @@ class SW_DLLPUBLIC SwDoc :
     friend void _FinitCore();
 
     // private Member
-    std::unique_ptr<SwNodes> m_pNodes;  //< document content (Nodes Array)
-    SwAttrPool* mpAttrPool;             //< the attribute pool
-    SwPageDescs m_PageDescs;             //< PageDescriptors
-    Link<>      maOle2Link;              //< OLE 2.0-notification
+    std::unique_ptr<SwNodes> m_pNodes;    //< document content (Nodes Array)
+    SwAttrPool*              mpAttrPool;  //< the attribute pool
+    SwPageDescs              m_PageDescs; //< PageDescriptors
+    Link<bool,void>          maOle2Link;  //< OLE 2.0-notification
     /* @@@MAINTAINABILITY-HORROR@@@
        Timer should not be members of the model
     */
@@ -1329,8 +1329,8 @@ public:
     ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
 
     // OLE 2.0-notification.
-    inline       void  SetOle2Link(const Link<>& rLink) {maOle2Link = rLink;}
-    inline const Link<>& GetOle2Link() const {return maOle2Link;}
+    inline       void  SetOle2Link(const Link<bool,void>& rLink) {maOle2Link = rLink;}
+    inline const Link<bool,void>& GetOle2Link() const {return maOle2Link;}
 
     // insert section (the ODF kind of section, not the nodesarray kind)
     SwSection * InsertSwSection(SwPaM const& rRange, SwSectionData &,
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index cf35adc..097b850 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -174,7 +174,7 @@ public:
     virtual ~SwDocShell();
 
     /// OLE 2.0-notification.
-    DECL_LINK( Ole2ModifiedHdl, void * );
+    DECL_LINK_TYPED( Ole2ModifiedHdl, bool, void );
 
     /// OLE-stuff.
     virtual void      SetVisArea( const Rectangle &rRect ) SAL_OVERRIDE;
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index a357a61..ff68ce9 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -1226,8 +1226,8 @@ sal_uLong SwCursor::Find( const SfxItemSet& rSet, bool bNoCollections,
 {
     // switch off OLE-notifications
     SwDoc* pDoc = GetDoc();
-    Link<> aLnk( pDoc->GetOle2Link() );
-    pDoc->SetOle2Link( Link<>() );
+    Link<bool,void> aLnk( pDoc->GetOle2Link() );
+    pDoc->SetOle2Link( Link<bool,void>() );
 
     bool bReplace = ( pSearchOpt && ( !pSearchOpt->replaceString.isEmpty() ||
                                     !rSet.Count() ) ) ||
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
index 762e533..5523a25 100644
--- a/sw/source/core/crsr/findcoll.cxx
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -70,8 +70,8 @@ sal_uLong SwCursor::Find( const SwTextFormatColl& rFormatColl, SwDocPositions nS
 {
     // switch off OLE-notifications
     SwDoc* pDoc = GetDoc();
-    Link<> aLnk( pDoc->GetOle2Link() );
-    pDoc->SetOle2Link( Link<>() );
+    Link<bool,void> aLnk( pDoc->GetOle2Link() );
+    pDoc->SetOle2Link( Link<bool,void>() );
 
     bool const bStartUndo =
         pDoc->GetIDocumentUndoRedo().DoesUndo() && pReplFormatColl;
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index e859a99..02952b4 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -710,8 +710,8 @@ sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes,
 {
     // switch off OLE-notifications
     SwDoc* pDoc = GetDoc();
-    Link<> aLnk( pDoc->GetOle2Link() );
-    pDoc->SetOle2Link( Link<>() );
+    Link<bool,void> aLnk( pDoc->GetOle2Link() );
+    pDoc->SetOle2Link( Link<bool,void>() );
 
     bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace;
     if (bStartUndo)
diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx
index 0401fa6..ec6286a 100644
--- a/sw/source/core/doc/DocumentStateManager.cxx
+++ b/sw/source/core/doc/DocumentStateManager.cxx
@@ -40,16 +40,12 @@ DocumentStateManager::DocumentStateManager( SwDoc& i_rSwdoc ) :
 void DocumentStateManager::SetModified()
 {
     m_rDoc.GetDocumentLayoutManager().ClearSwLayouterEntries();
-    // give the old and new modified state to the link
-    //  Bit 0:  -> old state
-    //  Bit 1:  -> new state
-    sal_IntPtr nCall = mbModified ? 3 : 2;
     mbModified = true;
     m_rDoc.GetDocumentStatisticsManager().GetDocStat().bModified = true;
     if( m_rDoc.GetOle2Link().IsSet() )
     {
         mbInCallModified = true;
-        m_rDoc.GetOle2Link().Call( reinterpret_cast<void*>(nCall) );
+        m_rDoc.GetOle2Link().Call( true );
         mbInCallModified = false;
     }
 
@@ -62,14 +58,14 @@ void DocumentStateManager::ResetModified()
     // give the old and new modified state to the link
     //  Bit 0:  -> old state
     //  Bit 1:  -> new state
-    sal_IntPtr nCall = mbModified ? 1 : 0;
+    bool bOldModified = mbModified;
     mbModified = false;
     m_rDoc.GetDocumentStatisticsManager().GetDocStat().bModified = false;
     m_rDoc.GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
-    if( nCall && m_rDoc.GetOle2Link().IsSet() )
+    if( bOldModified && m_rDoc.GetOle2Link().IsSet() )
     {
         mbInCallModified = true;
-        m_rDoc.GetOle2Link().Call( reinterpret_cast<void*>(nCall) );
+        m_rDoc.GetOle2Link().Call( false );
         mbInCallModified = false;
     }
 }
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index c1d678e..bae58e4 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -68,7 +68,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const OUString& rFile )
     bReadOnly = true;
     pDoc = pDocSh->GetDoc();
     xDocShellRef = pDocSh;
-    pDoc->SetOle2Link( Link<>() );
+    pDoc->SetOle2Link( Link<bool,void>() );
     pDoc->GetIDocumentUndoRedo().DoUndo(false);
     pDoc->acquire();
     uno::Reference< embed::XStorage > refStg;
@@ -114,7 +114,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg
     bReadOnly = false;
     pDoc = pDocSh->GetDoc();
     xDocShellRef = pDocSh;
-    pDoc->SetOle2Link( Link<>() );
+    pDoc->SetOle2Link( Link<bool,void>() );
     pDoc->GetIDocumentUndoRedo().DoUndo(false);
     pDoc->acquire();
 
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 34483d9..e9bbcc4 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -141,11 +141,11 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
         // JP 10.02.2000, Bug 72806: dont modify the doc for getting the
         //      correct charstyle.
         bool bResetMod = !pDoc->getIDocumentState().IsModified();
-        Link<> aOle2Lnk;
+        Link<bool,void> aOle2Lnk;
         if ( bResetMod )
         {
             aOle2Lnk = pDoc->GetOle2Link();
-            pDoc->SetOle2Link( Link<>() );
+            pDoc->SetOle2Link( Link<bool,void>() );
         }
 
         pRet = IsPoolUserFormat( nId )
@@ -263,11 +263,11 @@ SwCharFormat* SwTextRuby::GetCharFormat()
         // JP 10.02.2000, Bug 72806: dont modify the doc for getting the
         //              correct charstyle.
         const bool bResetMod = !pDoc->getIDocumentState().IsModified();
-        Link<> aOle2Lnk;
+        Link<bool,void> aOle2Lnk;
         if( bResetMod )
         {
             aOle2Lnk = pDoc->GetOle2Link();
-            const_cast<SwDoc*>(pDoc)->SetOle2Link( Link<>() );
+            const_cast<SwDoc*>(pDoc)->SetOle2Link( Link<bool,void>() );
         }
 
         pRet = IsPoolUserFormat( nId )
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 33573cc..f5dc13a 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -87,8 +87,8 @@ sal_uLong SwReader::Read( const Reader& rOptions )
     GetDoc();
 
     // while reading, do not call OLE-Modified
-    Link<> aOLELink( pDoc->GetOle2Link() );
-    pDoc->SetOle2Link( Link<>() );
+    Link<bool,void> aOLELink( pDoc->GetOle2Link() );
+    pDoc->SetOle2Link( Link<bool,void>() );
 
     pDoc->SetInReading( true );
     pDoc->SetInXMLImport( 0 != dynamic_cast< XMLReader* >(po) );
@@ -503,7 +503,7 @@ SwDoc* Reader::GetTemplateDoc()
                     if( pDocSh->DoInitNew( 0 ) )
                     {
                         pTemplate = pDocSh->GetDoc();
-                        pTemplate->SetOle2Link( Link<>() );
+                        pTemplate->SetOle2Link( Link<bool,void>() );
                         // always FALSE
                         pTemplate->GetIDocumentUndoRedo().DoUndo( false );
                         pTemplate->getIDocumentSettingAccess().set(DocumentSettingId::BROWSE_MODE, bTmplBrowseMode );
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 22ede3a..4514f5c 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -605,8 +605,8 @@ void SwHTMLParser::Continue( int nToken )
     }
 
     // waehrend des einlesens kein OLE-Modified rufen
-    Link<> aOLELink( pDoc->GetOle2Link() );
-    pDoc->SetOle2Link( Link<>() );
+    Link<bool,void> aOLELink( pDoc->GetOle2Link() );
+    pDoc->SetOle2Link( Link<bool,void>() );
 
     bool bModified = pDoc->getIDocumentState().IsModified();
     bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index e1237d3..8b94f66 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -482,8 +482,8 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium )
         // (for OLE; after Statement from MM)
         const bool bIsModified = m_pDoc->getIDocumentState().IsModified();
         m_pDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition();
-        Link<> aOldOLELnk( m_pDoc->GetOle2Link() );
-        m_pDoc->SetOle2Link( Link<>() );
+        Link<bool,void> aOldOLELnk( m_pDoc->GetOle2Link() );
+        m_pDoc->SetOle2Link( Link<bool,void>() );
 
             // Suppress SfxProgress when we are Embedded
         SW_MOD()->SetEmbeddedLoadSave(
@@ -1069,15 +1069,10 @@ void SwDocShell::GetState(SfxItemSet& rSet)
 }
 
 // OLE-Hdls
-IMPL_LINK( SwDocShell, Ole2ModifiedHdl, void *, p )
+IMPL_LINK_TYPED( SwDocShell, Ole2ModifiedHdl, bool, bNewStatus, void )
 {
-    // the Status is handed over from Doc (see doc.cxx)
-    //  Bit 0:  -> old state
-    //  Bit 1:  -> new state
-    sal_IntPtr nStatus = reinterpret_cast<sal_IntPtr>(p);
     if( IsEnableSetModified() )
-        SetModified( (nStatus & 2) != 0 );
-    return 0;
+        SetModified( bNewStatus );
 }
 
 // return Pool here, because virtual
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 70f2c0f..a42dde3 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -464,7 +464,7 @@ void SwDocShell::RemoveLink()
             m_xBasePool.clear();
         }
         sal_Int8 nRefCt = static_cast< sal_Int8 >(m_pDoc->release());
-        m_pDoc->SetOle2Link(Link<>());
+        m_pDoc->SetOle2Link(Link<bool,void>());
         m_pDoc->SetDocShell( 0 );
         if( !nRefCt )
             delete m_pDoc;
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 21aa11f..142b02e 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3773,8 +3773,8 @@ void SwTrnsfrDdeLink::Disconnect( bool bRemoveDataAdvise )
         ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
 
         // #i58448#
-        Link<> aSavedOle2Link( pDoc->GetOle2Link() );
-        pDoc->SetOle2Link( Link<>() );
+        Link<bool,void> aSavedOle2Link( pDoc->GetOle2Link() );
+        pDoc->SetOle2Link( Link<bool,void>() );
 
         bool bIsModified = pDoc->getIDocumentState().IsModified();
 
commit eb76c8f62a578ddc67a6442e87ec81845e5a73d0
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 17 16:54:38 2015 +0200

    convert Link<> to typed
    
    Change-Id: Ia0e76911dba6e1e2fd5f01799121c8f4b4219aba

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index cf6d818..e38a6c1 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -170,7 +170,7 @@ private:
                                    into a fly. A macro can then be called */
     Link<SwCrsrShell*,void> m_aChgLnk;             /**< link will be called by every attribute/
                                    format changes at cursor position.*/
-    Link<> m_aGrfArrivedLnk;      ///< Link calls to UI if a graphic is arrived
+    Link<SwCrsrShell&,void> m_aGrfArrivedLnk;      ///< Link calls to UI if a graphic is arrived
 
     SwShellCrsr* m_pCurCrsr;      ///< current cursor
     SwShellCrsr* m_pCrsrStk;      ///< stack for the cursor
@@ -489,8 +489,8 @@ public:
     const Link<SwCrsrShell*,void>& GetChgLnk() const           { return m_aChgLnk; }
 
     // Methods returning/altering ling for "graphic completely loaded".
-    void        SetGrfArrivedLnk( const Link<> &rLnk ) { m_aGrfArrivedLnk = rLnk; }
-    const Link<>& GetGrfArrivedLnk() const           { return m_aGrfArrivedLnk; }
+    void        SetGrfArrivedLnk( const Link<SwCrsrShell&,void> &rLnk ) { m_aGrfArrivedLnk = rLnk; }
+    const Link<SwCrsrShell&,void>& GetGrfArrivedLnk() const           { return m_aGrfArrivedLnk; }
 
     //Call ChgLink. When within an action calling will be delayed.
     void CallChgLnk();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 5a2b487..92916e4 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2200,7 +2200,7 @@ void SwCrsrShell::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
 
     if( m_aGrfArrivedLnk.IsSet() &&
         ( RES_GRAPHIC_ARRIVED == nWhich || RES_GRAPHIC_SWAPIN == nWhich ))
-        m_aGrfArrivedLnk.Call( this );
+        m_aGrfArrivedLnk.Call( *this );
 }
 
 /** Does the current cursor create a selection?
diff --git a/sw/source/uibase/inc/basesh.hxx b/sw/source/uibase/inc/basesh.hxx
index 38651f91..628fd85 100644
--- a/sw/source/uibase/inc/basesh.hxx
+++ b/sw/source/uibase/inc/basesh.hxx
@@ -33,6 +33,7 @@
 class SwWrtShell;
 class SwView;
 class SfxItemSet;
+class SwCrsrShell;
 
 struct DBTextStruct_Impl;
 class SwBaseShell: public SfxShell
@@ -49,7 +50,7 @@ class SwBaseShell: public SfxShell
     // Update-Timer for graphic
     std::set<sal_uInt16> aGrfUpdateSlots;
 
-    DECL_LINK( GraphicArrivedHdl, void* );
+    DECL_LINK_TYPED( GraphicArrivedHdl, SwCrsrShell&, void );
 
 protected:
     SwWrtShell&         GetShell();
@@ -57,7 +58,7 @@ protected:
 
     inline SwView&      GetView()                       { return rView; }
     inline void         SetGetStateSet( SfxItemSet* p ) { pGetStateSet = p; }
-    inline bool     AddGrfUpdateSlot( sal_uInt16 nSlot ){ return aGrfUpdateSlots.insert( nSlot ).second; }
+    inline bool         AddGrfUpdateSlot( sal_uInt16 nSlot ){ return aGrfUpdateSlots.insert( nSlot ).second; }
 
     DECL_LINK_TYPED(    InsertDBTextHdl, void*, void );
 
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 787c21d..0fa9678 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1218,7 +1218,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
 // Here the state fpr SID_IMAP / SID_CONTOUR will be handled
 // until the swapping of the graphic is finished.
 
-IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl)
+IMPL_LINK_NOARG_TYPED(SwBaseShell, GraphicArrivedHdl, SwCrsrShell&, void)
 {
     sal_uInt16 nGrfType;
     SwWrtShell &rSh = GetShell();
@@ -1310,7 +1310,6 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl)
         }
         aGrfUpdateSlots.clear();
     }
-    return 0;
 }
 
 void SwBaseShell::GetState( SfxItemSet &rSet )
@@ -1923,9 +1922,9 @@ SwBaseShell::~SwBaseShell()
     if( rView.GetCurShell() == this )
         rView.ResetSubShell();
 
-    Link<> aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
+    Link<SwCrsrShell&,void> aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
     if( aTmp == rView.GetWrtShell().GetGrfArrivedLnk() )
-        rView.GetWrtShell().SetGrfArrivedLnk( Link<>() );
+        rView.GetWrtShell().SetGrfArrivedLnk( Link<SwCrsrShell&,void>() );
 }
 
 void SwBaseShell::ExecTextCtrl( SfxRequest& rReq )
commit 8578168b6aa6ccd3d0fad494300766fce4b26dbc
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 17 16:47:56 2015 +0200

    convert Link<> to typed
    
    Change-Id: I2e49e9b18db6ee6ce0dcaea0a83e862384d5beaa

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 2d68c83..cf6d818 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -168,7 +168,7 @@ private:
 
     Link<const SwFlyFrameFormat*,void> m_aFlyMacroLnk;        /**< Link will be called, if the Crsr is set
                                    into a fly. A macro can then be called */
-    Link<> m_aChgLnk;             /**< link will be called by every attribute/
+    Link<SwCrsrShell*,void> m_aChgLnk;             /**< link will be called by every attribute/
                                    format changes at cursor position.*/
     Link<> m_aGrfArrivedLnk;      ///< Link calls to UI if a graphic is arrived
 
@@ -485,8 +485,8 @@ public:
     const Link<const SwFlyFrameFormat*,void>& GetFlyMacroLnk() const           { return m_aFlyMacroLnk; }
 
     // Methods returning/altering link for changes of attributes/formates.
-    void        SetChgLnk( const Link<> &rLnk ) { m_aChgLnk = rLnk; }
-    const Link<>& GetChgLnk() const           { return m_aChgLnk; }
+    void        SetChgLnk( const Link<SwCrsrShell*,void> &rLnk ) { m_aChgLnk = rLnk; }
+    const Link<SwCrsrShell*,void>& GetChgLnk() const           { return m_aChgLnk; }
 
     // Methods returning/altering ling for "graphic completely loaded".
     void        SetGrfArrivedLnk( const Link<> &rLnk ) { m_aGrfArrivedLnk = rLnk; }
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 5fb0f34..a718591 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -78,6 +78,7 @@ class Graphic;
 class GraphicFilter;
 class SwPostItMgr;
 enum class SotExchangeDest;
+class SwCrsrShell;
 
 namespace com{ namespace sun { namespace star {
     namespace view{ class XSelectionSupplier; }
@@ -541,7 +542,7 @@ public:
     void            StateTabWin(SfxItemSet&);
 
     // attributes have changed
-    DECL_LINK( AttrChangedNotify, void* );
+    DECL_LINK_TYPED( AttrChangedNotify, SwCrsrShell*, void );
 
     // form control has been activated
     DECL_LINK_TYPED( FormControlActivated, LinkParamNone*, void );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 21e2c6a..21aa11f 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1693,8 +1693,8 @@ bool SwTransferable::_PasteFileContent( TransferableDataHelper& rData,
 
     if( pStream && pRead )
     {
-        Link<> aOldLink( rSh.GetChgLnk() );
-        rSh.SetChgLnk( Link<>() );
+        Link<SwCrsrShell*,void> aOldLink( rSh.GetChgLnk() );
+        rSh.SetChgLnk( Link<SwCrsrShell*,void>() );
 
         const SwPosition& rInsPos = *rSh.GetCrsr()->Start();
         SwReader aReader( *pStream, aEmptyOUStr, OUString(), *rSh.GetCrsr() );
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 812f188..717212f 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -464,7 +464,7 @@ extern "C"
     }
 }
 
-IMPL_LINK_NOARG(SwView, AttrChangedNotify)
+IMPL_LINK_NOARG_TYPED(SwView, AttrChangedNotify, SwCrsrShell*, void)
 {
      if ( GetEditWin().IsChainMode() )
         GetEditWin().SetChainMode( false );
@@ -508,8 +508,6 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify)
         // actual cursor position is a post-it field
         m_pPostItMgr->SetShadowState( m_pWrtShell->GetPostItFieldAtCursor() );
     }
-
-    return 0;
 }
 
 IMPL_LINK_NOARG_TYPED(SwView, TimeoutHdl, Timer *, void)
commit f8fa762026f0767b98284d8af08ab6e9814c9f0a
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 17 16:13:33 2015 +0200

    convert Link<> to typed
    
    Change-Id: I706a3b3489dc8e945ce9e7e7ddc41104e9a15bab

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 93ed941..2d68c83 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -166,7 +166,7 @@ private:
     Point   m_aOldRBPos;          ///< Right/Bottom of last VisArea
                                 // (used in Invalidate by Cursor)
 
-    Link<> m_aFlyMacroLnk;        /**< Link will be called, if the Crsr is set
+    Link<const SwFlyFrameFormat*,void> m_aFlyMacroLnk;        /**< Link will be called, if the Crsr is set
                                    into a fly. A macro can then be called */
     Link<> m_aChgLnk;             /**< link will be called by every attribute/
                                    format changes at cursor position.*/
@@ -481,8 +481,8 @@ public:
     bool IsOverReadOnlyPos( const Point& rPt ) const;
 
     // Methods for aFlyMacroLnk.
-    void        SetFlyMacroLnk( const Link<>& rLnk ) { m_aFlyMacroLnk = rLnk; }
-    const Link<>& GetFlyMacroLnk() const           { return m_aFlyMacroLnk; }
+    void        SetFlyMacroLnk( const Link<const SwFlyFrameFormat*,void>& rLnk ) { m_aFlyMacroLnk = rLnk; }
+    const Link<const SwFlyFrameFormat*,void>& GetFlyMacroLnk() const           { return m_aFlyMacroLnk; }
 
     // Methods returning/altering link for changes of attributes/formates.
     void        SetChgLnk( const Link<> &rLnk ) { m_aChgLnk = rLnk; }
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 9daa0fe..3833c26 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -225,7 +225,7 @@ SwCallLink::~SwCallLink()
 
         if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode ||
             nNode > rStNd.EndOfSectionIndex() )
-            rShell.GetFlyMacroLnk().Call( const_cast<SwFlyFrameFormat *>(pFlyFrm->GetFormat()) );
+            rShell.GetFlyMacroLnk().Call( pFlyFrm->GetFormat() );
     }
 }
 
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 473f686..3cca758 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -111,7 +111,7 @@ static void lcl_GrabCursor( SwFEShell* pSh, SwFlyFrm* pOldSelFly)
                         (!pOldSelFly || pOldSelFly->GetFormat() != pFlyFormat) )
     {
         // now call set macro if applicable
-        pSh->GetFlyMacroLnk().Call( const_cast<void*>(static_cast<void const *>(pFlyFormat)) );
+        pSh->GetFlyMacroLnk().Call( static_cast<const SwFlyFrameFormat*>(pFlyFormat) );
 extern bool g_bNoInterrupt;       // in swmodule.cxx
         // if a dialog was started inside a macro, then
         // MouseButtonUp arrives at macro and not to us. Therefore
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index f965c87..db852bc 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -244,7 +244,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)();
     bool    GotoPage( sal_uInt16 nPage, bool bRecord );
 
     // setting the cursor; remember the old position for turning back
-    DECL_LINK( ExecFlyMac, void * );
+    DECL_LINK_TYPED( ExecFlyMac, const SwFlyFrameFormat*, void );
 
     bool    PageCrsr(SwTwips lOffset, bool bSelect);
 
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index ccd7fec..d530b55 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -705,9 +705,9 @@ void SwWrtShell::LeaveSelFrmMode()
 
 // Description: execute framebound macro
 
-IMPL_LINK( SwWrtShell, ExecFlyMac, void *, pFlyFormat )
+IMPL_LINK_TYPED( SwWrtShell, ExecFlyMac, const SwFlyFrameFormat*, pFlyFormat, void )
 {
-    const SwFrameFormat *pFormat = pFlyFormat ? static_cast<SwFrameFormat*>(pFlyFormat) : GetFlyFrameFormat();
+    const SwFrameFormat *pFormat = pFlyFormat ? static_cast<const SwFrameFormat*>(pFlyFormat) : GetFlyFrameFormat();
     OSL_ENSURE(pFormat, "no frame format");
     const SvxMacroItem &rFormatMac = pFormat->GetMacro();
 
@@ -719,7 +719,6 @@ IMPL_LINK( SwWrtShell, ExecFlyMac, void *, pFlyFormat )
         CallChgLnk();
         ExecMacro( rMac );
     }
-    return 0;
 }
 
 long SwWrtShell::UpdateLayoutFrm(const Point *pPt, bool )


More information about the Libreoffice-commits mailing list