Branch libreoffice-6-3
[LibreOffice.git] / starmath / inc / AccessibleSmElement.hxx
blob9b168bbee4cb51fce3df47dcb17a9a292180dc95
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/.
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 .
19 #ifndef INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENT_HXX
20 #define INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENT_HXX
22 #include <com/sun/star/accessibility/XAccessible.hpp>
23 #include <com/sun/star/accessibility/XAccessibleAction.hpp>
24 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
27 #include <com/sun/star/awt/Rectangle.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <cppuhelper/implbase3.hxx>
30 #include <comphelper/accessiblecomponenthelper.hxx>
31 #include <sal/types.h>
32 #include <vcl/vclptr.hxx>
34 class SmElementsControl;
36 typedef ::cppu::ImplHelper3<css::lang::XServiceInfo, css::accessibility::XAccessible,
37 css::accessibility::XAccessibleAction>
38 AccessibleSmElement_BASE;
40 class AccessibleSmElement final : public comphelper::OAccessibleComponentHelper,
41 public AccessibleSmElement_BASE
43 VclPtr<SmElementsControl> m_pSmElementsControl;
44 const sal_Int32 m_nIndexInParent; ///< index in the parent XAccessible
45 const sal_uInt16 m_nItemId; ///< index in the SmElementsControl
46 bool m_bHasFocus;
47 sal_Int16 m_nRole;
49 ~AccessibleSmElement() override;
50 void SAL_CALL disposing() override;
51 css::awt::Rectangle implGetBounds() override;
53 void testAction(sal_Int32) const;
55 public:
56 explicit AccessibleSmElement(SmElementsControl* pSmElementsControl, sal_uInt16 nItemId,
57 sal_Int32 nIndexInParent);
59 void SetFocus(bool _bFocus);
60 bool HasFocus() const { return m_bHasFocus; }
61 void ReleaseSmElementsControl() { m_pSmElementsControl = nullptr; }
62 sal_uInt16 itemId() const { return m_nItemId; }
64 DECLARE_XINTERFACE()
65 DECLARE_XTYPEPROVIDER()
67 // XAccessible
68 css::uno::Reference<css::accessibility::XAccessibleContext>
69 SAL_CALL getAccessibleContext() override;
71 // XServiceInfo
72 OUString SAL_CALL getImplementationName() override;
73 sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
74 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
76 // XAccessibleContext
77 sal_Int32 SAL_CALL getAccessibleChildCount() override;
78 css::uno::Reference<css::accessibility::XAccessible>
79 SAL_CALL getAccessibleChild(sal_Int32 i) override;
80 css::uno::Reference<css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
81 sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
82 sal_Int16 SAL_CALL getAccessibleRole() override;
83 OUString SAL_CALL getAccessibleDescription() override;
84 OUString SAL_CALL getAccessibleName() override;
85 css::uno::Reference<css::accessibility::XAccessibleRelationSet>
86 SAL_CALL getAccessibleRelationSet() override;
87 css::uno::Reference<css::accessibility::XAccessibleStateSet>
88 SAL_CALL getAccessibleStateSet() override;
90 // XAccessibleComponent
91 css::uno::Reference<css::accessibility::XAccessible>
92 SAL_CALL getAccessibleAtPoint(const css::awt::Point& aPoint) override;
93 void SAL_CALL grabFocus() override;
94 sal_Int32 SAL_CALL getForeground() override;
95 sal_Int32 SAL_CALL getBackground() override;
97 // XAccessibleAction
98 sal_Int32 SAL_CALL getAccessibleActionCount() override;
99 sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override;
100 OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override;
101 css::uno::Reference<css::accessibility::XAccessibleKeyBinding>
102 SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override;
105 #endif // INCLUDED_STARMATH_INC_ACCESSIBLESMELEMENT_HXX
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */