diff options
Diffstat (limited to 'vcl/source/window/window.cxx')
-rw-r--r-- | vcl/source/window/window.cxx | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 0d20f3258fe2..0762a07476e2 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -35,7 +35,6 @@ #include "vcl/salinst.hxx" #include "vcl/salgtype.hxx" #include "vcl/salgdi.hxx" -#include "vcl/salctrlhandle.hxx" #include "vcl/unohelp.hxx" #include "tools/time.hxx" @@ -44,7 +43,6 @@ #include "tools/rc.h" #endif #include "vcl/svdata.hxx" -#include "vcl/windata.hxx" #include "vcl/dbggui.hxx" #include "vcl/outfont.hxx" #include "vcl/outdev.h" @@ -68,6 +66,7 @@ #include "unotools/fontcfg.hxx" #include "vcl/sysdata.hxx" #include "vcl/sallayout.hxx" +#include "vcl/salctype.hxx" #include "vcl/button.hxx" // Button::GetStandardText #include "vcl/taskpanelist.hxx" #include "com/sun/star/awt/XWindowPeer.hpp" @@ -90,7 +89,6 @@ #include "vcl/unowrap.hxx" #include "vcl/dndlcon.hxx" #include "vcl/dndevdis.hxx" -#include "vcl/impbmpconv.hxx" #include "unotools/confignode.hxx" #include "vcl/gdimtf.hxx" @@ -270,19 +268,41 @@ bool Window::ImplCheckUIFont( const Font& rFont ) if( ImplGetSVData()->maGDIData.mbNativeFontConfig ) return true; + // create a text string using the localized text of important buttons String aTestText; - aTestText.Append( Button::GetStandardText( BUTTON_OK ) ); - aTestText.Append( Button::GetStandardText( BUTTON_CANCEL ) ); - aTestText.Append( Button::GetStandardText( BUTTON_YES ) ); - aTestText.Append( Button::GetStandardText( BUTTON_NO ) ); - aTestText.Append( Button::GetStandardText( BUTTON_RETRY ) ); - aTestText.Append( Button::GetStandardText( BUTTON_HELP ) ); - aTestText.Append( Button::GetStandardText( BUTTON_CLOSE ) ); - aTestText.Append( Button::GetStandardText( BUTTON_MORE ) ); - aTestText.Append( Button::GetStandardText( BUTTON_LESS ) ); - aTestText.Append( Button::GetStandardText( BUTTON_ABORT ) ); - - return HasGlyphs( rFont, aTestText ) >= aTestText.Len(); + static const StandardButtonType aTestButtons[] = + { + BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT, + BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE, + BUTTON_RETRY, BUTTON_HELP + }; + + const int nTestButtonCount = sizeof(aTestButtons)/sizeof(*aTestButtons); + for( int n = 0; n < nTestButtonCount; ++n ) + { + String aButtonStr = Button::GetStandardText( aTestButtons[n] ); + // #i115432# ignore mnemonic+accelerator part of each string + // TODO: use a string filtering method when it becomes available + const int nLen = aButtonStr.Len(); + bool bInside = false; + for( int i = 0; i < nLen; ++i ) { + const sal_Unicode c = aButtonStr.GetChar( i ); + if( (c == '(')) + bInside = true; + if( (c == ')')) + bInside = false; + if( (c == '~') + || (c == '(') || (c == ')') + || ((c >= 'A') && (c <= 'Z') && bInside) ) + aButtonStr.SetChar( i, ' ' ); + } + // append sanitized button text to test string + aTestText.Append( aButtonStr ); + } + + const int nFirstChar = HasGlyphs( rFont, aTestText ); + const bool bUIFontOk = (nFirstChar >= aTestText.Len()); + return bUIFontOk; } // ----------------------------------------------------------------------- |