diff options
author | Eike Rathke <erack@redhat.com> | 2013-10-10 17:16:00 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-10-10 17:17:58 +0200 |
commit | 68568d78093c37e5848a19d5eabee163117f7625 (patch) | |
tree | f107e81f6b83f1af49813050c518af1ae2b0e612 /sc | |
parent | 6ef291086aaaa4a6bb2d196d75826fef30dd58b8 (diff) |
fixed !!br0ken CSV import preview
Regression introduced with 24c079605645cf29ba366ca39b7c1177da8b317f
Previous String ctor accepted length > string length, whereas
OUString::copy() does not.
Change-Id: If51e6df4e236a59ab0302d2bb683ca8e6d148bd0
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/dbgui/csvgrid.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 2fdf462d6e19..bc3f4a23ba90 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -1152,15 +1152,16 @@ void ScCsvGrid::ImplDrawColumnBackgr( sal_uInt32 nColIndex ) // #i67432# cut string to avoid edit engine performance problems with very large strings sal_Int32 nFirstVisPos = ::std::max( GetColumnPos( nColIndex ), GetFirstVisPos() ); sal_Int32 nLastVisPos = ::std::min( GetColumnPos( nColIndex + 1 ), GetLastVisPos() ); - xub_StrLen nStrPos = static_cast< xub_StrLen >( nFirstVisPos - GetColumnPos( nColIndex ) ); - xub_StrLen nStrLen = static_cast< xub_StrLen >( nLastVisPos - nFirstVisPos + 1 ); + sal_Int32 nStrPos = nFirstVisPos - GetColumnPos( nColIndex ); + sal_Int32 nStrLen = nLastVisPos - nFirstVisPos + 1; sal_Int32 nStrX = GetX( nFirstVisPos ); for( size_t nLine = 0; nLine < nLineCount; ++nLine ) { StringVec& rStrVec = maTexts[ nLine ]; if( (nColIndex < rStrVec.size()) && (rStrVec[ nColIndex ].getLength() > nStrPos) ) { - OUString aText = rStrVec[ nColIndex ].copy( nStrPos, nStrLen ); + const OUString& rStr = rStrVec[ nColIndex ]; + OUString aText = rStr.copy( nStrPos, ::std::min( nStrLen, rStr.getLength()) - nStrPos ); ImplDrawCellText( Point( nStrX, GetY( GetFirstVisLine() + nLine ) ), aText ); } } |