[Libreoffice-commits] core.git: cui/source desktop/source include/svtools include/vcl svtools/source vcl/source

Noel Grandin noel at peralex.com
Fri Oct 16 03:36:22 PDT 2015


 cui/source/dialogs/SpellDialog.cxx                    |    8 +++-----
 cui/source/inc/SpellDialog.hxx                        |    2 +-
 cui/source/inc/optlingu.hxx                           |   12 ++++++------
 cui/source/options/optlingu.cxx                       |    6 ++----
 desktop/source/deployment/gui/dp_gui_dialog2.cxx      |   12 ++++--------
 desktop/source/deployment/gui/dp_gui_dialog2.hxx      |    4 ++--
 desktop/source/deployment/gui/dp_gui_extlistbox.hxx   |    4 ++--
 desktop/source/deployment/gui/dp_gui_updatedialog.cxx |   12 ++++--------
 desktop/source/deployment/gui/dp_gui_updatedialog.hxx |    2 +-
 include/svtools/breadcrumb.hxx                        |    2 +-
 include/vcl/fixedhyper.hxx                            |   10 +++++-----
 svtools/source/control/breadcrumb.cxx                 |    6 ++----
 vcl/source/control/fixedhyper.cxx                     |    4 ++--
 13 files changed, 35 insertions(+), 49 deletions(-)

New commits:
commit 8d44385bf64c1ea9bdb9100fc7ed005ac7071968
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Oct 16 12:35:30 2015 +0200

    convert Link<> to typed
    
    Change-Id: I48893ac7130ad671864faa5eb55409b21cdda77e

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index c263b7e..9134302 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -2016,13 +2016,13 @@ void  SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
     pSpellDialog->m_pChangePB->Enable();
 }
 
-IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
+IMPL_LINK_TYPED( SpellDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
 {
-    OUString sURL=pHyperlink->GetURL();
+    OUString sURL=rHyperlink.GetURL();
     OUString sTitle=GetText();
 
     if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty
-        return 1;
+        return;
     try
     {
         uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
@@ -2038,8 +2038,6 @@ IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
         aErrorBox->SetText(sTitle);
         aErrorBox->Execute();
     }
-
-    return 1;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 40497fb..449271d 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -185,7 +185,7 @@ private:
     DECL_LINK_TYPED( AddToDictClickHdl, Button*, void );
     DECL_LINK_TYPED( LanguageSelectHdl, ListBox&, void );
     DECL_LINK_TYPED( DialogUndoHdl, SpellUndoAction_Impl&, void );
-    DECL_LINK( HandleHyperlink, FixedHyperlink * );
+    DECL_LINK_TYPED( HandleHyperlink, FixedHyperlink&, void );
 
     DECL_LINK_TYPED( InitHdl, void*, void );
 
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 3653b92..dd0730f 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -74,14 +74,14 @@ class SvxEditModulesDlg : public ModalDialog
 
     SvTreeListEntry*    CreateEntry(OUString& rTxt, sal_uInt16 nCol);
 
-    DECL_LINK_TYPED(SelectHdl_Impl, SvTreeListBox*, void);
-    DECL_LINK_TYPED(UpDownHdl_Impl, Button*, void);
-    DECL_LINK_TYPED(ClickHdl_Impl, Button*, void);
-    DECL_LINK_TYPED(BackHdl_Impl, Button*, void);
+    DECL_LINK_TYPED( SelectHdl_Impl, SvTreeListBox*, void );
+    DECL_LINK_TYPED( UpDownHdl_Impl, Button*, void );
+    DECL_LINK_TYPED( ClickHdl_Impl, Button*, void );
+    DECL_LINK_TYPED( BackHdl_Impl, Button*, void );
     DECL_LINK_TYPED( LangSelectListBoxHdl_Impl, ListBox&, void );
     DECL_LINK_TYPED( BoxCheckButtonHdl_Impl2, SvLBoxButtonData*, void );
     DECL_LINK_TYPED( BoxCheckButtonHdl_Impl, SvTreeListBox*, void );
-    DECL_LINK(OpenURLHdl_Impl, void *);
+    DECL_LINK_TYPED( OpenURLHdl_Impl, FixedHyperlink&, void );
     void LangSelectHdl_Impl(ListBox*);
 
 public:
@@ -143,7 +143,7 @@ private:
     DECL_LINK_TYPED( BoxDoubleClickHdl_Impl, SvTreeListBox*, bool );
     DECL_LINK_TYPED( BoxCheckButtonHdl_Impl, SvTreeListBox*, void );
     DECL_LINK_TYPED( PostDblClickHdl_Impl, void *, void);
-    DECL_LINK( OpenURLHdl_Impl, void *);
+    DECL_LINK_TYPED( OpenURLHdl_Impl, FixedHyperlink&, void );
 
     void                UpdateModulesBox_Impl();
     void                UpdateDicBox_Impl();
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 4010e37..41c1422 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1540,11 +1540,10 @@ IMPL_LINK_NOARG_TYPED(SvxLinguTabPage, PostDblClickHdl_Impl, void*, void)
 
 
 
-IMPL_LINK_NOARG(SvxLinguTabPage, OpenURLHdl_Impl)
+IMPL_LINK_NOARG_TYPED(SvxLinguTabPage, OpenURLHdl_Impl, FixedHyperlink&, void)
 {
     OUString sURL( m_pMoreDictsLink->GetURL() );
     lcl_OpenURL( sURL );
-    return 0;
 }
 
 
@@ -2312,11 +2311,10 @@ IMPL_LINK_NOARG_TYPED(SvxEditModulesDlg, BackHdl_Impl, Button*, void)
 
 
 
-IMPL_LINK_NOARG(SvxEditModulesDlg, OpenURLHdl_Impl)
+IMPL_LINK_NOARG_TYPED(SvxEditModulesDlg, OpenURLHdl_Impl, FixedHyperlink&, void)
 {
     OUString sURL( m_pMoreDictsLink->GetURL() );
     lcl_OpenURL( sURL );
-    return 0;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index c8c3954..a1c3107 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -1072,11 +1072,9 @@ IMPL_LINK_NOARG_TYPED(ExtMgrDialog, HandleUpdateBtn, Button*, void)
 }
 
 
-IMPL_LINK( ExtMgrDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
+IMPL_LINK_TYPED( ExtMgrDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
 {
-    openWebBrowser( pHyperlink->GetURL(), GetText() );
-
-    return 1;
+    openWebBrowser( rHyperlink.GetURL(), GetText() );
 }
 
 
@@ -1404,11 +1402,9 @@ IMPL_LINK_NOARG_TYPED(UpdateRequiredDialog, HandleCloseBtn, Button*, void)
 }
 
 
-IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, FixedHyperlink*, pHyperlink )
+IMPL_LINK_TYPED( UpdateRequiredDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
 {
-    openWebBrowser( pHyperlink->GetURL(), GetText() );
-
-    return 1;
+    openWebBrowser( rHyperlink.GetURL(), GetText() );
 }
 
 
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 1038f09..f5bf065 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -136,7 +136,7 @@ class ExtMgrDialog : public ModelessDialog,
     DECL_DLLPRIVATE_LINK_TYPED( HandleCancelBtn, Button*, void );
     DECL_DLLPRIVATE_LINK_TYPED( HandleCloseBtn, Button*, void );
     DECL_DLLPRIVATE_LINK_TYPED( HandleExtTypeCbx, Button*, void );
-    DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * );
+    DECL_DLLPRIVATE_LINK_TYPED( HandleHyperlink, FixedHyperlink&, void );
     DECL_DLLPRIVATE_LINK_TYPED(TimeOutHdl, Idle *, void);
     DECL_DLLPRIVATE_LINK_TYPED( startProgress, void *, void );
 
@@ -202,7 +202,7 @@ class UpdateRequiredDialog : public ModalDialog,
     DECL_DLLPRIVATE_LINK_TYPED( HandleCancelBtn, Button*, void );
     DECL_DLLPRIVATE_LINK_TYPED(TimeOutHdl, Idle *, void);
     DECL_DLLPRIVATE_LINK_TYPED( startProgress, void *, void );
-    DECL_DLLPRIVATE_LINK( HandleHyperlink, FixedHyperlink * );
+    DECL_DLLPRIVATE_LINK_TYPED( HandleHyperlink, FixedHyperlink&, void );
 
     static bool     isEnabled( const css::uno::Reference< css::deployment::XPackage > &xPackage );
     static bool     checkDependencies( const css::uno::Reference< css::deployment::XPackage > &xPackage );
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 1a58a17..b6db335 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -126,7 +126,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
     Image m_aWarningImage;
     Image m_aDefaultImage;
 
-    Link<> m_aClickHdl;
+    Link<FixedHyperlink&,void> m_aClickHdl;
 
     VclPtr<ScrollBar>      m_pScrollBar;
 
@@ -190,7 +190,7 @@ public:
     long            PointToPos( const Point& rPos );
     void            SetScrollHdl( const Link<ScrollBar*,void>& rLink );
     void            DoScroll( long nDelta );
-    void            SetHyperlinkHdl( const Link<>& rLink ){ m_aClickHdl = rLink; }
+    void            SetHyperlinkHdl( const Link<FixedHyperlink&,void>& rLink ){ m_aClickHdl = rLink; }
     virtual void    RecalcAll();
     void            RemoveUnlocked();
 
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 7b6133c..3cc0935 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -922,7 +922,7 @@ void UpdateDialog::initDescription()
     m_pReleaseNotesLabel->Hide();
     m_pReleaseNotesLink->Hide();
 
-    Link<> aLink = LINK( this, UpdateDialog, hyperlink_clicked );
+    Link<FixedHyperlink&,void> aLink = LINK( this, UpdateDialog, hyperlink_clicked );
     m_pPublisherLink->SetClickHdl( aLink );
     m_pReleaseNotesLink->SetClickHdl( aLink );
 }
@@ -1319,13 +1319,11 @@ IMPL_LINK_NOARG_TYPED(UpdateDialog, closeHandler, Button*, void)
     EndDialog();
 }
 
-IMPL_LINK( UpdateDialog, hyperlink_clicked, FixedHyperlink*, pHyperlink )
+IMPL_LINK_TYPED( UpdateDialog, hyperlink_clicked, FixedHyperlink&, rHyperlink, void )
 {
-    OUString sURL;
-    if ( pHyperlink )
-        sURL = OUString( pHyperlink->GetURL() );
+    OUString sURL = rHyperlink.GetURL();
     if ( sURL.isEmpty() )
-        return 0;
+        return;
 
     try
     {
@@ -1337,8 +1335,6 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, FixedHyperlink*, pHyperlink )
     catch ( const uno::Exception& )
     {
     }
-
-    return 1;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index fc1ab43..ce0c639 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -163,7 +163,7 @@ private:
     DECL_LINK_TYPED(allHandler, CheckBox&, void);
     DECL_LINK_TYPED(okHandler, Button*, void);
     DECL_LINK_TYPED(closeHandler, Button*, void);
-    DECL_LINK(hyperlink_clicked, FixedHyperlink *);
+    DECL_LINK_TYPED(hyperlink_clicked, FixedHyperlink&, void);
 
     css::uno::Reference< css::uno::XComponentContext >  m_context;
     VclPtr<FixedText> m_pchecking;
diff --git a/include/svtools/breadcrumb.hxx b/include/svtools/breadcrumb.hxx
index c57c0e3..e87ab68 100644
--- a/include/svtools/breadcrumb.hxx
+++ b/include/svtools/breadcrumb.hxx
@@ -46,7 +46,7 @@ class SVT_DLLPUBLIC Breadcrumb : public VclHBox
         void appendField();
         bool showField( unsigned int nIndex, unsigned int nWidthMax );
 
-        DECL_LINK ( ClickLinkHdl, FixedHyperlink* );
+        DECL_LINK_TYPED( ClickLinkHdl, FixedHyperlink&, void );
 
     public:
         Breadcrumb( vcl::Window* pParent, WinBits nWinStyle = 0 );
diff --git a/include/vcl/fixedhyper.hxx b/include/vcl/fixedhyper.hxx
index 98d4de7..b266f74 100644
--- a/include/vcl/fixedhyper.hxx
+++ b/include/vcl/fixedhyper.hxx
@@ -28,7 +28,7 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText
     private:
         long                m_nTextLen;
         Pointer             m_aOldPointer;
-        Link<>              m_aClickHdl;
+        Link<FixedHyperlink&,void> m_aClickHdl;
         OUString            m_sURL;
 
         /** initializes the font (link color and underline).
@@ -91,22 +91,22 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText
 
             m_aClickHdl is called if the text is clicked.
         */
-        inline void         SetClickHdl( const Link<>& rLink ) { m_aClickHdl = rLink; }
+        inline void         SetClickHdl( const Link<FixedHyperlink&,void>& rLink ) { m_aClickHdl = rLink; }
 
         // ::FixedHyperbaseLink
 
         /** sets the URL of the hyperlink and uses it as tooltip. */
-        void        SetURL(const OUString& rNewURL);
+        void                SetURL(const OUString& rNewURL);
 
         /** returns the URL of the hyperlink.
 
             @return
                 m_sURL
         */
-        const OUString&    GetURL() const { return m_sURL;}
+        const OUString&     GetURL() const { return m_sURL;}
 
         /** sets new text and recalculates the text length. */
-        virtual void SetText(const OUString& rNewDescription) override;
+        virtual void        SetText(const OUString& rNewDescription) override;
     };
 
 #endif
diff --git a/svtools/source/control/breadcrumb.cxx b/svtools/source/control/breadcrumb.cxx
index 9c83511..15be194 100644
--- a/svtools/source/control/breadcrumb.cxx
+++ b/svtools/source/control/breadcrumb.cxx
@@ -273,12 +273,10 @@ bool Breadcrumb::showField( unsigned int nIndex, unsigned int nWidthMax )
     return true;
 }
 
-IMPL_LINK ( Breadcrumb, ClickLinkHdl, FixedHyperlink*, pLink )
+IMPL_LINK_TYPED( Breadcrumb, ClickLinkHdl, FixedHyperlink&, rLink, void )
 {
-    m_sClickedURL = pLink->GetURL();
+    m_sClickedURL = rLink.GetURL();
     m_aClickHdl.Call( this );
-
-    return 1;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index b7a2759..a4ec5e7 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -77,7 +77,7 @@ void FixedHyperlink::MouseButtonUp( const MouseEvent& )
 {
     // calls the link if the control is enabled and the mouse is over the text.
     if ( IsEnabled() && ImplIsOverText(GetPointerPosPixel()) )
-        ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, [this] () { m_aClickHdl.Call(this); } );
+        ImplCallEventListenersAndHandler( VCLEVENT_BUTTON_CLICK, [this] () { m_aClickHdl.Call(*this); } );
 }
 
 void FixedHyperlink::RequestHelp( const HelpEvent& rHEvt )
@@ -106,7 +106,7 @@ void FixedHyperlink::KeyInput( const KeyEvent& rKEvt )
     {
         case KEY_SPACE:
         case KEY_RETURN:
-            m_aClickHdl.Call( this );
+            m_aClickHdl.Call( *this );
             break;
 
         default:


More information about the Libreoffice-commits mailing list