summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-07 11:34:30 +0000
committerMichael Stahl <mstahl@redhat.com>2015-01-07 16:37:39 +0000
commitfd1e2742c64e89954ac1431dd6b4e25cf2da7c29 (patch)
treee8f5c693fd7b32ded96e77241ebcad39649e264b
parentf977957097ed7383604468f9d7a78a822aaf72a9 (diff)
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@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/ui/frmdlg/column.cxx56
-rw-r--r--sw/source/uibase/inc/column.hxx2
2 files changed, 42 insertions, 16 deletions
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index f80a72107061..cb06115b82d2 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 d9b2397eb2cf..e3a6fd400e70 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();