diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 15 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 05b8022118ed..f4ea98484c33 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -6841,7 +6841,20 @@ String OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice, c if ( nIndex != STRING_LEN ) { - if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) + if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS ) + { + String aTmpStr( aStr ); + xub_StrLen nEraseChars = 4; + while( nEraseChars < aStr.Len() && _rLayout.GetTextWidth( aTmpStr, 0, aTmpStr.Len() ) > nMaxWidth ) + { + aTmpStr = aStr; + xub_StrLen i = (aTmpStr.Len() - nEraseChars)/2; + aTmpStr.Erase( i, nEraseChars++ ); + aTmpStr.InsertAscii( "...", i ); + } + aStr = aTmpStr; + } + else if ( nStyle & TEXT_DRAW_ENDELLIPSIS ) { aStr.Erase( nIndex ); if ( nIndex > 1 ) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ceb9f12242c0..76bfd63036a0 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2587,7 +2587,7 @@ static String getShortenedString( const String& i_rLong, Window* i_pWin, long i_ { xub_StrLen nPos = STRING_NOTFOUND; String aNonMnem( OutputDevice::GetNonMnemonicString( i_rLong, nPos ) ); - aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth ); + aNonMnem = i_pWin->GetEllipsisString( aNonMnem, i_nMaxWidth, TEXT_DRAW_CENTERELLIPSIS ); // re-insert mnemonic if( nPos != STRING_NOTFOUND ) { @@ -2802,7 +2802,7 @@ void Menu::ImplPaint( Window* pWin, USHORT nBorder, long nStartY, MenuItemData* } if( !bIsMenuBar && pData->pSubMenu ) { - nMaxItemTextWidth -= nFontHeight + nExtra; + nMaxItemTextWidth -= nFontHeight - nExtra; } String aItemText( getShortenedString( pData->aText, pWin, nMaxItemTextWidth ) ); pWin->DrawCtrlText( aTmpPos, aItemText, 0, aItemText.Len(), nStyle, pVector, pDisplayText ); |