LibreOffice Module framework (master) 1
keymapping.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <rtl/ustring.hxx>
23#include <unordered_map>
24
25// definition
26
27namespace framework
28{
29
35{
36
37 // const, types
38
39 private:
40
46 {
47 sal_Int16 Code;
48 const char* Identifier;
49 };
50
52 typedef std::unordered_map<OUString, sal_Int16> Identifier2CodeHash;
53
55 typedef std::unordered_map<sal_Int16, OUString> Code2IdentifierHash;
56
57 // member
58
59 private:
60
62
65
68
69 // interface
70
71 public:
72
73 KeyMapping();
74
75 static KeyMapping & get();
76
91 sal_uInt16 mapIdentifierToCode(const OUString& sIdentifier);
92
101 OUString mapCodeToIdentifier(sal_uInt16 nCode);
102
103 // helper
104
105 private:
106
120 bool impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier,
121 sal_uInt16& rCode );
122};
123
124} // namespace framework
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
can be used to map key identifier to the corresponding key codes ...
Definition: keymapping.hxx:35
OUString mapCodeToIdentifier(sal_uInt16 nCode)
return a suitable key identifier for the specified key code.
Definition: keymapping.cxx:182
std::unordered_map< OUString, sal_Int16 > Identifier2CodeHash
hash structure to map identifier to key codes.
Definition: keymapping.hxx:52
static KeyMapping & get()
Definition: keymapping.cxx:159
static KeyIdentifierInfo const KeyIdentifierMap[]
Definition: keymapping.hxx:61
Identifier2CodeHash m_lIdentifierHash
hash to map identifier to key codes.
Definition: keymapping.hxx:64
bool impl_st_interpretIdentifierAsPureKeyCode(std::u16string_view sIdentifier, sal_uInt16 &rCode)
check if the given string describe a numeric value ... and convert it.
Definition: keymapping.cxx:192
std::unordered_map< sal_Int16, OUString > Code2IdentifierHash
hash structure to map key codes to identifier.
Definition: keymapping.hxx:55
sal_uInt16 mapIdentifierToCode(const OUString &sIdentifier)
return a suitable key code for the specified key identifier.
Definition: keymapping.cxx:164
Code2IdentifierHash m_lCodeHash
hash to map key codes to identifier.
Definition: keymapping.hxx:67
is used to map a key code to the right key identifier, which is used to make the xml file "human read...
Definition: keymapping.hxx:46