[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source

Caolán McNamara caolanm at redhat.com
Wed Jan 7 08:38:10 PST 2015


 sw/source/ui/frmdlg/column.cxx  |   56 +++++++++++++++++++++++++++++-----------
 sw/source/uibase/inc/column.hxx |    2 -
 2 files changed, 42 insertions(+), 16 deletions(-)

New commits:
commit fd1e2742c64e89954ac1431dd6b4e25cf2da7c29
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 7 11:34:30 2015 +0000

    Resolves: fdo#87612 don't overwrite users input if the value is unchanged
    
    so you can enter values without them getting auto-expanded to their canonical
    form as you're typing them and having the insertion point jump to the start
    causing real confusion. But retain the improvement of fdo#61704 where the value
    is set when modified so clicking "ok" without leaving the field works as
    expected
    
    Change-Id: I786b53c2717e232b36e7cc95d99c98aa1f2cd44e
    Reviewed-on: https://gerrit.libreoffice.org/13791
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index f80a721..cb06115 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -815,7 +815,7 @@ void SwColumnPage::Init()
     }
 
     UpdateCols();
-    Update();
+    Update(NULL);
 
         // set maximum number of columns
         // values below 1 are not allowed
@@ -947,7 +947,7 @@ IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF )
         SetLabels( nFirstVis );
         UpdateCols();
         ResetColWidth();
-        Update();
+        Update(NULL);
     }
 
     return 0;
@@ -1022,7 +1022,7 @@ IMPL_LINK( SwColumnPage, GapModify, MetricField*, pMetricFld )
         }
 
     }
-    Update();
+    Update(pMetricFld);
     return 0;
 }
 
@@ -1050,7 +1050,7 @@ IMPL_LINK( SwColumnPage, AutoWidthHdl, CheckBox *, pBox )
     }
     pColMgr->SetAutoWidth(pBox->IsChecked(), sal_uInt16(nDist));
     UpdateCols();
-    Update();
+    Update(NULL);
     return 0;
 }
 
@@ -1061,7 +1061,7 @@ IMPL_LINK_NOARG(SwColumnPage, Up)
     {
         --nFirstVis;
         SetLabels( nFirstVis );
-        Update();
+        Update(NULL);
     }
     return 0;
 }
@@ -1073,7 +1073,7 @@ IMPL_LINK_NOARG(SwColumnPage, Down)
     {
         ++nFirstVis;
         SetLabels( nFirstVis );
-        Update();
+        Update(NULL);
     }
     return 0;
 }
@@ -1082,7 +1082,8 @@ IMPL_LINK_NOARG(SwColumnPage, Down)
 // an alteration of the column width or the column gap.
 void SwColumnPage::Timeout()
 {
-    if(pModifiedField)
+    PercentField *pField = pModifiedField;
+    if (pModifiedField)
     {
             // find the changed column
         sal_uInt16 nChanged = nFirstVis;
@@ -1118,22 +1119,47 @@ void SwColumnPage::Timeout()
         nColWidth[nChanged] = nNewWidth;
         pModifiedField = 0;
     }
-    Update();
+
+    Update(pField ? pField->get() : NULL);
 }
 
 // Update the view
-void SwColumnPage::Update()
+void SwColumnPage::Update(MetricField *pInteractiveField)
 {
     m_pBalanceColsCB->Enable(nCols > 1);
     if(nCols >= 2)
     {
-        aEd1.SetPrcntValue(aEd1.NormalizePercent(nColWidth[nFirstVis]), FUNIT_TWIP);
-        aDistEd1.SetPrcntValue(aDistEd1.NormalizePercent(nColDist[nFirstVis]), FUNIT_TWIP);
-        aEd2.SetPrcntValue(aEd2.NormalizePercent(nColWidth[nFirstVis + 1]), FUNIT_TWIP);
+        sal_Int64 nCurrentValue, nNewValue;
+
+        nCurrentValue = aEd1.NormalizePercent(aEd1.DenormalizePercent(aEd1.GetValue(FUNIT_TWIP)));
+        nNewValue = aEd1.NormalizePercent(nColWidth[nFirstVis]);
+
+        //fdo#87612 if we're interacting with this widget and the value will be the same
+        //then leave it alone (i.e. don't change equivalent values of e.g. .8 -> 0.8)
+        if (nNewValue != nCurrentValue || pInteractiveField != aEd1.get())
+            aEd1.SetPrcntValue(nNewValue, FUNIT_TWIP);
+
+        nCurrentValue = aDistEd1.NormalizePercent(aDistEd1.DenormalizePercent(aDistEd1.GetValue(FUNIT_TWIP)));
+        nNewValue = aDistEd1.NormalizePercent(nColDist[nFirstVis]);
+        if (nNewValue != nCurrentValue || pInteractiveField != aDistEd1.get())
+            aDistEd1.SetPrcntValue(nNewValue, FUNIT_TWIP);
+
+        nCurrentValue = aEd2.NormalizePercent(aEd2.DenormalizePercent(aEd2.GetValue(FUNIT_TWIP)));
+        nNewValue = aEd2.NormalizePercent(nColWidth[nFirstVis+1]);
+        if (nNewValue != nCurrentValue || pInteractiveField != aEd2.get())
+            aEd2.SetPrcntValue(nNewValue, FUNIT_TWIP);
+
         if(nCols >= 3)
         {
-            aDistEd2.SetPrcntValue(aDistEd2.NormalizePercent(nColDist[nFirstVis + 1]), FUNIT_TWIP);
-            aEd3.SetPrcntValue(aEd3.NormalizePercent(nColWidth[nFirstVis + 2]), FUNIT_TWIP);
+            nCurrentValue = aDistEd2.NormalizePercent(aDistEd2.DenormalizePercent(aDistEd2.GetValue(FUNIT_TWIP)));
+            nNewValue = aDistEd2.NormalizePercent(nColDist[nFirstVis+1]);
+            if (nNewValue != nCurrentValue || pInteractiveField != aDistEd2.get())
+                aDistEd2.SetPrcntValue(nNewValue, FUNIT_TWIP);
+
+            nCurrentValue = aEd3.NormalizePercent(aEd3.DenormalizePercent(aEd3.GetValue(FUNIT_TWIP)));
+            nNewValue = aEd3.NormalizePercent(nColWidth[nFirstVis+2]);
+            if (nNewValue != nCurrentValue || pInteractiveField != aEd3.get())
+                aEd3.SetPrcntValue(nNewValue, FUNIT_TWIP);
         }
         else
         {
@@ -1224,7 +1250,7 @@ void SwColumnPage::ActivatePage(const SfxItemSet& rSet)
         aDistEd1.SetMetricFieldMin(0);
         aDistEd2.SetMetricFieldMin(0);
     }
-    Update();
+    Update(NULL);
 }
 
 int SwColumnPage::DeactivatePage(SfxItemSet *_pSet)
diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx
index d9b2397..e3a6fd4 100644
--- a/sw/source/uibase/inc/column.hxx
+++ b/sw/source/uibase/inc/column.hxx
@@ -151,7 +151,7 @@ class SwColumnPage : public SfxTabPage
     void Apply(Button *);
     void Timeout();
 
-    void            Update();
+    void            Update(MetricField *pInteractiveField);
     void            UpdateCols();
     void            Init();
     void            ResetColWidth();


More information about the Libreoffice-commits mailing list