diff options
-rw-r--r-- | include/vcl/field.hxx | 1 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx index 546b1c9704ab..35648a839639 100644 --- a/include/vcl/field.hxx +++ b/include/vcl/field.hxx @@ -154,6 +154,7 @@ protected: sal_uInt16 mnDecimalDigits; bool mbThousandSep; bool mbShowTrailingZeros; + bool mbWrapOnLimits; // the members below are used in all derivatives of NumericFormatter // not in NumericFormatter itself. 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; |