summaryrefslogtreecommitdiff
path: root/sw/source/ui/table
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-28 15:14:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-28 20:28:32 +0200
commit04e5cc16c48b5eaf69cd275825b957a504904187 (patch)
treecce820ac463c238d2f917d6f8799ee0bfa88c5c5 /sw/source/ui/table
parentc4bee547b02fbe3d07b1e9ee203c73e48f86e6bf (diff)
tdf#135021 if the input width is changed, rerun the callbacks
if the widget triggering the change is the width widget and this callback sets a different value to the width widget, then rerun the callback using the width widget to end up in a state consistent with the width widget value. gtk already resends value-changed if the value of the widget changed during the callback so this ends up aligning the vcl behaviour to the gtk one which appears desirable in this case Change-Id: I32d0e1bb17190279efc552781851e5a18b417154 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99635 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui/table')
-rw-r--r--sw/source/ui/table/tabledlg.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 9844f96a2321..741dff825c85 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -299,7 +299,6 @@ void SwFormatTablePage::ModifyHdl(const weld::MetricSpinButton& rEdit)
nLeft = 0;
nCurWidth = pTableData->GetSpace();
}
-
}
}
//centered: change both sides equally
@@ -357,10 +356,22 @@ void SwFormatTablePage::ModifyHdl(const weld::MetricSpinButton& rEdit)
nCurWidth = pTableData->GetSpace() - nLeft - nRight;
}
}
- if (nCurWidth != nPrevWidth )
- m_xWidthMF->set_value( m_xWidthMF->NormalizePercent( nCurWidth ), FieldUnit::TWIP );
+
m_xRightMF->set_value( m_xRightMF->NormalizePercent( nRight ), FieldUnit::TWIP );
m_xLeftMF->set_value( m_xLeftMF->NormalizePercent( nLeft ), FieldUnit::TWIP );
+
+ if (nCurWidth != nPrevWidth )
+ {
+ m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(nCurWidth), FieldUnit::TWIP);
+
+ // tdf#135021 if the user changed the width spinbutton, and in this
+ // ModifyHdl we changed the value of that width spinbutton, then rerun
+ // the ModifyHdl on the replaced value so the left/right/width value
+ // relationships are consistent
+ if (&rEdit == m_xWidthMF->get())
+ ModifyHdl(rEdit);
+ }
+
bModified = true;
}