From 6f1313b3d44ea54e9a331e0fc00871081fa662fe Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 15 Oct 2015 08:13:49 +0200 Subject: convert Link<> to typed Change-Id: Icbba339dac0be31e30dff021bba06a219f8aecd6 Reviewed-on: https://gerrit.libreoffice.org/19405 Tested-by: Jenkins Reviewed-by: Noel Grandin --- extensions/source/abpilot/abpfinalpage.cxx | 3 +-- extensions/source/abpilot/abpfinalpage.hxx | 2 +- extensions/source/dbpilots/groupboxwiz.cxx | 3 +-- extensions/source/dbpilots/groupboxwiz.hxx | 2 +- extensions/source/dbpilots/listcombowizard.cxx | 3 +-- extensions/source/dbpilots/listcombowizard.hxx | 2 +- extensions/source/propctrlr/commoncontrol.cxx | 5 +++++ extensions/source/propctrlr/commoncontrol.hxx | 21 ++++++++++++++++++--- extensions/source/propctrlr/formlinkdialog.cxx | 6 +++--- extensions/source/propctrlr/newdatatype.cxx | 6 ++---- extensions/source/propctrlr/newdatatype.hxx | 2 +- extensions/source/propctrlr/standardcontrol.cxx | 4 ++-- extensions/source/scanner/sanedlg.cxx | 19 +++++++++---------- extensions/source/scanner/sanedlg.hxx | 2 +- 14 files changed, 47 insertions(+), 33 deletions(-) (limited to 'extensions') diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index 3226768e847a..c115698d5031 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -211,10 +211,9 @@ namespace abp } - IMPL_LINK( FinalPage, OnNameModified, Edit*, /**/ ) + IMPL_LINK_NOARG_TYPED( FinalPage, OnNameModified, Edit&, void ) { implCheckName(); - return 0L; } diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx index 7416413a765e..28f2c1954d20 100644 --- a/extensions/source/abpilot/abpfinalpage.hxx +++ b/extensions/source/abpilot/abpfinalpage.hxx @@ -67,7 +67,7 @@ namespace abp virtual bool canAdvance() const override; private: - DECL_LINK( OnNameModified, Edit* ); + DECL_LINK_TYPED( OnNameModified, Edit&, void ); DECL_LINK_TYPED(OnRegister, Button*, void); DECL_LINK_TYPED(OnEmbed, Button*, void); diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index 45e08891f02c..35f190f712ac 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -291,10 +291,9 @@ namespace dbp } - IMPL_LINK( ORadioSelectionPage, OnNameModified, Edit*, /*_pList*/ ) + IMPL_LINK_NOARG_TYPED( ORadioSelectionPage, OnNameModified, Edit&, void ) { implCheckMoveButtons(); - return 0L; } diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx index c21b8c2ba99f..ba90a5f8f50c 100644 --- a/extensions/source/dbpilots/groupboxwiz.hxx +++ b/extensions/source/dbpilots/groupboxwiz.hxx @@ -102,7 +102,7 @@ namespace dbp DECL_LINK_TYPED( OnMoveEntry, Button*, void ); DECL_LINK_TYPED( OnEntrySelected, ListBox&, void ); - DECL_LINK( OnNameModified, Edit* ); + DECL_LINK_TYPED( OnNameModified, Edit&, void ); void implCheckMoveButtons(); }; diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx index 2d888a2dba5f..4db4a39ab177 100644 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ b/extensions/source/dbpilots/listcombowizard.cxx @@ -488,10 +488,9 @@ namespace dbp } - IMPL_LINK_NOARG(OLinkFieldsPage, OnSelectionModified) + IMPL_LINK_NOARG_TYPED(OLinkFieldsPage, OnSelectionModified, Edit&, void) { implCheckFinish(); - return 0L; } IMPL_LINK_NOARG_TYPED(OLinkFieldsPage, OnSelectionModifiedCombBox, ComboBox&, void) diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx index a65300e8dba3..3e90a01138bc 100644 --- a/extensions/source/dbpilots/listcombowizard.hxx +++ b/extensions/source/dbpilots/listcombowizard.hxx @@ -167,7 +167,7 @@ namespace dbp private: void implCheckFinish(); - DECL_LINK(OnSelectionModified, void*); + DECL_LINK_TYPED(OnSelectionModified, Edit&, void); DECL_LINK_TYPED(OnSelectionModifiedCombBox, ComboBox&, void); }; diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx index be90a9be44ac..c591761f5802 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -95,6 +95,11 @@ namespace pcr } + IMPL_LINK_NOARG_TYPED( CommonBehaviourControlHelper, EditModifiedHdl, Edit&, void ) + { + setModified(); + } + IMPL_LINK_NOARG( CommonBehaviourControlHelper, ModifiedHdl ) { setModified(); diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx index 481ef86f3eb8..fc39aec21412 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -27,10 +27,12 @@ #include #include #include +#include class NotifyEvent; class Control; class ListBox; +class Edit; namespace pcr { @@ -88,6 +90,7 @@ namespace pcr /// may be used by derived classes, they forward the event to the PropCtrListener DECL_LINK( ModifiedHdl, void* ); + DECL_LINK_TYPED( EditModifiedHdl, Edit&, void ); DECL_LINK_TYPED( SelectHdl, ListBox&, void ); DECL_LINK_TYPED( GetFocusHdl, Control&, void ); DECL_LINK_TYPED( LoseFocusHdl, Control&, void ); @@ -148,27 +151,39 @@ namespace pcr inline void impl_checkDisposed_throw(); private: VclPtr m_pControlWindow; + void implSetModifyHandler(std::true_type); + void implSetModifyHandler(std::false_type); }; //= CommonBehaviourControl - implementation - template< class TControlInterface, class TControlWindow > - inline CommonBehaviourControl< TControlInterface, TControlWindow >::CommonBehaviourControl ( sal_Int16 _nControlType, vcl::Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers ) + inline CommonBehaviourControl< TControlInterface, TControlWindow >::CommonBehaviourControl ( sal_Int16 _nControlType, vcl::Window* _pParentWindow, WinBits _nWindowStyle, bool _bDoSetHandlers) :ComponentBaseClass( m_aMutex ) ,CommonBehaviourControlHelper( _nControlType, *this ) ,m_pControlWindow( new TControlWindow( _pParentWindow, _nWindowStyle ) ) { if ( _bDoSetHandlers ) { - m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) ); + implSetModifyHandler(std::is_base_of<::Edit,TControlWindow>()); m_pControlWindow->SetGetFocusHdl( LINK( this, CommonBehaviourControlHelper, GetFocusHdl ) ); m_pControlWindow->SetLoseFocusHdl( LINK( this, CommonBehaviourControlHelper, LoseFocusHdl ) ); } autoSizeWindow(); } + template< class TControlInterface, class TControlWindow > + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::true_type) + { + m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, EditModifiedHdl ) ); + } + + template< class TControlInterface, class TControlWindow > + inline void CommonBehaviourControl< TControlInterface, TControlWindow >::implSetModifyHandler(std::false_type) + { + m_pControlWindow->SetModifyHdl( LINK( this, CommonBehaviourControlHelper, ModifiedHdl ) ); + } template< class TControlInterface, class TControlWindow > inline void CommonBehaviourControl< TControlInterface, TControlWindow >::impl_checkDisposed_throw() diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index 600bb7208404..127531a557f4 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -92,7 +92,7 @@ namespace pcr void fillList( LinkParticipant _eWhich, const Sequence< OUString >& _rFieldNames ); private: - DECL_LINK( OnFieldNameChanged, ComboBox* ); + DECL_LINK_TYPED( OnFieldNameChanged, Edit&, void ); }; @@ -147,9 +147,9 @@ namespace pcr } - IMPL_LINK( FieldLinkRow, OnFieldNameChanged, ComboBox*, /*_pBox*/ ) + IMPL_LINK_NOARG_TYPED( FieldLinkRow, OnFieldNameChanged, Edit&, void ) { - return m_aLinkChangeHandler.Call( this ); + m_aLinkChangeHandler.Call( this ); } VCL_BUILDER_FACTORY(FieldLinkRow) diff --git a/extensions/source/propctrlr/newdatatype.cxx b/extensions/source/propctrlr/newdatatype.cxx index c6d76be1433d..64c69c2087ef 100644 --- a/extensions/source/propctrlr/newdatatype.cxx +++ b/extensions/source/propctrlr/newdatatype.cxx @@ -64,7 +64,7 @@ namespace pcr while ( m_aProhibitedNames.find( sInitialName ) != m_aProhibitedNames.end() ); m_pName->SetText( sInitialName ); - OnNameModified( NULL ); + OnNameModified( *m_pName ); } NewDataTypeDialog::~NewDataTypeDialog() @@ -79,15 +79,13 @@ namespace pcr ModalDialog::dispose(); } - IMPL_LINK_NOARG( NewDataTypeDialog, OnNameModified ) + IMPL_LINK_NOARG_TYPED( NewDataTypeDialog, OnNameModified, Edit&, void ) { OUString sCurrentName = GetName(); bool bNameIsOK = ( !sCurrentName.isEmpty() ) && ( m_aProhibitedNames.find( sCurrentName ) == m_aProhibitedNames.end() ); m_pOK->Enable( bNameIsOK ); - - return 0L; } diff --git a/extensions/source/propctrlr/newdatatype.hxx b/extensions/source/propctrlr/newdatatype.hxx index fd285c096e3c..24358f907fd0 100644 --- a/extensions/source/propctrlr/newdatatype.hxx +++ b/extensions/source/propctrlr/newdatatype.hxx @@ -49,7 +49,7 @@ namespace pcr OUString GetName() const { return m_pName->GetText(); } private: - DECL_LINK( OnNameModified, void* ); + DECL_LINK_TYPED( OnNameModified, Edit&, void ); }; diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 200b0f9e65fb..6d6265294d7b 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -1060,9 +1060,9 @@ namespace pcr void DropDownEditControl::setControlHelper( CommonBehaviourControlHelper& _rControlHelper ) { m_pHelper = &_rControlHelper; - m_pFloatingEdit->getEdit().SetModifyHdl( LINK( &_rControlHelper, CommonBehaviourControlHelper, ModifiedHdl ) ); + m_pFloatingEdit->getEdit().SetModifyHdl( LINK( &_rControlHelper, CommonBehaviourControlHelper, EditModifiedHdl ) ); m_pImplEdit->SetGetFocusHdl( LINK( &_rControlHelper, CommonBehaviourControlHelper, GetFocusHdl ) ); - m_pImplEdit->SetModifyHdl( LINK( &_rControlHelper, CommonBehaviourControlHelper, ModifiedHdl ) ); + m_pImplEdit->SetModifyHdl( LINK( &_rControlHelper, CommonBehaviourControlHelper, EditModifiedHdl ) ); m_pImplEdit->SetLoseFocusHdl( LINK( &_rControlHelper, CommonBehaviourControlHelper, LoseFocusHdl ) ); } diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 4e92dd1470e4..50a81a66ed2f 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -775,15 +775,15 @@ IMPL_LINK_TYPED( SaneDlg, OptionsBoxSelectHdl, SvTreeListBox*, pBox, void ) } } -IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit ) +IMPL_LINK_TYPED( SaneDlg, ModifyHdl, Edit&, rEdit, void ) { if( mrSane.IsOpen() ) { - if( pEdit == mpStringEdit ) + if( &rEdit == mpStringEdit ) { mrSane.SetOptionValue( mnCurrentOption, mpStringEdit->GetText() ); } - else if( pEdit == mpReslBox ) + else if( &rEdit == mpReslBox ) { double fRes = (double)mpReslBox->GetValue(); int nOption = mrSane.GetOptionByName( "resolution" ); @@ -813,7 +813,7 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit ) mpReslBox->SetValue( (sal_uLong)fRes ); } } - else if( pEdit == mpNumericEdit ) + else if( &rEdit == mpNumericEdit ) { double fValue; OString aContents(OUStringToOString(mpNumericEdit->GetText(), @@ -831,7 +831,7 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit ) } mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement ); } - else if( pEdit == mpVectorBox ) + else if( &rEdit == mpVectorBox ) { mnCurrentElement = mpVectorBox->GetValue()-1; double fValue; @@ -844,28 +844,27 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit ) mpQuantumRangeBox->SelectEntry( aValue ); } } - else if( pEdit == mpTopField ) + else if( &rEdit == mpTopField ) { mpPreview->ChangePreviewLogicTopLeftY(mpTopField->GetValue()); mpPreview->Invalidate(); } - else if( pEdit == mpLeftField ) + else if( &rEdit == mpLeftField ) { mpPreview->ChangePreviewLogicTopLeftX(mpLeftField->GetValue()); mpPreview->Invalidate(); } - else if( pEdit == mpBottomField ) + else if( &rEdit == mpBottomField ) { mpPreview->ChangePreviewLogicBottomRightY(mpBottomField->GetValue()); mpPreview->Invalidate(); } - else if( pEdit == mpRightField ) + else if( &rEdit == mpRightField ) { mpPreview->ChangePreviewLogicBottomRightX(mpRightField->GetValue()); mpPreview->Invalidate(); } } - return 0; } IMPL_LINK_NOARG_TYPED( SaneDlg, ReloadSaneOptionsHdl, Sane&, void ) diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx index f3871721b450..bbd46e990243 100644 --- a/extensions/source/scanner/sanedlg.hxx +++ b/extensions/source/scanner/sanedlg.hxx @@ -82,7 +82,7 @@ private: DECL_LINK_TYPED( ClickBtnHdl, Button*, void ); DECL_LINK_TYPED( SelectHdl, ListBox&, void ); - DECL_LINK( ModifyHdl, Edit* ); + DECL_LINK_TYPED( ModifyHdl, Edit&, void ); DECL_LINK_TYPED( ReloadSaneOptionsHdl, Sane&, void ); DECL_LINK_TYPED( OptionsBoxSelectHdl, SvTreeListBox*, void ); -- cgit