sc/source/ui/docshell/docsh.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit fb754a0df859e30255c25af8fa19bfaa75f257e7 Author: Caolán McNamara <caol...@redhat.com> Date: Mon Nov 14 12:19:09 2011 +0000 original would unconditionally truncate to nLen diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 4a0981d..65fccaa 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1612,10 +1612,17 @@ void lcl_ScDocShell_GetFixedWidthString( rtl::OUString& rStr, const ScDocument& rtl::OUString aString = rStr; sal_Int32 nLen = lcl_ScDocShell_GetColWidthInChars( rDoc.GetColWidth( nCol, nTab ) ); + //If the text won't fit in the column if ( nLen < aString.getLength() ) { - if ( bValue ) - aString = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "###" )); + rtl::OUStringBuffer aReplacement; + if (bValue) + aReplacement.appendAscii(RTL_CONSTASCII_STRINGPARAM("###")); + else + aReplacement.append(aString); + //truncate to the number of characters that should fit, even in the + //bValue case nLen might be < len ### + aString = comphelper::string::truncateToLength(aReplacement, nLen).makeStringAndClear(); } if ( nLen > aString.getLength() ) {
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits