[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 28 18:29:13 UTC 2020


 sw/source/ui/table/tabledlg.cxx |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 04e5cc16c48b5eaf69cd275825b957a504904187
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 28 15:14:07 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 28 20:28:32 2020 +0200

    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 at redhat.com>

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;
 }
 


More information about the Libreoffice-commits mailing list