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 .
22 #include <rtl/ustring.hxx>
23 #include <unordered_map>
31 can be used to map key identifier to the
32 corresponding key codes ...
41 /** @short is used to map a key code
42 to the right key identifier, which is
43 used to make the xml file "human readable"
45 struct KeyIdentifierInfo
51 /** @short hash structure to map identifier to key codes. */
52 typedef std::unordered_map
<OUString
, sal_Int16
> Identifier2CodeHash
;
54 /** @short hash structure to map key codes to identifier. */
55 typedef std::unordered_map
<sal_Int16
, OUString
> Code2IdentifierHash
;
61 static KeyIdentifierInfo
const KeyIdentifierMap
[];
63 /** @short hash to map identifier to key codes. */
64 Identifier2CodeHash m_lIdentifierHash
;
66 /** @short hash to map key codes to identifier. */
67 Code2IdentifierHash m_lCodeHash
;
75 static KeyMapping
& get();
77 /** @short return a suitable key code
78 for the specified key identifier.
81 string value, which describe the key.
83 @return [css::awt::KeyEvent]
84 the corresponding key code as
87 @throw [css::lang::IllegalArgumentException]
88 if the given identifier does not describe
89 a well known key code.
91 sal_uInt16
mapIdentifierToCode(const OUString
& sIdentifier
);
93 /** @short return a suitable key identifier
94 for the specified key code.
97 short value, which describe the key.
99 @return The corresponding string identifier.
101 OUString
mapCodeToIdentifier(sal_uInt16 nCode
);
107 /** @short check if the given string describe a numeric
108 value ... and convert it.
111 the string value, which should be converted.
114 contains the converted code, but is defined only
115 if this method returns sal_True!
118 sal_True if conversion was successful.
120 static bool impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier
,
124 } // namespace framework
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */