LibreOffice Module accessibility (master) 1
vclxaccessibleheaderbar.cxx
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
22
23#include <o3tl/safeint.hxx>
24#include <vcl/headbar.hxx>
25#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26#include <com/sun/star/accessibility/AccessibleRole.hpp>
27#include <vcl/svapp.hxx>
28
29using namespace ::com::sun::star;
30using namespace ::com::sun::star::uno;
31using namespace ::com::sun::star::awt;
32using namespace ::com::sun::star::lang;
33using namespace ::com::sun::star::beans;
34using namespace ::com::sun::star::accessibility;
35using namespace ::comphelper;
36
38 : VCLXAccessibleComponent(pVCLWindow)
39{
40 m_pHeadBar = GetAs<HeaderBar>();
41}
42
44
45// XServiceInfo
46
48{
49 return "com.sun.star.comp.toolkit.AccessibleHeaderBar";
50}
51
53{
54 return { "com.sun.star.awt.AccessibleHeaderBar" };
55}
56
57// =======XAccessibleContext=======
58
60{
62
63 sal_Int64 nCount = 0;
64 if (m_pHeadBar)
65 nCount = m_pHeadBar->GetItemCount();
66
67 return nCount;
68}
69css::uno::Reference<css::accessibility::XAccessible>
71{
73
74 if (i < 0 || i >= getAccessibleChildCount())
75 throw IndexOutOfBoundsException();
76
77 Reference<XAccessible> xChild;
78 // search for the child
80 xChild = CreateChild(i);
81 else
82 {
83 xChild = m_aAccessibleChildren[i];
84 if (!xChild.is())
85 xChild = CreateChild(i);
86 }
87 return xChild;
88}
89
91{
92 return css::accessibility::AccessibleRole::LIST;
93}
94
96{
98
100 VCLXAccessibleComponent::disposing();
101}
102
103css::uno::Reference<css::accessibility::XAccessible>
105{
106 Reference<XAccessible> xChild;
107
108 sal_uInt16 nPos = static_cast<sal_uInt16>(i);
109 if (nPos >= m_aAccessibleChildren.size())
110 {
111 m_aAccessibleChildren.resize(nPos + 1);
112
113 // insert into the container
115 m_aAccessibleChildren[nPos] = xChild;
116 }
117 else
118 {
119 xChild = m_aAccessibleChildren[nPos];
120 // check if position is empty and can be used else we have to adjust all entries behind this
121 if (!xChild.is())
122 {
124 m_aAccessibleChildren[nPos] = xChild;
125 }
126 }
127 return xChild;
128}
129
130/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL disposing() override
virtual ~VCLXAccessibleHeaderBar() override
VCLXAccessibleHeaderBar(VCLXWindow *pVCLXindow)
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
css::uno::Reference< css::accessibility::XAccessible > CreateChild(sal_Int32 i)
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
int nCount
sal_uInt16 nPos
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
std::vector< css::uno::WeakReference< css::accessibility::XAccessible > > ListItems