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

Katarina Behrens bubli at bubli.org
Wed Oct 1 00:03:11 PDT 2014


 vcl/source/control/field.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit eb4811590c85895ce531674596bdd6afb3397725
Author: Katarina Behrens <bubli at bubli.org>
Date:   Wed Oct 1 08:59:41 2014 +0200

    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

diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index c475bd2..1749180 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;
 }
 


More information about the Libreoffice-commits mailing list