summaryrefslogtreecommitdiff
path: root/vcl/source/window/window.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/window.cxx')
-rw-r--r--[-rwxr-xr-x]vcl/source/window/window.cxx61
1 files changed, 42 insertions, 19 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index fe2af486c53a..0762a07476e2 100755..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 ) );
+ static const StandardButtonType aTestButtons[] =
+ {
+ BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT,
+ BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE,
+ BUTTON_RETRY, BUTTON_HELP
+ };
- return HasGlyphs( rFont, aTestText ) >= aTestText.Len();
+ 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;
}
// -----------------------------------------------------------------------
@@ -9716,11 +9736,14 @@ Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSi
// =========================================
if ( xFactory.is() )
{
- static Reference<lang::XMultiServiceFactory> xCanvasFactory(
- xFactory->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star."
- "rendering.CanvasFactory") ) ), UNO_QUERY );
+ static ::vcl::DeleteUnoReferenceOnDeinit<XMultiServiceFactory> xStaticCanvasFactory(
+ Reference<XMultiServiceFactory>(
+ xFactory->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.rendering.CanvasFactory") ) ),
+ UNO_QUERY ));
+ uno::Reference<XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get());
+
if(xCanvasFactory.is())
{
#ifdef WNT