summaryrefslogtreecommitdiff
path: root/sw/source/ui/table
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-22 10:35:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-22 20:08:10 +0100
commit12e788f1102d15df9af311c77df77d64263d22fc (patch)
tree8715f86e9b31732b5cc43cac11ed493a2e7e8165 /sw/source/ui/table
parent054dac27e0b33789bbb3ca444ae22ab4b157f998 (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/source/ui/table')
-rw-r--r--sw/source/ui/table/tabledlg.cxx71
1 files changed, 59 insertions, 12 deletions
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();
}