[Libreoffice-commits] core.git: 7 commits - compilerplugins/clang cui/source include/tools include/vcl sd/source sfx2/source svx/source sw/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Thu Apr 30 07:59:34 PDT 2015


 compilerplugins/clang/vclwidgets.cxx              |   33 ++++++++++++----------
 cui/source/customize/cfg.cxx                      |   18 +++---------
 cui/source/dialogs/SpellDialog.cxx                |    4 +-
 cui/source/inc/SpellDialog.hxx                    |    2 -
 cui/source/inc/cfg.hxx                            |    8 ++---
 cui/source/inc/cuitabline.hxx                     |    2 -
 cui/source/inc/numpages.hxx                       |    2 -
 cui/source/tabpages/numpages.cxx                  |    3 --
 cui/source/tabpages/tpline.cxx                    |    3 --
 include/tools/link.hxx                            |   22 ++++++--------
 include/vcl/menubtn.hxx                           |    5 +--
 sd/source/ui/animations/CustomAnimationDialog.cxx |   33 ++++++++--------------
 sfx2/source/appl/appmain.cxx                      |    2 -
 sfx2/source/dialog/backingwindow.cxx              |    4 --
 sfx2/source/dialog/backingwindow.hxx              |    2 -
 svx/source/form/datanavi.cxx                      |   15 ++++------
 svx/source/inc/datanavi.hxx                       |    2 -
 sw/source/ui/envelp/envfmt.cxx                    |    9 ++----
 sw/source/ui/envelp/envfmt.hxx                    |    2 -
 sw/source/ui/misc/glossary.cxx                    |    3 --
 sw/source/uibase/inc/glossary.hxx                 |    2 -
 vcl/unx/generic/app/i18n_status.cxx               |    5 +--
 22 files changed, 78 insertions(+), 103 deletions(-)

New commits:
commit 4d28399ccdeeb43655aba89f14c58b26d379c780
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 16:58:33 2015 +0200

    Use typed Link for MenuButton::SetSelectHdl
    
    (and MenuButton::GetSelectHdl was unused)
    
    Change-Id: I94df06bcda9e041fde65553e30247874b20ff74b

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 96ed1ac..ac1a8b4 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2428,7 +2428,7 @@ IMPL_LINK( SvxMenuConfigPage, SelectMenu, ListBox *, pBox )
     return 0;
 }
 
-IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton, void )
 {
     OString sIdent = pButton->GetCurItemIdent();
 
@@ -2473,12 +2473,9 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton )
             GetSaveInData()->SetModified( true );
         }
     }
-    else
-        return sal_False;
-    return sal_True;
 }
 
-IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
 {
     OString sIdent = pButton->GetCurItemIdent();
     if (sIdent == "addsubmenu")
@@ -2538,15 +2535,13 @@ IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton )
     }
     else
     {
-        return sal_False;
+        return;
     }
 
     if ( GetSaveInData()->IsModified() )
     {
         UpdateButtonStates();
     }
-
-    return sal_True;
 }
 
 IMPL_LINK( SvxMenuConfigPage, AddFunctionHdl,
@@ -3080,7 +3075,7 @@ void SvxToolbarConfigPage::MoveEntry( bool bMoveUp )
     }
 }
 
-IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton, void )
 {
     sal_uInt16 nSelectionPos = m_pTopLevelListBox->GetSelectEntryPos();
 
@@ -3167,10 +3162,9 @@ IMPL_LINK( SvxToolbarConfigPage, ToolbarSelectHdl, MenuButton *, pButton )
             break;
         }
     }
-    return 1;
 }
 
-IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, void )
 {
     bool bNeedsApply = false;
 
@@ -3444,8 +3438,6 @@ IMPL_LINK( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton )
         static_cast<ToolbarSaveInData*>( GetSaveInData())->ApplyToolbar( pToolbar );
         UpdateButtonStates();
     }
-
-    return 1;
 }
 
 void SvxToolbarConfigPage::Init()
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 9f3e149..c1238be 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -916,9 +916,9 @@ IMPL_LINK(SpellDialog, AddToDictClickHdl, PushButton*, EMPTYARG )
 }
 
 
-IMPL_LINK(SpellDialog, AddToDictSelectHdl, MenuButton*, pButton )
+IMPL_LINK_TYPED(SpellDialog, AddToDictSelectHdl, MenuButton*, pButton, void )
 {
-    return AddToDictionaryExecute(pButton->GetCurItemId(), pButton->GetPopupMenu());
+    AddToDictionaryExecute(pButton->GetCurItemId(), pButton->GetPopupMenu());
 }
 
 
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 6f8b316..9e6d219 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -180,7 +180,7 @@ private:
     DECL_LINK(CancelHdl, void *);
     DECL_LINK( ModifyHdl, SentenceEditWindow_Impl *);
     DECL_LINK(UndoHdl, void *);
-    DECL_LINK( AddToDictSelectHdl, MenuButton* );
+    DECL_LINK_TYPED( AddToDictSelectHdl, MenuButton*, void );
     DECL_LINK( AddToDictClickHdl, PushButton* );
     DECL_LINK( LanguageSelectHdl, SvxLanguageBox* );
     DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl* );
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 3038b4b..fc52ab8 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -473,8 +473,8 @@ private:
     DECL_LINK( SelectMenu, ListBox * );
     DECL_LINK( SelectMenuEntry, Control * );
     DECL_LINK( NewMenuHdl, Button * );
-    DECL_LINK( MenuSelectHdl, MenuButton * );
-    DECL_LINK( EntrySelectHdl, MenuButton * );
+    DECL_LINK_TYPED( MenuSelectHdl, MenuButton *, void );
+    DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void );
     DECL_LINK( AddCommandsHdl, Button * );
     DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
 
@@ -574,8 +574,8 @@ private:
 
     DECL_LINK( SelectToolbar, ListBox * );
     DECL_LINK( SelectToolbarEntry, Control * );
-    DECL_LINK( ToolbarSelectHdl, MenuButton * );
-    DECL_LINK( EntrySelectHdl, MenuButton * );
+    DECL_LINK_TYPED( ToolbarSelectHdl, MenuButton *, void );
+    DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void );
     DECL_LINK( NewToolbarHdl, Button * );
     DECL_LINK( AddCommandsHdl, Button * );
     DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog * );
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index a55dd13..6c4143c 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -176,7 +176,7 @@ private:
     sal_Int32           nActLineWidth;
 
     // handler for gallery popup menu button + size
-    DECL_LINK( GraphicHdl_Impl, MenuButton * );
+    DECL_LINK_TYPED( GraphicHdl_Impl, MenuButton *, void );
     DECL_LINK( MenuCreateHdl_Impl, MenuButton * );
     DECL_STATIC_LINK( SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem* );
     DECL_LINK( SizeHdl_Impl, MetricField * );
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx
index 3fe577a..625da38 100644
--- a/cui/source/inc/numpages.hxx
+++ b/cui/source/inc/numpages.hxx
@@ -330,7 +330,7 @@ class SvxNumOptionsTabPage : public SfxTabPage
         DECL_LINK( NumberTypeSelectHdl_Impl, ListBox * );
         DECL_LINK( LevelHdl_Impl, ListBox * );
         DECL_LINK(PopupActivateHdl_Impl, void *);
-        DECL_LINK( GraphicHdl_Impl, MenuButton * );
+        DECL_LINK_TYPED( GraphicHdl_Impl, MenuButton *, void );
         DECL_LINK(BulletHdl_Impl, void *);
         DECL_LINK( SizeHdl_Impl, MetricField * );
         DECL_LINK( RatioHdl_Impl, CheckBox * );
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index c638187..797a37d 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1959,7 +1959,7 @@ IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField)
     return 0;
 }
 
-IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton, void )
 {
     sal_uInt16                  nItemId = pButton->GetCurItemId();
     OUString                aGrfName;
@@ -2035,7 +2035,6 @@ IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
         //needed due to asynchronous loading of graphics in the SvxBrushItem
         aInvalidateTimer.Start();
     }
-    return 0;
 }
 
 IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl)
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index 184d428..25dfd8c 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -1777,10 +1777,9 @@ IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
 
 // #58425# Symbols on a list (e.g. StarChart)
 // Handler for menu button
-IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton, void )
 {
     SymbolSelected(pButton);
-    return 0;
 }
 
 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index ffeaa19..035e1fc 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -42,7 +42,7 @@ private:
     sal_uInt16      mnCurItemId;
     sal_uInt16      mnMenuMode;
     Link<>          maActivateHdl;
-    Link<>          maSelectHdl;
+    Link<MenuButton *, void> maSelectHdl;
 
     SAL_DLLPRIVATE void    ImplInitMenuButtonData();
     DECL_DLLPRIVATE_LINK(  ImplMenuTimeoutHdl, void* );
@@ -79,8 +79,7 @@ public:
 
     void            SetActivateHdl( const Link<>& rLink ) { maActivateHdl = rLink; }
     const Link<>&   GetActivateHdl() const              { return maActivateHdl; }
-    void            SetSelectHdl( const Link<>& rLink ) { maSelectHdl = rLink; }
-    const Link<>&   GetSelectHdl() const                { return maSelectHdl; }
+    void            SetSelectHdl( const Link<MenuButton *, void>& rLink ) { maSelectHdl = rLink; }
 };
 
 #endif // INCLUDED_VCL_MENUBTN_HXX
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 0e06814..e9c8dad 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -327,7 +327,7 @@ public:
     void Resize() SAL_OVERRIDE;
     bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
 
-    void SetMenuSelectHdl( const Link<>& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); }
+    void SetMenuSelectHdl( const Link<MenuButton *, void>& rLink ) { mpDropdownButton->SetSelectHdl( rLink ); }
 
 private:
     VclPtr<Edit> mpSubControl;
@@ -409,7 +409,7 @@ public:
 
     virtual Control* getControl() SAL_OVERRIDE;
 
-    DECL_LINK( implMenuSelectHdl, MenuButton* );
+    DECL_LINK_TYPED( implMenuSelectHdl, MenuButton*, void );
 
 private:
     VclPtr<DropdownMenuBox> mpControl;
@@ -440,7 +440,7 @@ CharHeightPropertyBox::~CharHeightPropertyBox()
     mpControl.disposeAndClear();
 }
 
-IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+IMPL_LINK_TYPED( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 {
     long nValue = 100;
     switch( pPb->GetCurItemId() )
@@ -452,7 +452,6 @@ IMPL_LINK( CharHeightPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
     }
     mpMetric->SetValue( nValue );
     mpMetric->Modify();
-    return 0;
 }
 
 void CharHeightPropertyBox::setValue( const Any& rValue, const OUString& )
@@ -486,7 +485,7 @@ public:
 
     virtual Control* getControl() SAL_OVERRIDE;
 
-    DECL_LINK( implMenuSelectHdl, MenuButton* );
+    DECL_LINK_TYPED( implMenuSelectHdl, MenuButton*, void );
     DECL_LINK(implModifyHdl, void *);
 
     void updateMenu();
@@ -546,15 +545,13 @@ IMPL_LINK_NOARG(TransparencyPropertyBox, implModifyHdl)
     return 0;
 }
 
-IMPL_LINK( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+IMPL_LINK_TYPED( TransparencyPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 {
     if( pPb->GetCurItemId() != mpMetric->GetValue() )
     {
         mpMetric->SetValue( pPb->GetCurItemId() );
         mpMetric->Modify();
     }
-
-    return 0;
 }
 
 void TransparencyPropertyBox::setValue( const Any& rValue, const OUString& )
@@ -590,7 +587,7 @@ public:
 
     virtual Control* getControl() SAL_OVERRIDE;
 
-    DECL_LINK( implMenuSelectHdl, MenuButton* );
+    DECL_LINK_TYPED( implMenuSelectHdl, MenuButton*, void );
     DECL_LINK(implModifyHdl, void *);
 
     void updateMenu();
@@ -652,7 +649,7 @@ IMPL_LINK_NOARG(RotationPropertyBox, implModifyHdl)
     return 0;
 }
 
-IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+IMPL_LINK_TYPED( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 {
     sal_Int64 nValue = mpMetric->GetValue();
     bool bDirection = nValue >= 0;
@@ -678,8 +675,6 @@ IMPL_LINK( RotationPropertyBox, implMenuSelectHdl, MenuButton*, pPb )
         mpMetric->SetValue( nValue );
         mpMetric->Modify();
     }
-
-    return 0;
 }
 
 void RotationPropertyBox::setValue( const Any& rValue, const OUString& )
@@ -715,7 +710,7 @@ public:
 
     virtual Control* getControl() SAL_OVERRIDE;
 
-    DECL_LINK( implMenuSelectHdl, MenuButton* );
+    DECL_LINK_TYPED( implMenuSelectHdl, MenuButton*, void );
     DECL_LINK(implModifyHdl, void *);
 
     void updateMenu();
@@ -776,7 +771,7 @@ IMPL_LINK_NOARG(ScalePropertyBox, implModifyHdl)
     return 0;
 }
 
-IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+IMPL_LINK_TYPED( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 {
     sal_Int64 nValue = mpMetric->GetValue();
 
@@ -811,8 +806,6 @@ IMPL_LINK( ScalePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
         mpMetric->Modify();
         updateMenu();
     }
-
-    return 0;
 }
 
 void ScalePropertyBox::setValue( const Any& rValue, const OUString& )
@@ -878,7 +871,7 @@ public:
 
     virtual Control* getControl() SAL_OVERRIDE;
 
-    DECL_LINK( implMenuSelectHdl, MenuButton* );
+    DECL_LINK_TYPED( implMenuSelectHdl, MenuButton*, void );
 
     void update();
 
@@ -930,7 +923,7 @@ void FontStylePropertyBox::update()
     mpEdit->Invalidate();
 }
 
-IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
+IMPL_LINK_TYPED( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb, void )
 {
     switch( pPb->GetCurItemId() )
     {
@@ -953,13 +946,11 @@ IMPL_LINK( FontStylePropertyBox, implMenuSelectHdl, MenuButton*, pPb )
             mnFontUnderline = awt::FontUnderline::SINGLE;
         break;
     default:
-        return 0;
+        return;
     }
 
     update();
     maModifyHdl.Call(mpEdit.get());
-
-    return 0;
 }
 
 void FontStylePropertyBox::setValue( const Any& rValue, const OUString& )
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 6c5206d..a83884d 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -598,7 +598,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
     return 0;
 }
 
-IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
+IMPL_LINK_TYPED( BackingWindow, MenuSelectHdl, MenuButton*, pButton, void )
 {
     initializeLocalView();
 
@@ -637,8 +637,6 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton )
     mpLocalView->Show();
     mpLocalView->reload();
     mpLocalView->GrabFocus();
-
-    return 0;
 }
 
 
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 7df6552..d45595d 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -113,7 +113,7 @@ class BackingWindow
     std::set<const ThumbnailViewItem*,selection_cmp_fn> maSelFolders;
 
     DECL_LINK(ClickHdl, Button*);
-    DECL_LINK(MenuSelectHdl, MenuButton*);
+    DECL_LINK_TYPED(MenuSelectHdl, MenuButton*, void);
     DECL_LINK(ExtLinkClickHdl, Button*);
     DECL_LINK(OpenRegionHdl, void*);
     DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index a92cca0..9799222 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -1375,12 +1375,12 @@ namespace svxform
 
         // handler
         m_pModelsBox->SetSelectHdl( LINK( this, DataNavigatorWindow, ModelSelectHdl ) );
-        Link<> aLink = LINK( this, DataNavigatorWindow, MenuSelectHdl );
-        m_pModelBtn->SetSelectHdl( aLink );
-        m_pInstanceBtn->SetSelectHdl( aLink );
-        aLink = LINK( this, DataNavigatorWindow, MenuActivateHdl );
-        m_pModelBtn->SetActivateHdl( aLink );
-        m_pInstanceBtn->SetActivateHdl( aLink );
+        Link<MenuButton *, void> aLink1 = LINK( this, DataNavigatorWindow, MenuSelectHdl );
+        m_pModelBtn->SetSelectHdl( aLink1 );
+        m_pInstanceBtn->SetSelectHdl( aLink1 );
+        Link<> aLink2 = LINK( this, DataNavigatorWindow, MenuActivateHdl );
+        m_pModelBtn->SetActivateHdl( aLink2 );
+        m_pInstanceBtn->SetActivateHdl( aLink2 );
         m_pTabCtrl->SetActivatePageHdl( LINK( this, DataNavigatorWindow, ActivatePageHdl ) );
         m_aUpdateTimer.SetTimeout( 2000 );
         m_aUpdateTimer.SetTimeoutHdl( LINK( this, DataNavigatorWindow, UpdateHdl ) );
@@ -1470,7 +1470,7 @@ namespace svxform
         return 0;
     }
 
-    IMPL_LINK( DataNavigatorWindow, MenuSelectHdl, MenuButton *, pBtn )
+    IMPL_LINK_TYPED( DataNavigatorWindow, MenuSelectHdl, MenuButton *, pBtn, void )
     {
         bool bIsDocModified = false;
         Reference< css::xforms::XFormsUIHelper1 > xUIHelper;
@@ -1770,7 +1770,6 @@ namespace svxform
 
         if ( bIsDocModified )
             SetDocModified();
-        return 0;
     }
 
     bool DataNavigatorWindow::IsAdditionalPage(sal_uInt16 nId) const
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index 00b2efb..2232b6a 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -351,7 +351,7 @@ namespace svxform
         XFrameModel_ref             m_xFrameModel;
 
         DECL_LINK(                  ModelSelectHdl, ListBox * );
-        DECL_LINK(                  MenuSelectHdl, MenuButton * );
+        DECL_LINK_TYPED(            MenuSelectHdl, MenuButton *, void );
         DECL_LINK(                  MenuActivateHdl, MenuButton * );
         DECL_LINK(ActivatePageHdl, void *);
         DECL_LINK(UpdateHdl, void *);
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index f549fbf..2073dd5 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -164,9 +164,9 @@ SwEnvFmtPage::SwEnvFmtPage(vcl::Window* pParent, const SfxItemSet& rSet)
     m_pSizeWidthField->SetLoseFocusHdl( aLk );
     m_pSizeHeightField->SetLoseFocusHdl( aLk );
 
-    aLk = LINK(this, SwEnvFmtPage, EditHdl );
-    m_pAddrEditButton->SetSelectHdl( aLk );
-    m_pSendEditButton->SetSelectHdl( aLk );
+    Link<MenuButton *, void> aLk2 = LINK(this, SwEnvFmtPage, EditHdl );
+    m_pAddrEditButton->SetSelectHdl( aLk2 );
+    m_pSendEditButton->SetSelectHdl( aLk2 );
 
     m_pPreview->SetBorderStyle( WindowBorderStyle::MONO );
 
@@ -254,7 +254,7 @@ IMPL_LINK( SwEnvFmtPage, ModifyHdl, Edit *, pEdit )
     return 0;
 }
 
-IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
+IMPL_LINK_TYPED( SwEnvFmtPage, EditHdl, MenuButton *, pButton, void )
 {
     SwWrtShell* pSh = GetParentSwEnvDlg()->pSh;
     OSL_ENSURE(pSh, "Shell missing");
@@ -342,7 +342,6 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
             }
         }
     }
-    return 0;
 }
 
 // A temporary Itemset that gets discarded at abort
diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx
index 744f576..f028d28 100644
--- a/sw/source/ui/envelp/envfmt.hxx
+++ b/sw/source/ui/envelp/envfmt.hxx
@@ -44,7 +44,7 @@ class SwEnvFmtPage : public SfxTabPage
     std::vector<sal_uInt16>  aIDs;
 
     DECL_LINK( ModifyHdl, Edit * );
-    DECL_LINK( EditHdl, MenuButton * );
+    DECL_LINK_TYPED( EditHdl, MenuButton *, void );
     DECL_LINK(FormatHdl, void *);
 
     void SetMinMax();
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
index 46132d0..c8d4f07 100644
--- a/sw/source/ui/misc/glossary.cxx
+++ b/sw/source/ui/misc/glossary.cxx
@@ -783,7 +783,7 @@ void SwGlossaryDlg::Init()
     m_pInsertTipCB->SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
 }
 
-IMPL_LINK_NOARG(SwGlossaryDlg, EditHdl)
+IMPL_LINK_NOARG_TYPED(SwGlossaryDlg, EditHdl, MenuButton *, void)
 {
 // EndDialog must not be called in MenuHdl
     if (m_pEditBtn->GetCurItemIdent() == "edit")
@@ -792,7 +792,6 @@ IMPL_LINK_NOARG(SwGlossaryDlg, EditHdl)
         delete pGroup;
         EndDialog(RET_EDIT);
     }
-    return 0;
 }
 
 // KeyInput for ShortName - Edits without Spaces
diff --git a/sw/source/uibase/inc/glossary.hxx b/sw/source/uibase/inc/glossary.hxx
index 62ae7b4..ca04532 100644
--- a/sw/source/uibase/inc/glossary.hxx
+++ b/sw/source/uibase/inc/glossary.hxx
@@ -129,7 +129,7 @@ class SwGlossaryDlg : public SvxStandardDialog
     DECL_LINK( MenuHdl, Menu * );
     DECL_LINK( EnableHdl, Menu * );
     DECL_LINK(BibHdl, void *);
-    DECL_LINK(EditHdl, void *);
+    DECL_LINK_TYPED(EditHdl, MenuButton *, void);
     DECL_LINK(InsertHdl, void *);
     DECL_LINK( PathHdl, Button * );
     DECL_LINK( CheckBoxHdl, CheckBox * );
diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx
index 5df56b0..d61c0b7 100644
--- a/vcl/unx/generic/app/i18n_status.cxx
+++ b/vcl/unx/generic/app/i18n_status.cxx
@@ -306,7 +306,7 @@ class IIIMPStatusWindow : public StatusWindow
     bool                    m_bShow;
     bool                    m_bOn;
 
-    DECL_LINK( SelectHdl, MenuButton* );
+    DECL_LINK_TYPED( SelectHdl, MenuButton*, void );
 
     void show();
 
@@ -460,7 +460,7 @@ void IIIMPStatusWindow::GetFocus()
     }
 }
 
-IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn )
+IMPL_LINK_TYPED( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn, void )
 {
     if( pBtn == m_aStatusBtn )
     {
@@ -488,7 +488,6 @@ IMPL_LINK( IIIMPStatusWindow, SelectHdl, MenuButton*, pBtn )
             }
         }
     }
-    return 0;
 }
 
 /*
commit b705075634d54a57e5edfeae1791869186bf149a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 16:56:23 2015 +0200

    IMPL_LINK_NOARG_TYPED is more useful with a non-void* ArgType
    
    ...as it will be used to implement a function that needs to be compatiblie with
    some specific Link<Arg,Ret> type.
    
    Change-Id: Ieabd0ee499850a304e0c6e625953532be47ac784

diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index 3cf09bc..55dfbae 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -96,11 +96,11 @@
     } \
     RetType Class::Member(ArgType ArgName)
 
-#define IMPL_LINK_NOARG_TYPED(Class, Member, RetType) \
-    RetType Class::LinkStub##Member(void * instance, void * data) { \
+#define IMPL_LINK_NOARG_TYPED(Class, Member, ArgType, RetType) \
+    RetType Class::LinkStub##Member(void * instance, ArgType data) { \
         return static_cast<Class *>(instance)->Member(data); \
     } \
-    RetType Class::Member(SAL_UNUSED_PARAMETER void *)
+    RetType Class::Member(SAL_UNUSED_PARAMETER ArgType)
 
 #define IMPL_STATIC_LINK_TYPED(Class, Member, ArgType, ArgName, RetType) \
     RetType Class::LinkStub##Member(void * instance, ArgType data) { \
@@ -115,12 +115,13 @@
     } \
     RetType Class::Member(SAL_UNUSED_PARAMETER Class *, ArgType ArgName)
 
-#define IMPL_STATIC_LINK_NOINSTANCE_NOARG_TYPED(Class, Member, RetType) \
-    RetType Class::LinkStub##Member(void * instance, void * data) { \
+#define IMPL_STATIC_LINK_NOINSTANCE_NOARG_TYPED( \
+        Class, Member, ArgType, RetType) \
+    RetType Class::LinkStub##Member(void * instance, ArgType data) { \
         return Member(static_cast<Class *>(instance), data); \
     } \
     RetType Class::Member( \
-        SAL_UNUSED_PARAMETER Class *, SAL_UNUSED_PARAMETER void *)
+        SAL_UNUSED_PARAMETER Class *, SAL_UNUSED_PARAMETER ArgType)
 
 #define LINK(Instance, Class, Member) ::tools::detail::makeLink( \
     static_cast<Class *>(Instance), &Class::LinkStub##Member)
commit 385a248513da5984d5c05301ae9d50a7876a826f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 15:06:21 2015 +0200

    Do not warn about Link<Window *>
    
    Change-Id: Id26adce17a2479eead935958556012f13f2821b7

diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index a2f4ee1..d239c67 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -105,12 +105,17 @@ bool containsWindowSubclass(const Type* pType0) {
     if (pRecordDecl) {
         const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
         if (pTemplate) {
+            bool link = pTemplate->getQualifiedNameAsString() == "Link";
             for(unsigned i=0; i<pTemplate->getTemplateArgs().size(); ++i) {
                 const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i];
                 if (rArg.getKind() == TemplateArgument::ArgKind::Type &&
                     containsWindowSubclass(rArg.getAsType()))
                 {
-                    return true;
+                    // OK for first template argument of tools/link.hxx Link
+                    // to be a Window-derived pointer:
+                    if (!link || i != 0) {
+                        return true;
+                    }
                 }
             }
         }
commit a8174d258d4ad1f151a245b80e5a9bbddc731f2a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 15:05:23 2015 +0200

    streamline containsWindowSubclass
    
    Change-Id: I56d61b577df00855a49dd618e9dafcdb86cd7ca4

diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index f984dcb..a2f4ee1 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -80,20 +80,18 @@ bool isDerivedFromWindow(const CXXRecordDecl *decl) {
 bool containsWindowSubclass(const Type* pType0);
 
 bool containsWindowSubclass(const QualType& qType) {
-    if (startsWith(qType.getAsString(), "VclPtr"))
-        return false;
-    if (startsWith(qType.getAsString(), "const VclPtr"))
-        return false;
-    if (startsWith(qType.getAsString(), "class VclPtr"))
-        return false;
-    if (startsWith(qType.getAsString(), "const class VclPtr"))
-        return false;
-    if (startsWith(qType.getAsString(), "ScopedVclPtr"))
-        return false;
-    if (startsWith(qType.getAsString(), "class ScopedVclPtr"))
-        return false;
-    if (startsWith(qType.getAsString(), "const class ScopedVclPtr"))
-        return false;
+    auto t = qType->getAs<RecordType>();
+    if (t != nullptr) {
+        auto d = dyn_cast<ClassTemplateSpecializationDecl>(t->getDecl());
+        if (d != nullptr) {
+            std::string name(d->getQualifiedNameAsString());
+            if (name == "ScopedVclPtr" || name == "ScopedVclPtrInstance"
+                || name == "VclPtr" || name == "VclPtrInstance")
+            {
+                return false;
+            }
+        }
+    }
     return containsWindowSubclass(qType.getTypePtr());
 }
 
commit 85895a76a436007cebc05f0da36e8b1cdb815868
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 15:04:04 2015 +0200

    Fix Link<T, void>::Call
    
    Change-Id: Id85f33eab2767961f24688fffac84416b1cb22d8

diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index bb6ca2d..3cf09bc 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -137,7 +137,7 @@ public:
         function_(function), instance_(instance) {}
 
     Ret Call(Arg data) const
-    { return function_ == nullptr ? Ret{} : (*function_)(instance_, data); }
+    { return function_ == nullptr ? Ret() : (*function_)(instance_, data); }
 
     bool IsSet() const { return function_ != nullptr; }
 
commit b3068470966530fa1d0b0c76d9095c6edb6a0df0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 15:03:12 2015 +0200

    No need for LINK vs LINK_TYPED distinction
    
    (fully qualify ::tools::detail::makeLink to avoid clashes with namespace
    basegfx::tools)
    
    Change-Id: I52818d0a47c78f1af7673ff91eb6517bc0820655

diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index d157bc0..bb6ca2d 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -74,9 +74,6 @@
     sal_IntPtr Class::Member( \
         SAL_UNUSED_PARAMETER Class *, SAL_UNUSED_PARAMETER void *)
 
-#define LINK(Instance, Class, Member) \
-    Link<>(static_cast<Class *>(Instance), &Class::LinkStub##Member)
-
 #define DECL_LINK_TYPED(Member, ArgType, RetType) \
     static RetType LinkStub##Member(void *, ArgType); \
     RetType Member(ArgType)
@@ -125,7 +122,7 @@
     RetType Class::Member( \
         SAL_UNUSED_PARAMETER Class *, SAL_UNUSED_PARAMETER void *)
 
-#define LINK_TYPED(Instance, Class, Member) tools::detail::makeLink( \
+#define LINK(Instance, Class, Member) ::tools::detail::makeLink( \
     static_cast<Class *>(Instance), &Class::LinkStub##Member)
 
 #define EMPTYARG
diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx
index 128b6f9..c8f8da8 100644
--- a/sfx2/source/appl/appmain.cxx
+++ b/sfx2/source/appl/appmain.cxx
@@ -51,7 +51,7 @@ SfxFilterMatcher& SfxApplication::GetFilterMatcher()
     if( !pAppData_Impl->pMatcher )
     {
         pAppData_Impl->pMatcher = new SfxFilterMatcher();
-        URIHelper::SetMaybeFileHdl( LINK_TYPED(
+        URIHelper::SetMaybeFileHdl( LINK(
             pAppData_Impl->pMatcher, SfxFilterMatcher, MaybeFileHdl_Impl ) );
     }
     return *pAppData_Impl->pMatcher;
commit ebd62f7c793552fc9c10480421e2740413922b39
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Apr 30 15:01:43 2015 +0200

    Missing param name
    
    Change-Id: I1fd2e76c098d0bffb446a1b2133d3392bfbb3de7

diff --git a/include/tools/link.hxx b/include/tools/link.hxx
index 16a5818..d157bc0 100644
--- a/include/tools/link.hxx
+++ b/include/tools/link.hxx
@@ -94,7 +94,7 @@
     SAL_DLLPRIVATE static RetType Member(Class *, ArgType)
 
 #define IMPL_LINK_TYPED(Class, Member, ArgType, ArgName, RetType) \
-    RetType Class::LinkStub##Member(void * instance, ArgType) { \
+    RetType Class::LinkStub##Member(void * instance, ArgType data) { \
         return static_cast<Class *>(instance)->Member(data); \
     } \
     RetType Class::Member(ArgType ArgName)


More information about the Libreoffice-commits mailing list