diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-22 10:35:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-22 20:08:10 +0100 |
commit | 12e788f1102d15df9af311c77df77d64263d22fc (patch) | |
tree | 8715f86e9b31732b5cc43cac11ed493a2e7e8165 /sw | |
parent | 054dac27e0b33789bbb3ca444ae22ab4b157f998 (diff) |
Resolves: tdf#114572 immediate update of value while typing unwanted
Revert "connect to modified instead of up/down/focus-lost"
This reverts commit 44bfe8fad4f7c263dc713a65fb2ab0e2f9afcf99
Revert "listening to modify is sufficient to get all changes"
This reverts commit 5c0bb1088a678d36309866c4eee43e58901f6b7b
we probably need to distinguish a modify vs update signal to
get what I wanted here. Back to the original mode for now.
Change-Id: I51ebfc96b3a06cf09905f4a311d526f23ce371f1
Reviewed-on: https://gerrit.libreoffice.org/46958
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/frmdlg/wrap.cxx | 29 | ||||
-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/inc/wrap.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/table/tablepg.hxx | 7 |
5 files changed, 92 insertions, 22 deletions
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx index 5a9db97e8cee..21f07d980816 100644 --- a/sw/source/ui/frmdlg/wrap.cxx +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -90,11 +90,23 @@ SwWrapTabPage::SwWrapTabPage(vcl::Window *pParent, const SfxItemSet &rSet) SetExchangeSupport(); - Link<Edit&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl); - m_pLeftMarginED->SetModifyHdl(aLk); - m_pRightMarginED->SetModifyHdl(aLk); - m_pTopMarginED->SetModifyHdl(aLk); - m_pBottomMarginED->SetModifyHdl(aLk); + Link<SpinField&,void> aLk = LINK(this, SwWrapTabPage, RangeModifyHdl); + Link<Control&,void> aLk3 = LINK(this, SwWrapTabPage, RangeLoseFocusHdl); + m_pLeftMarginED->SetUpHdl(aLk); + m_pLeftMarginED->SetDownHdl(aLk); + m_pLeftMarginED->SetLoseFocusHdl(aLk3); + + m_pRightMarginED->SetUpHdl(aLk); + m_pRightMarginED->SetDownHdl(aLk); + m_pRightMarginED->SetLoseFocusHdl(aLk3); + + m_pTopMarginED->SetUpHdl(aLk); + m_pTopMarginED->SetDownHdl(aLk); + m_pTopMarginED->SetLoseFocusHdl(aLk3); + + m_pBottomMarginED->SetUpHdl(aLk); + m_pBottomMarginED->SetDownHdl(aLk); + m_pBottomMarginED->SetLoseFocusHdl(aLk3); Link<Button*,void> aLk2 = LINK(this, SwWrapTabPage, WrapTypeHdl); m_pNoWrapRB->SetClickHdl(aLk2); @@ -552,7 +564,12 @@ DeactivateRC SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet) return DeactivateRC::LeavePage; } -IMPL_LINK( SwWrapTabPage, RangeModifyHdl, Edit&, rSpin, void ) +// range check +IMPL_LINK( SwWrapTabPage, RangeLoseFocusHdl, Control&, rControl, void ) +{ + RangeModifyHdl( static_cast<SpinField&>(rControl) ); +} +IMPL_LINK( SwWrapTabPage, RangeModifyHdl, SpinField&, rSpin, void ) { MetricField& rEdit = static_cast<MetricField&>(rSpin); sal_Int64 nValue = rEdit.GetValue(); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 366e42f01fed..60a181468fef 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -149,12 +149,25 @@ void SwFormatTablePage::Init() m_pRightBtn->SetClickHdl( aLk2 ); m_pCenterBtn->SetClickHdl( aLk2 ); - 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); + 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 ); m_pRelWidthCB->SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl )); } @@ -275,7 +288,11 @@ void SwFormatTablePage::RightModify() } } -IMPL_LINK( SwFormatTablePage, UpDownHdl, Edit&, rEdit, void ) +IMPL_LINK( SwFormatTablePage, LoseFocusHdl, Control&, rControl, void ) +{ + UpDownHdl(static_cast<SpinField&>(rControl)); +} +IMPL_LINK( SwFormatTablePage, UpDownHdl, SpinField&, rEdit, void ) { if( m_aRightMF.get() == &rEdit) RightModify(); @@ -578,6 +595,7 @@ 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 ) @@ -832,12 +850,16 @@ void SwTableColumnPage::Reset( const SfxItemSet* ) void SwTableColumnPage::Init(bool bWeb) { FieldUnit aMetric = ::GetDfltMetric(bWeb); - Link<Edit&,void> aLkModify = LINK(this, SwTableColumnPage, ModifyHdl); + 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++ ) { aValueTable[i] = i; m_aFieldArr[i].SetMetric(aMetric); - m_aFieldArr[i].SetModifyHdl(aLkModify); + m_aFieldArr[i].SetUpHdl( aLkUp ); + m_aFieldArr[i].SetDownHdl( aLkDown ); + m_aFieldArr[i].SetLoseFocusHdl( aLkLF ); } SetMetric(*m_pSpaceED, aMetric); @@ -882,10 +904,26 @@ IMPL_LINK( SwTableColumnPage, AutoClickHdl, Button*, pControl, void ) UpdateCols(0); } -IMPL_LINK(SwTableColumnPage, ModifyHdl, Edit&, rEdit, void) +IMPL_LINK( SwTableColumnPage, UpHdl, SpinField&, rEdit, void ) +{ + bModified = true; + ModifyHdl( static_cast<MetricField*>(&rEdit) ); +} + +IMPL_LINK( SwTableColumnPage, DownHdl, SpinField&, rEdit, void ) { bModified = true; - ModifyHdl(static_cast<MetricField*>(&rEdit)); + 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 ); + } } IMPL_LINK( SwTableColumnPage, ModeHdl, Button*, pBox, void ) @@ -901,7 +939,16 @@ IMPL_LINK( SwTableColumnPage, ModeHdl, Button*, pBox, void ) bool SwTableColumnPage::FillItemSet( SfxItemSet* ) { - if (bModified) + for(PercentField & i : m_aFieldArr) + { + if (i.HasFocus()) + { + LoseFocusHdl(*i.get()); + break; + } + } + + if(bModified) { pTableData->SetColsChanged(); } diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx index d08d1f90c178..e28d7e2dd989 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 +//Wraps a MetricField with extra features, preferred to PercentField class SW_DLLPUBLIC PercentField { VclPtr<MetricField> m_pField; @@ -48,6 +48,8 @@ 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/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx index bbd4a0605b69..a2807b1e7bed 100644 --- a/sw/source/uibase/inc/wrap.hxx +++ b/sw/source/uibase/inc/wrap.hxx @@ -79,7 +79,8 @@ class SwWrapTabPage: public SfxTabPage virtual void ActivatePage(const SfxItemSet& rSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override; - DECL_LINK( RangeModifyHdl, Edit&, void ); + DECL_LINK( RangeModifyHdl, SpinField&, void ); + DECL_LINK( RangeLoseFocusHdl, Control&, void ); DECL_LINK( WrapTypeHdl, Button *, void ); DECL_LINK( ContourHdl, Button *, void); diff --git a/sw/source/uibase/table/tablepg.hxx b/sw/source/uibase/table/tablepg.hxx index 23fc72dca155..337fa3951ccb 100644 --- a/sw/source/uibase/table/tablepg.hxx +++ b/sw/source/uibase/table/tablepg.hxx @@ -74,7 +74,8 @@ class SwFormatTablePage : public SfxTabPage DECL_LINK( AutoClickHdl, Button*, void ); DECL_LINK( RelWidthClickHdl, Button*, void ); void RightModify(); - DECL_LINK( UpDownHdl, Edit&, void ); + DECL_LINK( UpDownHdl, SpinField&, void ); + DECL_LINK( LoseFocusHdl, Control&, void ); using TabPage::ActivatePage; using TabPage::DeactivatePage; @@ -119,7 +120,9 @@ class SwTableColumnPage : public SfxTabPage void Init(bool bWeb); DECL_LINK( AutoClickHdl, Button *, void ); void ModifyHdl( MetricField const * pEdit ); - DECL_LINK(ModifyHdl, Edit&, void); + DECL_LINK( UpHdl, SpinField&, void ); + DECL_LINK( DownHdl, SpinField&, void ); + DECL_LINK( LoseFocusHdl, Control&, void ); DECL_LINK( ModeHdl, Button *, void ); void UpdateCols( sal_uInt16 nAktPos ); SwTwips GetVisibleWidth(sal_uInt16 nPos); |