Bump version to 6.4-15
[LibreOffice.git] / include / vcl / mnemonic.hxx
blob2404d7c97ca559dc41567c126d1dde0787e505a2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_MNEMONIC_HXX
21 #define INCLUDED_VCL_MNEMONIC_HXX
23 #include <com/sun/star/uno/Reference.h>
24 #include <rtl/ustring.hxx>
25 #include <vcl/dllapi.h>
27 namespace com { namespace sun { namespace star { namespace i18n { class XCharacterClassification; } } } }
29 // Mnemonic Chars, which we want support
30 // Latin 0-9
31 #define MNEMONIC_RANGE_1_START 0x30
32 #define MNEMONIC_RANGE_1_END 0x39
33 // Latin A-Z
34 #define MNEMONIC_RANGE_2_START 0x61
35 #define MNEMONIC_RANGE_2_END 0x7A
36 // Cyrillic
37 #define MNEMONIC_RANGE_3_START 0x0430
38 #define MNEMONIC_RANGE_3_END 0x044F
39 // Greek
40 #define MNEMONIC_RANGE_4_START 0x03B1
41 #define MNEMONIC_RANGE_4_END 0x03CB
42 #define MNEMONIC_RANGES 4
43 #define MAX_MNEMONICS ((MNEMONIC_RANGE_1_END-MNEMONIC_RANGE_1_START+1)+\
44 (MNEMONIC_RANGE_2_END-MNEMONIC_RANGE_2_START+1)+\
45 (MNEMONIC_RANGE_3_END-MNEMONIC_RANGE_3_START+1)+\
46 (MNEMONIC_RANGE_4_END-MNEMONIC_RANGE_4_START+1))
48 #define MNEMONIC_CHAR u'~'
49 #define MNEMONIC_INDEX_NOTFOUND (sal_uInt16(0xFFFF))
52 class VCL_DLLPUBLIC MnemonicGenerator
54 sal_Unicode m_cMnemonic;
55 // 0 == Mnemonic; >0 == count of characters
56 sal_uInt8 maMnemonics[MAX_MNEMONICS];
57 css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass;
59 SAL_DLLPRIVATE static sal_uInt16 ImplGetMnemonicIndex( sal_Unicode c );
60 SAL_DLLPRIVATE sal_Unicode ImplFindMnemonic( const OUString& rKey );
62 public:
63 MnemonicGenerator(sal_Unicode cMnemonic = MNEMONIC_CHAR);
65 void RegisterMnemonic( const OUString& rKey );
66 OUString CreateMnemonic( const OUString& rKey );
67 css::uno::Reference< css::i18n::XCharacterClassification > const & GetCharClass();
69 // returns a string where all '~'-characters and CJK mnemonics of the form (~A) are completely removed
70 static OUString EraseAllMnemonicChars( const OUString& rStr );
73 #endif // INCLUDED_VCL_MNEMONIC_HXX
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */