diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-13 21:02:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-09-14 14:40:25 +0200 |
commit | 44bfe8fad4f7c263dc713a65fb2ab0e2f9afcf99 (patch) | |
tree | 1a75093344dc2ee8e6d5bd7c21e3dd8dd4451596 /sw | |
parent | 34ac0f9a0376b43bcff78a49ccaf4caa34c8c990 (diff) |
connect to modified instead of up/down/focus-lost
Change-Id: Idfe3ebf1a3c6fd4baca693f0ec7e199b740d427a
Reviewed-on: https://gerrit.libreoffice.org/42271
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 71 | ||||
-rw-r--r-- | sw/source/uibase/inc/prcntfld.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/table/tablepg.hxx | 7 |
3 files changed, 15 insertions, 67 deletions
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index fc040fc2d51b..515e7b3945cf 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -143,25 +143,12 @@ void SwFormatTablePage::Init() m_pRightBtn->SetClickHdl( aLk2 ); m_pCenterBtn->SetClickHdl( aLk2 ); - Link<SpinField&,void> aLk = LINK( this, SwFormatTablePage, UpDownHdl ); - m_pTopMF->SetUpHdl( aLk ); - m_pBottomMF->SetUpHdl( aLk ); - m_aRightMF.SetUpHdl( aLk ); - m_aLeftMF.SetUpHdl( aLk ); - m_aWidthMF.SetUpHdl( aLk ); - - m_pTopMF->SetDownHdl( aLk ); - m_pBottomMF->SetDownHdl( aLk ); - m_aRightMF.SetDownHdl( aLk ); - m_aLeftMF.SetDownHdl( aLk ); - m_aWidthMF.SetDownHdl( aLk ); - - Link<Control&,void> aLk3 = LINK( this, SwFormatTablePage, LoseFocusHdl ); - m_pTopMF->SetLoseFocusHdl( aLk3 ); - m_pBottomMF->SetLoseFocusHdl( aLk3 ); - m_aRightMF.SetLoseFocusHdl( aLk3 ); - m_aLeftMF.SetLoseFocusHdl( aLk3 ); - m_aWidthMF.SetLoseFocusHdl( aLk3 ); + Link<Edit&, void> aLk = LINK(this, SwFormatTablePage, UpDownHdl); + m_pTopMF->SetModifyHdl(aLk); + m_pBottomMF->SetModifyHdl(aLk); + m_aRightMF.SetModifyHdl(aLk); + m_aLeftMF.SetModifyHdl(aLk); + m_aWidthMF.SetModifyHdl(aLk); m_pRelWidthCB->SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl )); } @@ -282,11 +269,7 @@ void SwFormatTablePage::RightModify() } } -IMPL_LINK( SwFormatTablePage, LoseFocusHdl, Control&, rControl, void ) -{ - UpDownHdl(static_cast<SpinField&>(rControl)); -} -IMPL_LINK( SwFormatTablePage, UpDownHdl, SpinField&, rEdit, void ) +IMPL_LINK( SwFormatTablePage, UpDownHdl, Edit&, rEdit, void ) { if( m_aRightMF.get() == &rEdit) RightModify(); @@ -589,7 +572,6 @@ void SwFormatTablePage::Reset( const SfxItemSet* ) m_aRightMF.SetMax( m_aRightMF.NormalizePercent( pTableData->GetSpace() ), FUNIT_TWIP ); m_aLeftMF.SetMax( m_aLeftMF.NormalizePercent( pTableData->GetSpace() ), FUNIT_TWIP ); m_aWidthMF.SetMin( m_aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP ); - } void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet ) @@ -844,16 +826,12 @@ void SwTableColumnPage::Reset( const SfxItemSet* ) void SwTableColumnPage::Init(bool bWeb) { FieldUnit aMetric = ::GetDfltMetric(bWeb); - Link<SpinField&,void> aLkUp = LINK( this, SwTableColumnPage, UpHdl ); - Link<SpinField&,void> aLkDown = LINK( this, SwTableColumnPage, DownHdl ); - Link<Control&,void> aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl ); + Link<Edit&,void> aLkModify = LINK(this, SwTableColumnPage, ModifyHdl); for( sal_uInt16 i = 0; i < MET_FIELDS; i++ ) { aValueTable[i] = i; m_aFieldArr[i].SetMetric(aMetric); - m_aFieldArr[i].SetUpHdl( aLkUp ); - m_aFieldArr[i].SetDownHdl( aLkDown ); - m_aFieldArr[i].SetLoseFocusHdl( aLkLF ); + m_aFieldArr[i].SetModifyHdl(aLkModify); } SetMetric(*m_pSpaceED, aMetric); @@ -898,26 +876,10 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, Button*, pControl, void ) UpdateCols(0); } -IMPL_LINK( SwTableColumnPage, UpHdl, SpinField&, rEdit, void ) -{ - bModified = true; - ModifyHdl( static_cast<MetricField*>(&rEdit) ); -} - -IMPL_LINK( SwTableColumnPage, DownHdl, SpinField&, rEdit, void ) +IMPL_LINK(SwTableColumnPage, ModifyHdl, Edit&, rEdit, void) { bModified = true; - ModifyHdl( static_cast<MetricField*>(&rEdit) ); -} - -IMPL_LINK( SwTableColumnPage, LoseFocusHdl, Control&, rControl, void ) -{ - MetricField* pEdit = static_cast<MetricField*>(&rControl); - if (pEdit->IsModified()) - { - bModified = true; - ModifyHdl( pEdit ); - } + ModifyHdl(static_cast<MetricField*>(&rEdit)); } IMPL_LINK( SwTableColumnPage, ModeHdl, Button*, pBox, void ) @@ -933,16 +895,7 @@ IMPL_LINK( SwTableColumnPage, ModeHdl, Button*, pBox, void ) bool SwTableColumnPage::FillItemSet( SfxItemSet* ) { - for(PercentField & i : m_aFieldArr) - { - if (i.HasFocus()) - { - LoseFocusHdl(*i.get()); - break; - } - } - - if(bModified) + if (bModified) { pTableData->SetColsChanged(); } diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index 044eb77fcfa6..a717370649a2 100644 --- a/sw/source/uibase/inc/prcntfld.hxx +++ b/sw/source/uibase/inc/prcntfld.hxx @@ -23,7 +23,7 @@ #include "swdllapi.h" #include "uitool.hxx" -//Wraps a MetricField with extra features, preferred to PercentField +//Wraps a MetricField with extra features class SW_DLLPUBLIC PercentField { VclPtr<MetricField> m_pField; @@ -48,8 +48,6 @@ public: void set(MetricField *pField); const MetricField* get() const { return m_pField; } MetricField* get() { return m_pField; } - 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<Edit&,void>& 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/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index 47180997d790..c7e4bd786800 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -73,8 +73,7 @@ class SwFormatTablePage : public SfxTabPage DECL_LINK( AutoClickHdl, Button*, void ); DECL_LINK( RelWidthClickHdl, Button*, void ); void RightModify(); - DECL_LINK( UpDownHdl, SpinField&, void ); - DECL_LINK( LoseFocusHdl, Control&, void ); + DECL_LINK( UpDownHdl, Edit&, void ); using TabPage::ActivatePage; using TabPage::DeactivatePage; @@ -119,9 +118,7 @@ class SwTableColumnPage : public SfxTabPage void Init(bool bWeb); DECL_LINK( AutoClickHdl, Button *, void ); void ModifyHdl( MetricField const * pEdit ); - DECL_LINK( UpHdl, SpinField&, void ); - DECL_LINK( DownHdl, SpinField&, void ); - DECL_LINK( LoseFocusHdl, Control&, void ); + DECL_LINK(ModifyHdl, Edit&, void); DECL_LINK( ModeHdl, Button *, void ); void UpdateCols( sal_uInt16 nAktPos ); SwTwips GetVisibleWidth(sal_uInt16 nPos); |