summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-09 15:57:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-10-09 16:41:56 +0100
commitae326faf5a5f4c9c078e914cb0e3adfcc04674df (patch)
treeadae8f85b03f3376d1a2a9d242d9d311c52a71f6 /vcl
parentconvert graphic export dialog to .ui (diff)
downloadcore-ae326faf5a5f4c9c078e914cb0e3adfcc04674df.tar.gz
core-ae326faf5a5f4c9c078e914cb0e3adfcc04674df.zip
clip numeric formatter max width
Change-Id: I2211d63a7bbe564a9ed586dabc33399eb8aa6183
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/field.cxx10
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;
}
}