From 90cd40b67a687c93ed42b7e812560c753f2334b3 Mon Sep 17 00:00:00 2001 From: RĂ¼diger Timm Date: Wed, 7 Jan 2004 15:22:05 +0000 Subject: INTEGRATION: CWS geordi2q12 (1.13.80); FILE MERGED 2004/01/07 14:14:56 hr 1.13.80.1: #111934#: merge CWS mnemonics -> SRC680 --- vcl/source/window/mnemonic.cxx | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'vcl/source/window/mnemonic.cxx') diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index 194512062fb7..fb64c982ee77 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mnemonic.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: vg $ $Date: 2004-01-06 14:14:17 $ + * last change: $Author: rt $ $Date: 2004-01-07 16:22:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -407,3 +407,41 @@ uno::Reference< i18n::XCharacterClassification > MnemonicGenerator::GetCharClass xCharClass = vcl::unohelper::CreateCharacterClassification(); return xCharClass; } + +// ----------------------------------------------------------------------- + +String MnemonicGenerator::EraseAllMnemonicChars( const String& rStr ) +{ + String aStr = rStr; + xub_StrLen nLen = aStr.Len(); + xub_StrLen i = 0; + + while ( i < nLen ) + { + if ( aStr.GetChar( i ) == '~' ) + { + // check for CJK-style mnemonic + if( i > 0 && (i+2) < nLen ) + { + sal_Unicode c = aStr.GetChar(i+1); + if( aStr.GetChar( i-1 ) == '(' && + aStr.GetChar( i+2 ) == ')' && + c >= MNEMONIC_RANGE_2_START && c <= MNEMONIC_RANGE_2_END ) + { + aStr.Erase( i-1, 4 ); + nLen -= 4; + i--; + continue; + } + } + + // remove standard mnemonics + aStr.Erase( i, 1 ); + nLen--; + } + else + i++; + } + + return aStr; +} -- cgit