diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-13 15:51:37 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-15 10:32:29 +0200 |
commit | 74dbe58f1e5b6f4f281e13f348c8952b1086877a (patch) | |
tree | fda8bd8374592491d3e64b02e4f3ca13879cf2d4 | |
parent | fa21f301ddef575baad9a3aa8564199285e6d90b (diff) |
convert Link<> to typed
Change-Id: I2ef1e5fe5c6dc65c254b3a16b0b12fca5caba16e
30 files changed, 179 insertions, 187 deletions
diff --git a/cui/source/inc/grfpage.hxx b/cui/source/inc/grfpage.hxx index 89f13f053264..49ad01f2a9fd 100644 --- a/cui/source/inc/grfpage.hxx +++ b/cui/source/inc/grfpage.hxx @@ -97,7 +97,7 @@ class SvxGrfCropPage : public SfxTabPage DECL_LINK( ZoomHdl, MetricField * ); DECL_LINK( SizeHdl, MetricField * ); - DECL_LINK( CropHdl, const MetricField * ); + DECL_LINK_TYPED( CropHdl, SpinField&, void ); DECL_LINK_TYPED( CropLoseFocusHdl, Control&, void ); DECL_LINK( CropModifyHdl, MetricField * ); DECL_LINK_TYPED(OrigSizeHdl, Button*, void); diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index d4199a3cf2a4..8ffba711cc7c 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -429,7 +429,7 @@ class SvxNumPositionTabPage : public SfxTabPage DECL_LINK_TYPED( LevelHdl_Impl, ListBox&, void ); DECL_LINK_TYPED( EditModifyHdl_Impl, ListBox&, void); - DECL_LINK( DistanceHdl_Impl, MetricField * ); + DECL_LINK_TYPED( DistanceHdl_Impl, SpinField&, void ); DECL_LINK_TYPED( DistanceFocusHdl_Impl, Control&, void ); DECL_LINK_TYPED( RelativeHdl_Impl, Button*, void ); DECL_LINK_TYPED( StandardHdl_Impl, Button*, void); @@ -438,9 +438,9 @@ class SvxNumPositionTabPage : public SfxTabPage void ShowControlsDependingOnPosAndSpaceMode(); DECL_LINK_TYPED(LabelFollowedByHdl_Impl, ListBox&, void); - DECL_LINK( ListtabPosHdl_Impl, MetricField* ); - DECL_LINK( AlignAtHdl_Impl, MetricField* ); - DECL_LINK( IndentAtHdl_Impl, MetricField* ); + DECL_LINK_TYPED( ListtabPosHdl_Impl, SpinField&, void ); + DECL_LINK_TYPED( AlignAtHdl_Impl, SpinField&, void ); + DECL_LINK_TYPED( IndentAtHdl_Impl, SpinField&, void ); public: SvxNumPositionTabPage(vcl::Window* pParent, diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 0764524c0b6d..4c216c9a52c2 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -287,12 +287,12 @@ OfaMiscTabPage::OfaMiscTabPage(vcl::Window* pParent, const SfxItemSet& rSet) m_aStrDateInfo = m_pToYearFT->GetText(); m_pYearValueField->SetModifyHdl( LINK( this, OfaMiscTabPage, TwoFigureHdl ) ); - Link<> aLink = LINK( this, OfaMiscTabPage, TwoFigureConfigHdl ); + Link<SpinField&,void> aLink = LINK( this, OfaMiscTabPage, TwoFigureConfigHdl ); m_pYearValueField->SetDownHdl( aLink ); m_pYearValueField->SetUpHdl( aLink ); m_pYearValueField->SetLoseFocusHdl( LINK( this, OfaMiscTabPage, TwoFigureConfigFocusHdl ) ); m_pYearValueField->SetFirstHdl( aLink ); - TwoFigureConfigHdl(m_pYearValueField); + TwoFigureConfigHdl(*m_pYearValueField); SetExchangeSupport(); } @@ -400,7 +400,7 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) if ( SfxItemState::SET == rSet->GetItemState( SID_ATTR_YEAR2000, false, &pItem ) ) { m_pYearValueField->SetValue( static_cast<const SfxUInt16Item*>(pItem)->GetValue() ); - TwoFigureConfigHdl(m_pYearValueField); + TwoFigureConfigHdl(*m_pYearValueField); } else { @@ -435,16 +435,15 @@ IMPL_LINK( OfaMiscTabPage, TwoFigureHdl, NumericField*, pEd ) IMPL_LINK_TYPED( OfaMiscTabPage, TwoFigureConfigFocusHdl, Control&, rControl, void ) { - TwoFigureConfigHdl(static_cast<NumericField*>(&rControl)); + TwoFigureConfigHdl(static_cast<SpinField&>(rControl)); } -IMPL_LINK( OfaMiscTabPage, TwoFigureConfigHdl, NumericField*, pEd ) +IMPL_LINK_TYPED( OfaMiscTabPage, TwoFigureConfigHdl, SpinField&, rEd, void ) { sal_Int64 nNum = m_pYearValueField->GetValue(); OUString aOutput(OUString::number(nNum)); m_pYearValueField->SetText(aOutput); m_pYearValueField->SetSelection( Selection( 0, aOutput.getLength() ) ); - TwoFigureHdl( pEd ); - return 0; + TwoFigureHdl( static_cast<NumericField*>(&rEd) ); } class CanvasSettings diff --git a/cui/source/options/optgdlg.hxx b/cui/source/options/optgdlg.hxx index 5efcbc243cd0..4d803ba3c8dd 100644 --- a/cui/source/options/optgdlg.hxx +++ b/cui/source/options/optgdlg.hxx @@ -59,7 +59,7 @@ private: VclPtr<CheckBox> m_pCollectUsageInfo; DECL_LINK( TwoFigureHdl, NumericField* ); - DECL_LINK( TwoFigureConfigHdl, NumericField* ); + DECL_LINK_TYPED( TwoFigureConfigHdl, SpinField&, void ); DECL_LINK_TYPED( TwoFigureConfigFocusHdl, Control&, void ); #ifdef WNT DECL_LINK( OnFileDlgToggled, void* ); diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index d085a99e0896..be6df3cd25a0 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -95,15 +95,15 @@ SvxGrfCropPage::SvxGrfCropPage ( vcl::Window *pParent, const SfxItemSet &rSet ) m_pWidthZoomMF->SetModifyHdl( aLk ); m_pHeightZoomMF->SetModifyHdl( aLk ); - aLk = LINK(this, SvxGrfCropPage, CropHdl); - m_pLeftMF->SetDownHdl( aLk ); - m_pRightMF->SetDownHdl( aLk ); - m_pTopMF->SetDownHdl( aLk ); - m_pBottomMF->SetDownHdl( aLk ); - m_pLeftMF->SetUpHdl( aLk ); - m_pRightMF->SetUpHdl( aLk ); - m_pTopMF->SetUpHdl( aLk ); - m_pBottomMF->SetUpHdl( aLk ); + Link<SpinField&,void> aLk3 = LINK(this, SvxGrfCropPage, CropHdl); + m_pLeftMF->SetDownHdl( aLk3 ); + m_pRightMF->SetDownHdl( aLk3 ); + m_pTopMF->SetDownHdl( aLk3 ); + m_pBottomMF->SetDownHdl( aLk3 ); + m_pLeftMF->SetUpHdl( aLk3 ); + m_pRightMF->SetUpHdl( aLk3 ); + m_pTopMF->SetUpHdl( aLk3 ); + m_pBottomMF->SetUpHdl( aLk3 ); aLk = LINK(this, SvxGrfCropPage, CropModifyHdl); m_pLeftMF->SetModifyHdl( aLk ); @@ -483,7 +483,7 @@ IMPL_LINK( SvxGrfCropPage, SizeHdl, MetricField *, pField ) description: evaluate border --------------------------------------------------------------------*/ -IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) +IMPL_LINK_TYPED( SvxGrfCropPage, CropHdl, SpinField&, rField, void ) { SfxItemPool* pPool = GetItemSet().GetPool(); DBG_ASSERT( pPool, "Wo ist der Pool" ); @@ -491,7 +491,7 @@ IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) SID_ATTR_GRAF_CROP ) ) ); bool bZoom = m_pZoomConstRB->IsChecked(); - if( pField == m_pLeftMF || pField == m_pRightMF ) + if( &rField == m_pLeftMF || &rField == m_pRightMF ) { long nLeft = lcl_GetValue( *m_pLeftMF, eUnit ); long nRight = lcl_GetValue( *m_pRightMF, eUnit ); @@ -499,7 +499,7 @@ IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) if(bZoom && ( ( ( aOrigSize.Width() - (nLeft + nRight )) * nWidthZoom ) / 100 >= aPageSize.Width() ) ) { - if(pField == m_pLeftMF) + if(&rField == m_pLeftMF) { nLeft = aOrigSize.Width() - ( aPageSize.Width() * 100 / nWidthZoom + nRight ); @@ -536,7 +536,7 @@ IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom) / 100 >= aPageSize.Height())) { - if(pField == m_pTopMF) + if(&rField == m_pTopMF) { nTop = aOrigSize.Height() - ( aPageSize.Height() * 100 / nHeightZoom + nBottom); @@ -562,7 +562,6 @@ IMPL_LINK( SvxGrfCropPage, CropHdl, const MetricField *, pField ) if(!bZoom) CalcZoom(); CalcMinMaxBorder(); - return 0; } /*-------------------------------------------------------------------- description: set original size @@ -734,7 +733,7 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound ) IMPL_LINK_NOARG_TYPED(SvxGrfCropPage, Timeout, Timer *, void) { DBG_ASSERT(pLastCropField,"Timeout ohne Feld?"); - CropHdl(pLastCropField); + CropHdl(*pLastCropField); pLastCropField = 0; } @@ -743,7 +742,7 @@ IMPL_LINK_TYPED( SvxGrfCropPage, CropLoseFocusHdl, Control&, rControl, void ) { MetricField* pField = static_cast<MetricField*>(&rControl); aTimer.Stop(); - CropHdl(pField); + CropHdl(*pField); pLastCropField = 0; } diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index fe69953ca189..36e3f71135cc 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -2785,37 +2785,37 @@ SvxNumPositionTabPage::SvxNumPositionTabPage(vcl::Window* pParent, } m_pAlign2LB->SetDropDownLineCount( m_pAlign2LB->GetEntryCount() ); - Link<> aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl); + Link<SpinField&,void> aLk3 = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl); Link<Control&,void> aLk2 = LINK(this, SvxNumPositionTabPage, DistanceFocusHdl_Impl); - m_pDistBorderMF->SetUpHdl(aLk); - m_pDistBorderMF->SetDownHdl(aLk); + m_pDistBorderMF->SetUpHdl(aLk3); + m_pDistBorderMF->SetDownHdl(aLk3); m_pDistBorderMF->SetLoseFocusHdl(aLk2); - m_pDistNumMF->SetUpHdl(aLk); - m_pDistNumMF->SetDownHdl(aLk); + m_pDistNumMF->SetUpHdl(aLk3); + m_pDistNumMF->SetDownHdl(aLk3); m_pDistNumMF->SetLoseFocusHdl(aLk2); - m_pIndentMF->SetUpHdl(aLk); - m_pIndentMF->SetDownHdl(aLk); + m_pIndentMF->SetUpHdl(aLk3); + m_pIndentMF->SetDownHdl(aLk3); m_pIndentMF->SetLoseFocusHdl(aLk2); m_pLabelFollowedByLB->SetDropDownLineCount( m_pLabelFollowedByLB->GetEntryCount() ); m_pLabelFollowedByLB->SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) ); - aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl); - m_pListtabMF->SetUpHdl(aLk); - m_pListtabMF->SetDownHdl(aLk); + aLk3 = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl); + m_pListtabMF->SetUpHdl(aLk3); + m_pListtabMF->SetDownHdl(aLk3); m_pListtabMF->SetLoseFocusHdl(aLk2); - aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl); - m_pAlignedAtMF->SetUpHdl(aLk); - m_pAlignedAtMF->SetDownHdl(aLk); + aLk3 = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl); + m_pAlignedAtMF->SetUpHdl(aLk3); + m_pAlignedAtMF->SetDownHdl(aLk3); m_pAlignedAtMF->SetLoseFocusHdl(aLk2); - aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl); - m_pIndentAtMF->SetUpHdl(aLk); - m_pIndentAtMF->SetDownHdl(aLk); + aLk3 = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl); + m_pIndentAtMF->SetUpHdl(aLk3); + m_pIndentAtMF->SetDownHdl(aLk3); m_pIndentAtMF->SetLoseFocusHdl(aLk2); m_pLevelLB->EnableMultiSelection(true); @@ -3137,8 +3137,8 @@ SfxTabPage::sfxpg SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet) if(_pSet) { if(m_pDistBorderMF->IsEnabled()) - DistanceHdl_Impl(m_pDistBorderMF); - DistanceHdl_Impl(m_pIndentMF); + DistanceHdl_Impl(*m_pDistBorderMF); + DistanceHdl_Impl(*m_pIndentMF); FillItemSet(_pSet); } return LEAVE_PAGE; @@ -3383,20 +3383,20 @@ IMPL_LINK_TYPED( SvxNumPositionTabPage, LevelHdl_Impl, ListBox&, rBox, void ) IMPL_LINK_TYPED( SvxNumPositionTabPage, DistanceFocusHdl_Impl, Control&, rControl, void ) { - DistanceHdl_Impl(static_cast<MetricField*>(&rControl)); + DistanceHdl_Impl(static_cast<SpinField&>(rControl)); } -IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld ) +IMPL_LINK_TYPED( SvxNumPositionTabPage, DistanceHdl_Impl, SpinField&, rFld, void ) { if(bInInintControl) - return 0; - long nValue = GetCoreValue(*pFld, eCoreUnit); + return; + long nValue = GetCoreValue(static_cast<MetricField&>(rFld), eCoreUnit); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) { if(nActNumLvl & nMask) { SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) ); - if (pFld == m_pDistBorderMF) + if (&rFld == m_pDistBorderMF) { if(m_pRelativeCB->IsChecked()) @@ -3420,11 +3420,11 @@ IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld ) aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset()); } } - else if (pFld == m_pDistNumMF) + else if (&rFld == m_pDistNumMF) { aNumFmt.SetCharTextDistance( (short)nValue ); } - else if (pFld == m_pIndentMF) + else if (&rFld == m_pIndentMF) { // together with the FirstLineOffset the AbsLSpace must be changed, too long nDiff = nValue + aNumFmt.GetFirstLineOffset(); @@ -3443,8 +3443,6 @@ IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld ) { m_pDistBorderMF->SetText(""); } - - return 0; } IMPL_LINK_TYPED( SvxNumPositionTabPage, RelativeHdl_Impl, Button*, pBox, void ) @@ -3545,10 +3543,10 @@ IMPL_LINK_NOARG_TYPED(SvxNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox&, SetModified(); } -IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld ) +IMPL_LINK_TYPED( SvxNumPositionTabPage, ListtabPosHdl_Impl, SpinField&, rFld, void ) { // determine value to be set at the chosen list levels - const long nValue = GetCoreValue( *pFld, eCoreUnit ); + const long nValue = GetCoreValue( static_cast<MetricField&>(rFld), eCoreUnit ); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -3564,14 +3562,12 @@ IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld ) } SetModified(); - - return 0; } -IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld ) +IMPL_LINK_TYPED( SvxNumPositionTabPage, AlignAtHdl_Impl, SpinField&, rFld, void ) { // determine value to be set at the chosen list levels - const long nValue = GetCoreValue( *pFld, eCoreUnit ); + const long nValue = GetCoreValue( static_cast<MetricField&>(rFld), eCoreUnit ); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -3588,14 +3584,12 @@ IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld ) } SetModified(); - - return 0; } -IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld ) +IMPL_LINK_TYPED( SvxNumPositionTabPage, IndentAtHdl_Impl, SpinField&, rFld, void ) { // determine value to be set at the chosen list levels - const long nValue = GetCoreValue( *pFld, eCoreUnit ); + const long nValue = GetCoreValue( static_cast<MetricField&>(rFld), eCoreUnit ); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -3615,8 +3609,6 @@ IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld ) } SetModified(); - - return 0; } IMPL_LINK_NOARG_TYPED(SvxNumPositionTabPage, StandardHdl_Impl, Button*, void) diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx index de42a0966be3..6699557db01d 100644 --- a/include/svx/dialcontrol.hxx +++ b/include/svx/dialcontrol.hxx @@ -162,6 +162,7 @@ private: DECL_LINK( LinkedFieldModifyHdl, NumericField* ); DECL_LINK_TYPED( LinkedFieldFocusHdl, Control&, void ); void LinkedFieldModifyHdl(); + DECL_LINK_TYPED(SpinFieldHdl, SpinField&, void); }; /** Wrapper for usage of a DialControl in item connections. */ diff --git a/include/vcl/slider.hxx b/include/vcl/slider.hxx index 320deb35d193..98e93d80f76e 100644 --- a/include/vcl/slider.hxx +++ b/include/vcl/slider.hxx @@ -59,6 +59,7 @@ private: DECL_LINK(LinkedFieldModifyHdl, NumericField*); DECL_LINK_TYPED(LinkedFieldLoseFocusHdl, Control&, void); + DECL_LINK_TYPED(LinkedFieldSpinnerHdl, SpinField&, void); using Control::ImplInitSettings; using Window::ImplInit; diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx index 516ffeef32c9..bd1375af624f 100644 --- a/include/vcl/spinfld.hxx +++ b/include/vcl/spinfld.hxx @@ -34,10 +34,10 @@ protected: Rectangle maUpperRect; Rectangle maLowerRect; Rectangle maDropDownRect; // noch nicht angebunden... - Link<> maUpHdlLink; - Link<> maDownHdlLink; - Link<> maFirstHdlLink; - Link<> maLastHdlLink; + Link<SpinField&,void> maUpHdlLink; + Link<SpinField&,void> maDownHdlLink; + Link<SpinField&,void> maFirstHdlLink; + Link<SpinField&,void> maLastHdlLink; bool mbRepeat:1, mbSpin:1, mbInitialUp:1, @@ -89,11 +89,11 @@ public: virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual bool PreNotify( NotifyEvent& rNEvt ) override; - void SetUpHdl( const Link<>& rLink ) { maUpHdlLink = rLink; } - void SetDownHdl( const Link<>& rLink ) { maDownHdlLink = rLink; } - const Link<>& GetDownHdl() const { return maDownHdlLink; } - void SetFirstHdl( const Link<>& rLink ) { maFirstHdlLink = rLink; } - void SetLastHdl( const Link<>& rLink ) { maLastHdlLink = rLink; } + void SetUpHdl( const Link<SpinField&,void>& rLink ) { maUpHdlLink = rLink; } + void SetDownHdl( const Link<SpinField&,void>& rLink ) { maDownHdlLink = rLink; } + const Link<SpinField&,void>& GetDownHdl() const { return maDownHdlLink; } + void SetFirstHdl( const Link<SpinField&,void>& rLink ) { maFirstHdlLink = rLink; } + void SetLastHdl( const Link<SpinField&,void>& rLink ) { maLastHdlLink = rLink; } virtual Size CalcMinimumSize() const override; virtual Size CalcMinimumSizeForText(const OUString &rString) const override; diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 66ef7d827dd4..4b2169c02603 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -472,10 +472,19 @@ void DialControl::ImplSetFieldLink( const Link<>& rLink ) { NumericField& rField = *mpImpl->mpLinkField; rField.SetModifyHdl( rLink ); - rField.SetUpHdl( rLink ); - rField.SetDownHdl( rLink ); - rField.SetFirstHdl( rLink ); - rField.SetLastHdl( rLink ); + rField.SetUpHdl( LINK(this, DialControl, SpinFieldHdl) ); + rField.SetDownHdl( LINK(this, DialControl, SpinFieldHdl) ); + rField.SetFirstHdl( LINK(this, DialControl, SpinFieldHdl) ); + rField.SetLastHdl( LINK(this, DialControl, SpinFieldHdl) ); + } +} + +IMPL_LINK_NOARG_TYPED(DialControl, SpinFieldHdl, SpinField&, void) +{ + if( mpImpl->mpLinkField ) + { + NumericField& rField = *mpImpl->mpLinkField; + rField.GetModifyHdl().Call(&rField); } } diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index 78c6bd70912b..16dfdd50b3b4 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -134,7 +134,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) : m_pZoomLB->SelectEntryPos(0); //page size m_pZoomLB->SetSelectHdl(LINK(this, SwMailMergeLayoutPage, ZoomHdl_Impl)); - Link<> aFrameHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressHdl_Impl); + Link<SpinField&,void> aFrameHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressHdl_Impl); Link<Control&,void> aFocusHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressLoseFocusHdl_Impl); m_pLeftMF->SetUpHdl(aFrameHdl); m_pLeftMF->SetDownHdl(aFrameHdl); @@ -684,9 +684,9 @@ IMPL_LINK_TYPED(SwMailMergeLayoutPage, ZoomHdl_Impl, ListBox&, rBox, void) IMPL_LINK_NOARG_TYPED(SwMailMergeLayoutPage, ChangeAddressLoseFocusHdl_Impl, Control&, void) { - ChangeAddressHdl_Impl(nullptr); + ChangeAddressHdl_Impl(*m_pLeftMF); } -IMPL_LINK_NOARG(SwMailMergeLayoutPage, ChangeAddressHdl_Impl) +IMPL_LINK_NOARG_TYPED(SwMailMergeLayoutPage, ChangeAddressHdl_Impl, SpinField&, void) { if(m_pExampleWrtShell && m_pAddressBlockFormat) { @@ -704,7 +704,6 @@ IMPL_LINK_NOARG(SwMailMergeLayoutPage, ChangeAddressHdl_Impl) aSet.Put(SwFormatVertOrient( nTop, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME )); m_pExampleWrtShell->GetDoc()->SetFlyFrmAttr( *m_pAddressBlockFormat, aSet ); } - return 0; } IMPL_LINK_TYPED(SwMailMergeLayoutPage, GreetingsHdl_Impl, Button*, pButton, void) @@ -725,7 +724,7 @@ IMPL_LINK_TYPED(SwMailMergeLayoutPage, AlignToTextHdl_Impl, Button*, pBox, void) bool bCheck = static_cast<CheckBox*>(pBox)->IsChecked() && pBox->IsEnabled(); m_pLeftFT->Enable(!bCheck); m_pLeftMF->Enable(!bCheck); - ChangeAddressHdl_Impl( 0 ); + ChangeAddressHdl_Impl( *m_pLeftMF ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx index 821f9666734e..83007a94623a 100644 --- a/sw/source/ui/dbui/mmlayoutpage.hxx +++ b/sw/source/ui/dbui/mmlayoutpage.hxx @@ -67,7 +67,7 @@ class SwMailMergeLayoutPage : public svt::OWizardPage DECL_LINK_TYPED(PreviewLoadedHdl_Impl, SwOneExampleFrame&, void); DECL_LINK_TYPED(ZoomHdl_Impl, ListBox&, void); - DECL_LINK(ChangeAddressHdl_Impl, void *); + DECL_LINK_TYPED(ChangeAddressHdl_Impl, SpinField&, void); DECL_LINK_TYPED(ChangeAddressLoseFocusHdl_Impl, Control&, void); DECL_LINK_TYPED(GreetingsHdl_Impl, Button*, void); DECL_LINK_TYPED(AlignToTextHdl_Impl, Button*, void); diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 7c06b38580b8..61220e376e12 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -141,7 +141,7 @@ SwEnvFormatPage::SwEnvFormatPage(vcl::Window* pParent, const SfxItemSet& rSet) SetMetric(*m_pSizeHeightField, aMetric); // Install handlers - Link<> aLk = LINK(this, SwEnvFormatPage, ModifyHdl); + Link<SpinField&,void> aLk = LINK(this, SwEnvFormatPage, ModifyHdl); m_pAddrLeftField->SetUpHdl( aLk ); m_pAddrTopField->SetUpHdl( aLk ); m_pSendLeftField->SetUpHdl( aLk ); @@ -220,9 +220,9 @@ void SwEnvFormatPage::dispose() IMPL_LINK_TYPED( SwEnvFormatPage, LoseFocusHdl, Control&, rControl, void ) { - ModifyHdl(static_cast<Edit*>(&rControl)); + ModifyHdl(static_cast<SpinField&>(rControl)); } -IMPL_LINK( SwEnvFormatPage, ModifyHdl, Edit *, pEdit ) +IMPL_LINK_TYPED( SwEnvFormatPage, ModifyHdl, SpinField&, rEdit, void ) { long lWVal = static_cast< long >(GetFieldVal(*m_pSizeWidthField )); long lHVal = static_cast< long >(GetFieldVal(*m_pSizeHeightField)); @@ -230,7 +230,7 @@ IMPL_LINK( SwEnvFormatPage, ModifyHdl, Edit *, pEdit ) long lWidth = std::max(lWVal, lHVal); long lHeight = std::min(lWVal, lHVal); - if (pEdit == m_pSizeWidthField || pEdit == m_pSizeHeightField) + if (&rEdit == m_pSizeWidthField || &rEdit == m_pSizeHeightField) { long nRotatedWidth = lHeight; long nRotatedHeight = lWidth; @@ -255,7 +255,6 @@ IMPL_LINK( SwEnvFormatPage, ModifyHdl, Edit *, pEdit ) SetMinMax(); m_pPreview->Invalidate(); } - return 0; } IMPL_LINK_TYPED( SwEnvFormatPage, EditHdl, MenuButton *, pButton, void ) diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx index 5cb2ccdedb87..2abd1c2576fb 100644 --- a/sw/source/ui/envelp/envfmt.hxx +++ b/sw/source/ui/envelp/envfmt.hxx @@ -43,7 +43,7 @@ class SwEnvFormatPage : public SfxTabPage std::vector<sal_uInt16> aIDs; - DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK_TYPED( ModifyHdl, SpinField&, void ); DECL_LINK_TYPED( LoseFocusHdl, Control&, void ); DECL_LINK_TYPED( EditHdl, MenuButton *, void ); DECL_LINK_TYPED(FormatHdl, ListBox&, void); diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 2595b91ef741..73874e4ddfdb 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -672,7 +672,7 @@ VclPtr<SfxTabPage> SwColumnPage::Create(vcl::Window *pParent, const SfxItemSet * bool SwColumnPage::FillItemSet(SfxItemSet *rSet) { if(m_pCLNrEdt->HasChildPathFocus()) - m_pCLNrEdt->GetDownHdl().Call(m_pCLNrEdt); + m_pCLNrEdt->GetDownHdl().Call(*m_pCLNrEdt); // set in ItemSet setzen // the current settings are already present diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index bc3227de5030..d30e3edc58a3 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -95,7 +95,7 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet) SetExchangeSupport(); - Link<> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl); + Link<SpinField&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl); Link<Control&,void> aLk3 = LINK(this, SwWrapTabPage, RangeLoseFocusHdl); m_pLeftMarginED->SetUpHdl(aLk); m_pLeftMarginED->SetDownHdl(aLk); @@ -491,8 +491,8 @@ void SwWrapTabPage::ActivatePage(const SfxItemSet& rSet) m_pTopMarginED->SetMax(m_pTopMarginED->Normalize(nTop), FUNIT_TWIP); m_pBottomMarginED->SetMax(m_pBottomMarginED->Normalize(nBottom), FUNIT_TWIP); - RangeModifyHdl(m_pLeftMarginED); - RangeModifyHdl(m_pTopMarginED); + RangeModifyHdl(*m_pLeftMarginED); + RangeModifyHdl(*m_pTopMarginED); } const SwFormatSurround& rSurround = static_cast<const SwFormatSurround&>(rSet.Get(RES_SURROUND)); @@ -589,19 +589,20 @@ SfxTabPage::sfxpg SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet) // range check IMPL_LINK_TYPED( SwWrapTabPage, RangeLoseFocusHdl, Control&, rControl, void ) { - RangeModifyHdl( static_cast<MetricField*>(&rControl) ); + RangeModifyHdl( static_cast<SpinField&>(rControl) ); } -IMPL_LINK( SwWrapTabPage, RangeModifyHdl, MetricField*, pEdit ) +IMPL_LINK_TYPED( SwWrapTabPage, RangeModifyHdl, SpinField&, rSpin, void ) { - sal_Int64 nValue = pEdit->GetValue(); + MetricField& rEdit = static_cast<MetricField&>(rSpin); + sal_Int64 nValue = rEdit.GetValue(); MetricField *pOpposite = 0; - if (pEdit == m_pLeftMarginED) + if (&rEdit == m_pLeftMarginED) pOpposite = m_pRightMarginED; - else if (pEdit == m_pRightMarginED) + else if (&rEdit == m_pRightMarginED) pOpposite = m_pLeftMarginED; - else if (pEdit == m_pTopMarginED) + else if (&rEdit == m_pTopMarginED) pOpposite = m_pBottomMarginED; - else if (pEdit == m_pBottomMarginED) + else if (&rEdit == m_pBottomMarginED) pOpposite = m_pTopMarginED; OSL_ASSERT(pOpposite); @@ -610,10 +611,9 @@ IMPL_LINK( SwWrapTabPage, RangeModifyHdl, MetricField*, pEdit ) { sal_Int64 nOpposite = pOpposite->GetValue(); - if (nValue + nOpposite > std::max(pEdit->GetMax(), pOpposite->GetMax())) + if (nValue + nOpposite > std::max(rEdit.GetMax(), pOpposite->GetMax())) pOpposite->SetValue(pOpposite->GetMax() - nValue); } - return 0; } IMPL_LINK_TYPED( SwWrapTabPage, WrapTypeHdl, Button *, pBtn, void ) diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 46708058d1e2..569b42efa367 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -115,7 +115,7 @@ SwNumPositionTabPage::SwNumPositionTabPage(vcl::Window* pParent, m_pAlign2LB->SetDropDownLineCount( m_pAlign2LB->GetEntryCount() ); m_pAlign2FT->SetText( m_pAlignFT->GetText() ); - Link<> aLk = LINK(this, SwNumPositionTabPage, DistanceHdl); + Link<SpinField&,void> aLk = LINK(this, SwNumPositionTabPage, DistanceHdl); Link<Control&,void> aLk2 = LINK(this, SwNumPositionTabPage, DistanceLoseFocusHdl); m_pDistBorderMF->SetUpHdl(aLk); m_pDistNumMF->SetUpHdl(aLk); @@ -660,20 +660,21 @@ IMPL_LINK_TYPED( SwNumPositionTabPage, LevelHdl, ListBox&, rBox, void ) IMPL_LINK_TYPED( SwNumPositionTabPage, DistanceLoseFocusHdl, Control&, rControl, void ) { - DistanceHdl(static_cast<MetricField*>(&rControl)); + DistanceHdl(static_cast<SpinField&>(rControl)); } -IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pField ) +IMPL_LINK_TYPED( SwNumPositionTabPage, DistanceHdl, SpinField&, rSpin, void ) { if(bInInintControl) - return 0; - long nValue = static_cast< long >(pField->Denormalize(pField->GetValue(FUNIT_TWIP))); + return; + MetricField& rField = static_cast<MetricField&>(rSpin); + long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < MAXLEVEL; i++) { if(nActNumLvl & nMask) { SwNumFormat aNumFormat( pActNum->Get( i ) ); - if(pField == m_pDistBorderMF) + if(&rField == m_pDistBorderMF) { if(m_pRelativeCB->IsChecked() && m_pRelativeCB->IsEnabled()) @@ -697,11 +698,11 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pField ) aNumFormat.SetAbsLSpace( (short)nValue - aNumFormat.GetFirstLineOffset()); } } - else if (pField == m_pDistNumMF) + else if (&rField == m_pDistNumMF) { aNumFormat.SetCharTextDistance( nValue ); } - else if (pField == m_pIndentMF) + else if (&rField == m_pIndentMF) { // now AbsLSpace also has to be modified by FirstLineOffset long nDiff = nValue + aNumFormat.GetFirstLineOffset(); @@ -718,8 +719,6 @@ IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pField ) SetModified(); if(!m_pDistBorderMF->IsEnabled()) m_pDistBorderMF->SetText(aEmptyOUStr); - - return 0; } IMPL_LINK_TYPED( SwNumPositionTabPage, RelativeHdl, Button *, pBox, void ) @@ -819,10 +818,11 @@ IMPL_LINK_NOARG_TYPED(SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox&, v SetModified(); } -IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pField ) +IMPL_LINK_TYPED( SwNumPositionTabPage, ListtabPosHdl_Impl, SpinField&, rSpin, void ) { + MetricField& rField = static_cast<MetricField&>(rSpin); // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(pField->Denormalize(pField->GetValue(FUNIT_TWIP))); + const long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -838,14 +838,13 @@ IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pField ) } SetModified(); - - return 0; } -IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pField ) +IMPL_LINK_TYPED( SwNumPositionTabPage, AlignAtHdl_Impl, SpinField&, rSpin, void ) { + MetricField& rField = static_cast<MetricField&>(rSpin); // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(pField->Denormalize(pField->GetValue(FUNIT_TWIP))); + const long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -862,14 +861,13 @@ IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pField ) } SetModified(); - - return 0; } -IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pField ) +IMPL_LINK_TYPED( SwNumPositionTabPage, IndentAtHdl_Impl, SpinField&, rSpin, void ) { + MetricField& rField = static_cast<MetricField&>(rSpin); // determine value to be set at the chosen list levels - const long nValue = static_cast< long >(pField->Denormalize(pField->GetValue(FUNIT_TWIP))); + const long nValue = static_cast< long >(rField.Denormalize(rField.GetValue(FUNIT_TWIP))); // set value at the chosen list levels sal_uInt16 nMask = 1; @@ -889,8 +887,6 @@ IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pField ) } SetModified(); - - return 0; } IMPL_LINK_NOARG_TYPED(SwNumPositionTabPage, StandardHdl, Button*, void) diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index b607f3567d7f..6c3e70d16617 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -76,7 +76,7 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : get(m_pPrintCB,"checkCB_PRINT"); get(m_pColorLB,"listLB_COLOR"); - Link<> aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl); + Link<SpinField&,void> aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl); Link<Control&,void> aLink2 = LINK(this, SwTextGridPage, CharorLineLoseFocusdHdl); m_pCharsPerLineNF->SetUpHdl(aLink); m_pCharsPerLineNF->SetDownHdl(aLink); @@ -85,7 +85,7 @@ SwTextGridPage::SwTextGridPage(vcl::Window *pParent, const SfxItemSet &rSet) : m_pLinesPerPageNF->SetDownHdl(aLink); m_pLinesPerPageNF->SetLoseFocusHdl(aLink2); - Link<> aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl); + Link<SpinField&,void> aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl); Link<Control&,void> aSizeLink2 = LINK(this, SwTextGridPage, TextSizeLoseFocusHdl); m_pTextSizeMF->SetUpHdl(aSizeLink); m_pTextSizeMF->SetDownHdl(aSizeLink); @@ -389,14 +389,14 @@ const sal_uInt16* SwTextGridPage::GetRanges() IMPL_LINK_TYPED(SwTextGridPage, CharorLineLoseFocusdHdl, Control&, rControl, void) { - CharorLineChangedHdl(static_cast<SpinField*>(&rControl)); + CharorLineChangedHdl(static_cast<SpinField&>(rControl)); } -IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField) +IMPL_LINK_TYPED(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void) { //if in squared mode if ( m_bSquaredMode ) { - if(m_pCharsPerLineNF == pField) + if(m_pCharsPerLineNF == &rField) { long nWidth = (long)(m_aPageSize.Width() / m_pCharsPerLineNF->GetValue()); m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(nWidth), FUNIT_TWIP); @@ -413,11 +413,11 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField) m_pLinesPerPageNF->SetMax(nMaxLines); } SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); - SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); + SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); } else//in normal mode { - if(m_pLinesPerPageNF == pField) + if(m_pLinesPerPageNF == &rField) { long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / m_pLinesPerPageNF->GetValue()); m_pTextSizeMF->SetValue(m_pTextSizeMF->Normalize(nHeight), FUNIT_TWIP); @@ -427,7 +427,7 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField) m_nRubyUserValue = nHeight; m_bRubyUserValue = true; } - else if (m_pCharsPerLineNF == pField) + else if (m_pCharsPerLineNF == &rField) { long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / m_pCharsPerLineNF->GetValue()); m_pCharWidthMF->SetValue(m_pCharWidthMF->Normalize(nWidth), FUNIT_TWIP); @@ -435,19 +435,18 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField) } } GridModifyHdl(*m_pColorLB); - return 0; } IMPL_LINK_TYPED(SwTextGridPage, TextSizeLoseFocusHdl, Control&, rControl, void) { - TextSizeChangedHdl(static_cast<SpinField*>(&rControl)); + TextSizeChangedHdl(static_cast<SpinField&>(rControl)); } -IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) +IMPL_LINK_TYPED(SwTextGridPage, TextSizeChangedHdl, SpinField&, rField, void) { //if in squared mode if( m_bSquaredMode ) { - if (m_pTextSizeMF == pField) + if (m_pTextSizeMF == &rField) { m_bRubyUserValue = false; @@ -472,14 +471,14 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) } else { - if (m_pTextSizeMF == pField) + if (m_pTextSizeMF == &rField) { sal_Int32 nTextSize = static_cast< sal_Int32 >(m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP))); m_pLinesPerPageNF->SetValue(m_aPageSize.Height() / nTextSize); m_bRubyUserValue = false; SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() ); } - else if (m_pCharWidthMF == pField) + else if (m_pCharWidthMF == &rField) { sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_pCharWidthMF->Denormalize(m_pCharWidthMF->GetValue(FUNIT_TWIP))); sal_Int32 nMaxChar = 45 ; @@ -491,7 +490,6 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) //rubySize is disabled } GridModifyHdl(*m_pColorLB); - return 0; } IMPL_LINK_TYPED(SwTextGridPage, GridTypeHdl, Button*, pButton, void) diff --git a/sw/source/ui/misc/titlepage.cxx b/sw/source/ui/misc/titlepage.cxx index fd432e1e4167..2ebdd8725fd3 100644 --- a/sw/source/ui/misc/titlepage.cxx +++ b/sw/source/ui/misc/titlepage.cxx @@ -236,18 +236,16 @@ SwTitlePageDlg::SwTitlePageDlg( vcl::Window *pParent ) : m_pPagePropertiesPB->SetClickHdl(LINK(this, SwTitlePageDlg, EditHdl)); } -IMPL_LINK_NOARG(SwTitlePageDlg, UpHdl) +IMPL_LINK_NOARG_TYPED(SwTitlePageDlg, UpHdl, SpinField&, void) { if (m_pPageCountNF->GetValue() == 2) FillList(); - return 0; } -IMPL_LINK_NOARG(SwTitlePageDlg, DownHdl) +IMPL_LINK_NOARG_TYPED(SwTitlePageDlg, DownHdl, SpinField&, void) { if (m_pPageCountNF->GetValue() == 1) FillList(); - return 0; } IMPL_LINK_NOARG_TYPED(SwTitlePageDlg, RestartNumberingHdl, Button*, void) diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 6402a7dd382d..ed324912bd68 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -145,7 +145,7 @@ void SwFormatTablePage::Init() m_pRightBtn->SetClickHdl( aLk2 ); m_pCenterBtn->SetClickHdl( aLk2 ); - Link<> aLk = LINK( this, SwFormatTablePage, UpDownHdl ); + Link<SpinField&,void> aLk = LINK( this, SwFormatTablePage, UpDownHdl ); m_pTopMF->SetUpHdl( aLk ); m_pBottomMF->SetUpHdl( aLk ); m_aRightMF.SetUpHdl( aLk ); @@ -286,19 +286,17 @@ void SwFormatTablePage::RightModify() IMPL_LINK_TYPED( SwFormatTablePage, LoseFocusHdl, Control&, rControl, void ) { - UpDownHdl(static_cast<MetricField*>(&rControl)); + UpDownHdl(static_cast<SpinField&>(rControl)); } -IMPL_LINK( SwFormatTablePage, UpDownHdl, MetricField *, pEdit ) +IMPL_LINK_TYPED( SwFormatTablePage, UpDownHdl, SpinField&, rEdit, void ) { - if( m_aRightMF.get() == pEdit) + if( m_aRightMF.get() == &rEdit) RightModify(); - ModifyHdl( pEdit ); - return 0; + ModifyHdl( &rEdit ); } void SwFormatTablePage::ModifyHdl(const Edit * pEdit) { - SwTwips nCurWidth = static_cast< SwTwips >(m_aWidthMF.DenormalizePercent(m_aWidthMF.GetValue( FUNIT_TWIP ))); SwTwips nPrevWidth = nCurWidth; SwTwips nRight = static_cast< SwTwips >(m_aRightMF.DenormalizePercent(m_aRightMF.GetValue( FUNIT_TWIP ))); @@ -848,8 +846,8 @@ void SwTableColumnPage::Reset( const SfxItemSet* ) void SwTableColumnPage::Init(bool bWeb) { FieldUnit aMetric = ::GetDfltMetric(bWeb); - Link<> aLkUp = LINK( this, SwTableColumnPage, UpHdl ); - Link<> aLkDown = LINK( this, SwTableColumnPage, DownHdl ); + Link<SpinField&,void> aLkUp = LINK( this, SwTableColumnPage, UpHdl ); + Link<SpinField&,void> aLkDown = LINK( this, SwTableColumnPage, DownHdl ); Link<Control&,void> aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl ); for( sal_uInt16 i = 0; i < MET_FIELDS; i++ ) { @@ -907,18 +905,16 @@ IMPL_LINK_TYPED( SwTableColumnPage, AutoClickHdl, Button*, pControl, void ) UpdateCols(0); } -IMPL_LINK( SwTableColumnPage, UpHdl, MetricField*, pEdit ) +IMPL_LINK_TYPED( SwTableColumnPage, UpHdl, SpinField&, rEdit, void ) { bModified = true; - ModifyHdl( pEdit ); - return 0; + ModifyHdl( static_cast<MetricField*>(&rEdit) ); } -IMPL_LINK( SwTableColumnPage, DownHdl, MetricField*, pEdit ) +IMPL_LINK_TYPED( SwTableColumnPage, DownHdl, SpinField&, rEdit, void ) { bModified = true; - ModifyHdl( pEdit ); - return 0; + ModifyHdl( static_cast<MetricField*>(&rEdit) ); } IMPL_LINK_TYPED( SwTableColumnPage, LoseFocusHdl, Control&, rControl, void ) diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 1bfca38237d5..b2d07e8a24b6 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -40,6 +40,7 @@ class SfxObjectShellLock; class SfxChildWindowContext; class SwNavigationPI; enum class RegionMode; +class SpinField; class SwNavHelpToolBox : public SwHelpToolBox { @@ -110,7 +111,7 @@ class SwNavigationPI : public vcl::Window, DECL_LINK_TYPED( DoneLink, SfxPoolItem *, void ); DECL_LINK_TYPED( MenuSelectHdl, Menu *, bool ); DECL_LINK_TYPED( ChangePageHdl, Idle*, void ); - DECL_LINK( PageEditModifyHdl, void* ); + DECL_LINK_TYPED( PageEditModifyHdl, SpinField&, void ); DECL_LINK_TYPED( PopupModeEndHdl, FloatingWindow*, void ); DECL_LINK_TYPED( ClosePopupWindow, SfxPopupWindow *, void ); void UsePage(SwWrtShell *); diff --git a/sw/source/uibase/inc/num.hxx b/sw/source/uibase/inc/num.hxx index c957abf8aed3..de8d9e5618c0 100644 --- a/sw/source/uibase/inc/num.hxx +++ b/sw/source/uibase/inc/num.hxx @@ -93,7 +93,7 @@ class SwNumPositionTabPage : public SfxTabPage DECL_LINK_TYPED( LevelHdl, ListBox&, void ); DECL_LINK_TYPED(EditModifyHdl, ListBox&, void); - DECL_LINK( DistanceHdl, MetricField * ); + DECL_LINK_TYPED( DistanceHdl, SpinField&, void ); DECL_LINK_TYPED( DistanceLoseFocusHdl, Control&, void ); DECL_LINK_TYPED( RelativeHdl, Button*, void ); DECL_LINK_TYPED(StandardHdl, Button*, void); @@ -102,9 +102,9 @@ class SwNumPositionTabPage : public SfxTabPage void ShowControlsDependingOnPosAndSpaceMode(); DECL_LINK_TYPED(LabelFollowedByHdl_Impl, ListBox&, void); - DECL_LINK( ListtabPosHdl_Impl, MetricField* ); - DECL_LINK( AlignAtHdl_Impl, MetricField* ); - DECL_LINK( IndentAtHdl_Impl, MetricField* ); + DECL_LINK_TYPED( ListtabPosHdl_Impl, SpinField&, void ); + DECL_LINK_TYPED( AlignAtHdl_Impl, SpinField&, void ); + DECL_LINK_TYPED( IndentAtHdl_Impl, SpinField&, void ); using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx index 7180ad473587..56ef67b36131 100644 --- a/sw/source/uibase/inc/pggrid.hxx +++ b/sw/source/uibase/inc/pggrid.hxx @@ -72,9 +72,9 @@ class SwTextGridPage: public SfxTabPage static void SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue ); DECL_LINK_TYPED(GridTypeHdl, Button*, void); - DECL_LINK(CharorLineChangedHdl, SpinField*); + DECL_LINK_TYPED(CharorLineChangedHdl, SpinField&, void); DECL_LINK_TYPED(CharorLineLoseFocusdHdl, Control&, void); - DECL_LINK(TextSizeChangedHdl, SpinField*); + DECL_LINK_TYPED(TextSizeChangedHdl, SpinField&, void); DECL_LINK_TYPED(TextSizeLoseFocusHdl, Control&, void); DECL_LINK_TYPED(GridModifyHdl, ListBox&, void); DECL_LINK_TYPED(GridModifyClickHdl, Button*, void); diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index 0858add6d23b..57fc65b0b472 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -48,8 +48,8 @@ public: void set(MetricField *pField); const MetricField* get() const { return m_pField; } MetricField* get() { return m_pField; } - void SetUpHdl(const Link<>& rLink) { m_pField->SetUpHdl(rLink); } - void SetDownHdl(const Link<>& rLink) { m_pField->SetDownHdl(rLink); } + void SetUpHdl(const Link<SpinField&,void>& rLink) { m_pField->SetUpHdl(rLink); } + void SetDownHdl(const Link<SpinField&,void>& rLink) { m_pField->SetDownHdl(rLink); } void SetModifyHdl(const Link<>& rLink) { m_pField->SetModifyHdl(rLink); } void SetLoseFocusHdl(const Link<Control&,void>& rLink) { m_pField->SetLoseFocusHdl(rLink); } void SetMetric(FieldUnit eUnit) { ::SetMetric(*m_pField, eUnit); } diff --git a/sw/source/uibase/inc/titlepage.hxx b/sw/source/uibase/inc/titlepage.hxx index 370fce92670b..cf20e03607c2 100644 --- a/sw/source/uibase/inc/titlepage.hxx +++ b/sw/source/uibase/inc/titlepage.hxx @@ -57,8 +57,8 @@ private: DECL_LINK_TYPED(EditHdl, Button*, void); DECL_LINK_TYPED(RestartNumberingHdl, Button*, void); DECL_LINK_TYPED(SetPageNumberHdl, Button*, void); - DECL_LINK(UpHdl, void *); - DECL_LINK(DownHdl, void *); + DECL_LINK_TYPED(UpHdl, SpinField&, void); + DECL_LINK_TYPED(DownHdl, SpinField&, void); DECL_LINK_TYPED(StartPageHdl, Button*, void); public: SwTitlePageDlg( vcl::Window *pParent ); diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx index 0bd251d83c23..17c2cb714c1c 100644 --- a/sw/source/uibase/inc/wrap.hxx +++ b/sw/source/uibase/inc/wrap.hxx @@ -85,7 +85,7 @@ class SwWrapTabPage: public SfxTabPage virtual sfxpg DeactivatePage(SfxItemSet *pSet) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - DECL_LINK( RangeModifyHdl, MetricField * ); + DECL_LINK_TYPED( RangeModifyHdl, SpinField&, void ); DECL_LINK_TYPED( RangeLoseFocusHdl, Control&, void ); DECL_LINK_TYPED( WrapTypeHdl, Button *, void ); DECL_LINK_TYPED( ContourHdl, Button *, void); diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index e947e2c82d6c..f28c524af776 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -74,7 +74,7 @@ class SwFormatTablePage : public SfxTabPage DECL_LINK_TYPED( AutoClickHdl, Button*, void ); DECL_LINK_TYPED( RelWidthClickHdl, Button*, void ); void RightModify(); - DECL_LINK( UpDownHdl, MetricField * ); + DECL_LINK_TYPED( UpDownHdl, SpinField&, void ); DECL_LINK_TYPED( LoseFocusHdl, Control&, void ); using TabPage::ActivatePage; @@ -120,8 +120,8 @@ class SwTableColumnPage : public SfxTabPage void Init(bool bWeb); DECL_LINK_TYPED( AutoClickHdl, Button *, void ); void ModifyHdl( MetricField* pEdit ); - DECL_LINK( UpHdl, MetricField * ); - DECL_LINK( DownHdl, MetricField * ); + DECL_LINK_TYPED( UpHdl, SpinField&, void ); + DECL_LINK_TYPED( DownHdl, SpinField&, void ); DECL_LINK_TYPED( LoseFocusHdl, Control&, void ); DECL_LINK_TYPED( ModeHdl, Button *, void ); void UpdateCols( sal_uInt16 nAktPos ); diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 9d8eb3aa118c..b4997d00096a 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -1256,12 +1256,11 @@ IMPL_LINK_NOARG_TYPED(SwNavigationPI, ChangePageHdl, Idle *, void) } } -IMPL_LINK_NOARG(SwNavigationPI, PageEditModifyHdl) +IMPL_LINK_NOARG_TYPED(SwNavigationPI, PageEditModifyHdl, SpinField&, void) { if(aPageChgIdle.IsActive()) aPageChgIdle.Stop(); aPageChgIdle.Start(); - return 0; } SwView* SwNavigationPI::GetCreateView() const diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index 62a331c73adf..dd95df121deb 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -842,13 +842,18 @@ void Slider::ImplSetFieldLink(const Link<>& rLink) if (mpLinkedField != nullptr) { mpLinkedField->SetModifyHdl(rLink); - mpLinkedField->SetUpHdl(rLink); - mpLinkedField->SetDownHdl(rLink); - mpLinkedField->SetFirstHdl(rLink); - mpLinkedField->SetLastHdl(rLink); + mpLinkedField->SetUpHdl(LINK(this, Slider, LinkedFieldSpinnerHdl)); + mpLinkedField->SetDownHdl(LINK(this, Slider, LinkedFieldSpinnerHdl)); + mpLinkedField->SetFirstHdl(LINK(this, Slider, LinkedFieldSpinnerHdl)); + mpLinkedField->SetLastHdl(LINK(this, Slider, LinkedFieldSpinnerHdl)); } } +IMPL_LINK_NOARG_TYPED(Slider, LinkedFieldSpinnerHdl, SpinField&, void) +{ + if (mpLinkedField) + mpLinkedField->GetModifyHdl().Call(&mpLinkedField); +} IMPL_LINK_NOARG_TYPED(Slider, LinkedFieldLoseFocusHdl, Control&, void) { if (mpLinkedField) diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 1eb0fa39bf8d..b541b341c500 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -383,22 +383,22 @@ void SpinField::dispose() void SpinField::Up() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, [this] () { maUpHdlLink.Call(this); } ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_UP, [this] () { maUpHdlLink.Call(*this); } ); } void SpinField::Down() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, [this] () { maDownHdlLink.Call(this); } ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_DOWN, [this] () { maDownHdlLink.Call(*this); } ); } void SpinField::First() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST, [this] () { maFirstHdlLink.Call(this); } ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_FIRST, [this] () { maFirstHdlLink.Call(*this); } ); } void SpinField::Last() { - ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, [this] () { maLastHdlLink.Call(this); } ); + ImplCallEventListenersAndHandler( VCLEVENT_SPINFIELD_LAST, [this] () { maLastHdlLink.Call(*this); } ); } void SpinField::MouseButtonDown( const MouseEvent& rMEvt ) |