diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-09 15:57:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-09 16:41:56 +0100 |
commit | ae326faf5a5f4c9c078e914cb0e3adfcc04674df (patch) | |
tree | adae8f85b03f3376d1a2a9d242d9d311c52a71f6 /vcl | |
parent | f6b67d95d9b41a773189e445d0108c320d71e000 (diff) |
clip numeric formatter max width
Change-Id: I2211d63a7bbe564a9ed586dabc33399eb8aa6183
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/field.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 3548f611c80a..9474761969e5 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -962,6 +962,16 @@ namespace Size aRet(std::max(aMinTextSize.Width(), aMaxTextSize.Width()), std::max(aMinTextSize.Height(), aMaxTextSize.Height())); + OUStringBuffer sBuf("999999999"); + sal_uInt16 nDigits = rFormatter.GetDecimalDigits(); + if (nDigits) + { + sBuf.append('.'); + comphelper::string::padToLength(aBuf, aBuf.getLength() + nDigits, '9'); + } + aMaxTextSize = rSpinField.CalcMinimumSizeForText(sBuf.makeStringAndClear()); + aRet.Width() = std::min(aRet.Width(), aMaxTextSize.Width()); + return aRet; } } |