bump product version to 7.6.3.2-android
[LibreOffice.git] / vcl / qt5 / QtAccessibleRegistry.cxx
blob88f9abcfd17e652515f61ef93cc6a9316592ea48
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/.
8 */
10 #include <QtAccessibleRegistry.hxx>
11 #include <QtXAccessible.hxx>
13 #include <cassert>
15 std::map<XAccessible*, QObject*> QtAccessibleRegistry::m_aMapping = {};
17 QObject* QtAccessibleRegistry::getQObject(css::uno::Reference<XAccessible> xAcc)
19 if (!xAcc.is())
20 return nullptr;
22 // look for existing entry in the map
23 auto entry = m_aMapping.find(xAcc.get());
24 if (entry != m_aMapping.end())
25 return entry->second;
27 // create a new object and remember it in the map
28 QtXAccessible* pQtAcc = new QtXAccessible(xAcc);
29 m_aMapping.emplace(xAcc.get(), pQtAcc);
30 return pQtAcc;
33 void QtAccessibleRegistry::insert(css::uno::Reference<XAccessible> xAcc, QObject* pQObject)
35 assert(pQObject);
36 m_aMapping.emplace(xAcc.get(), pQObject);
39 void QtAccessibleRegistry::remove(css::uno::Reference<XAccessible> xAcc)
41 assert(xAcc.is());
42 m_aMapping.erase(xAcc.get());
45 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */