summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Behrens <bubli@bubli.org>2014-10-01 08:59:41 +0200
committerKatarina Behrens <bubli@bubli.org>2014-10-01 09:02:43 +0200
commiteb4811590c85895ce531674596bdd6afb3397725 (patch)
tree995158004e7b79ea0cd4cb158c67960555ed6397
parentd620629521aee48dc820b6970ca446c329d0b09a (diff)
Fallout fdo#83010: wrap on limits also in corner cases
e.g. when spin != 1 and min != 0 Copies the algorithm from now non-existent WrapField widget, it used to work there ... Change-Id: Id12f2565f10f272bec4e61737add9c197b674d3b
-rw-r--r--vcl/source/control/field.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index c475bd250d09..174918035b25 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -707,9 +707,11 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue )
sal_Int64 NumericFormatter::ClipAgainstMinMax(sal_Int64 nValue) const
{
if (nValue > mnMax)
- nValue = mbWrapOnLimits ? mnMin : mnMax;
+ nValue = mbWrapOnLimits ? ((nValue - mnMin) % (mnMax + 1)) + mnMin
+ : mnMax;
else if (nValue < mnMin)
- nValue = mbWrapOnLimits ? mnMax : mnMin;
+ nValue = mbWrapOnLimits ? ((nValue + mnMax + 1 - mnMin) % (mnMax + 1)) + mnMin
+ : mnMin;
return nValue;
}