summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-09-25 15:01:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-09-25 17:20:31 +0100
commitd61fc0b8946eba921d6b9c6d5fcd76fca83c85d7 (patch)
treecb165531577688522f1ff97e7c9f83a09cf7a080 /vcl/source/control
parente1a5ae3975dfa42003772f8afd98dde387d82653 (diff)
Related: fdo#83010 implement wrapping on reaching NumericFormatter limits
Change-Id: Ia88671cb71a0bcf8cb55ae0d88625b0f28092615
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/field.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 697238112eb4..c475bd250d09 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -447,6 +447,7 @@ void NumericFormatter::ImplInit()
mnType = FORMAT_NUMERIC;
mbThousandSep = true;
mbShowTrailingZeros = true;
+ mbWrapOnLimits = false;
// for fields
mnSpinSize = 1;
@@ -655,7 +656,7 @@ void NumericFormatter::FieldDown()
else
nValue = (nRemainder == 0) ? nValue - mnSpinSize : nValue - mnSpinSize - nRemainder;
- nValue = ClipAgainstMinMax(mnMin);
+ nValue = ClipAgainstMinMax(nValue);
ImplNewFieldValue( nValue );
}
@@ -706,9 +707,9 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
sal_Int64 NumericFormatter::ClipAgainstMinMax(sal_Int64 nValue) const
{
if (nValue > mnMax)
- nValue = mnMax;
+ nValue = mbWrapOnLimits ? mnMin : mnMax;
else if (nValue < mnMin)
- nValue = mnMin;
+ nValue = mbWrapOnLimits ? mnMax : mnMin;
return nValue;
}
@@ -739,6 +740,8 @@ bool NumericField::set_property(const OString &rKey, const OString &rValue)
SetDecimalDigits(rValue.toInt32());
else if (rKey == "spin-size")
SetSpinSize(rValue.toInt32());
+ else if (rKey == "wrap")
+ mbWrapOnLimits = toBool(rValue);
else
return SpinField::set_property(rKey, rValue);
return true;