LCOV - code coverage report
Current view: top level - include/vcl - mnemonic.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_MNEMONIC_HXX
      21             : #define INCLUDED_VCL_MNEMONIC_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.h>
      24             : #include <com/sun/star/i18n/XCharacterClassification.hpp>
      25             : #include <rtl/ustring.hxx>
      26             : #include <vcl/dllapi.h>
      27             : 
      28             : 
      29             : // - ImplMnemonicTypes -
      30             : 
      31             : 
      32             : // Mnemonic Chars, which we want support
      33             : // Latin 0-9
      34             : #define MNEMONIC_RANGE_1_START      0x30
      35             : #define MNEMONIC_RANGE_1_END        0x39
      36             : // Latin A-Z
      37             : #define MNEMONIC_RANGE_2_START      0x41
      38             : #define MNEMONIC_RANGE_2_END        0x5A
      39             : // Cyrillic
      40             : #define MNEMONIC_RANGE_3_START      0x0410
      41             : #define MNEMONIC_RANGE_3_END        0x042F
      42             : // Greek
      43             : #define MNEMONIC_RANGE_4_START      0x0391
      44             : #define MNEMONIC_RANGE_4_END        0x03AB
      45             : #define MNEMONIC_RANGES             4
      46             : #define MAX_MNEMONICS               ((MNEMONIC_RANGE_1_END-MNEMONIC_RANGE_1_START+1)+\
      47             :                                      (MNEMONIC_RANGE_2_END-MNEMONIC_RANGE_2_START+1)+\
      48             :                                      (MNEMONIC_RANGE_3_END-MNEMONIC_RANGE_3_START+1)+\
      49             :                                      (MNEMONIC_RANGE_4_END-MNEMONIC_RANGE_4_START+1))
      50             : 
      51             : #define MNEMONIC_CHAR               ((sal_Unicode)'~')
      52             : #define MNEMONIC_INDEX_NOTFOUND     ((sal_uInt16)0xFFFF)
      53             : 
      54             : 
      55             : // - MnemonicGenerator -
      56             : 
      57             : 
      58       28948 : class VCL_DLLPUBLIC MnemonicGenerator
      59             : {
      60             : private:
      61             :     // 0 == Mnemonic; >0 == count of characters
      62             :     sal_uInt8               maMnemonics[MAX_MNEMONICS];
      63             :     ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > mxCharClass;
      64             : 
      65             : protected:
      66             :     SAL_DLLPRIVATE sal_uInt16       ImplGetMnemonicIndex( sal_Unicode c );
      67             :     SAL_DLLPRIVATE sal_Unicode  ImplFindMnemonic( const OUString& rKey );
      68             : 
      69             : public:
      70             :                         MnemonicGenerator();
      71             : 
      72             :     void                RegisterMnemonic( const OUString& rKey );
      73             :     OUString            CreateMnemonic( const OUString& rKey );
      74             :     ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > GetCharClass();
      75             : 
      76             :     // returns a string where all '~'-characters and CJK mnemonics of the form (~A) are completely removed
      77             :     static OUString EraseAllMnemonicChars( const OUString& rStr );
      78             : };
      79             : 
      80             : #endif // INCLUDED_VCL_MNEMONIC_HXX
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11