1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_FRAMEWORK_SOURCE_INC_ACCELERATORS_KEYMAPPING_HXX
21 #define INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_KEYMAPPING_HXX
26 #include <com/sun/star/lang/IllegalArgumentException.hpp>
34 can be used to map key identifier to the
35 corresponding key codes ...
44 /** @short is used to map a key code
45 to the right key identifier, which is
46 used to make the xml file "human readable"
48 struct KeyIdentifierInfo
51 const char* Identifier
;
54 /** @short hash structure to map identifier to key codes. */
55 typedef BaseHash
< sal_Int16
> Identifier2CodeHash
;
57 /** @short hash structure to map key codes to identifier. */
58 typedef std::unordered_map
< sal_Int16
,
61 std::equal_to
< sal_Int16
> > Code2IdentifierHash
;
67 static KeyIdentifierInfo KeyIdentifierMap
[];
69 /** @short hash to map identifier to key codes. */
70 Identifier2CodeHash m_lIdentifierHash
;
72 /** @short hash to map key codes to identifier. */
73 Code2IdentifierHash m_lCodeHash
;
80 virtual ~KeyMapping();
82 /** @short return a suitable key code
83 for the specified key identifier.
86 string value, which describe the key.
88 @return [css::awt::KeyEvent]
89 the corresponding key code as
92 @throw [css::lang::IllegalArgumentException]
93 if the given identifier does not describe
94 a well known key code.
96 sal_uInt16
mapIdentifierToCode(const OUString
& sIdentifier
)
97 throw(css::lang::IllegalArgumentException
);
99 /** @short return a suitable key identifier
100 for the specified key code.
103 short value, which describe the key.
105 @return The corresponding string identifier.
107 OUString
mapCodeToIdentifier(sal_uInt16 nCode
);
113 /** @short check if the given string describe a numeric
114 value ... and convert it.
117 the string value, which should be converted.
120 contains the converted code, but is defined only
121 if this method returns sal_True!
124 sal_True if conversion was successfully.
126 bool impl_st_interpretIdentifierAsPureKeyCode(const OUString
& sIdentifier
,
130 } // namespace framework
132 #endif // INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_KEYMAPPING_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */