/src/libreoffice/toolkit/inc/controls/table/AccessibleGridControlBase.hxx
Line | Count | Source |
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 | | |
21 | | #pragma once |
22 | | |
23 | | #include <controls/table/tablecontrol.hxx> |
24 | | |
25 | | #include <rtl/ustring.hxx> |
26 | | #include <rtl/ref.hxx> |
27 | | #include <tools/gen.hxx> |
28 | | #include <cppuhelper/compbase.hxx> |
29 | | #include <cppuhelper/implbase1.hxx> |
30 | | #include <cppuhelper/basemutex.hxx> |
31 | | #include <com/sun/star/lang/XServiceInfo.hpp> |
32 | | #include <com/sun/star/accessibility/XAccessible.hpp> |
33 | | #include <com/sun/star/accessibility/XAccessibleContext.hpp> |
34 | | #include <com/sun/star/accessibility/XAccessibleComponent.hpp> |
35 | | #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> |
36 | | #include <comphelper/accessibleeventnotifier.hxx> |
37 | | #include <comphelper/OAccessible.hxx> |
38 | | #include <comphelper/uno3.hxx> |
39 | | |
40 | | |
41 | | namespace accessibility { |
42 | | |
43 | | /** The GridControl accessible objects inherit from this base class. It |
44 | | implements basic functionality. */ |
45 | | class AccessibleGridControlBase |
46 | | : public cppu::ImplInheritanceHelper<comphelper::OAccessible, css::lang::XServiceInfo> |
47 | | { |
48 | | public: |
49 | | /** Constructor. |
50 | | @param rxParent XAccessible interface of the parent object. |
51 | | @param rTable The Table control. |
52 | | @param eObjType Type of accessible table control. */ |
53 | | AccessibleGridControlBase( |
54 | | css::uno::Reference< css::accessibility::XAccessible > xParent, |
55 | | svt::table::TableControl& rTable, |
56 | | AccessibleTableControlObjType eObjType); |
57 | | |
58 | | protected: |
59 | 0 | virtual ~AccessibleGridControlBase() = default; |
60 | | virtual void SAL_CALL disposing() override; |
61 | | |
62 | | public: |
63 | | // XAccessibleContext |
64 | | |
65 | | /** @return A reference to the parent accessible object. */ |
66 | | virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL |
67 | | getAccessibleParent() override; |
68 | | |
69 | | /** @return |
70 | | The description of this object. |
71 | | */ |
72 | | virtual OUString SAL_CALL getAccessibleDescription() override; |
73 | | |
74 | | /** @return |
75 | | The name of this object. |
76 | | */ |
77 | | virtual OUString SAL_CALL getAccessibleName() override; |
78 | | |
79 | | /** @return |
80 | | The relation set (the GridControl does not have one). |
81 | | */ |
82 | | virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL |
83 | | getAccessibleRelationSet() override; |
84 | | |
85 | | /** @return The set of current states. */ |
86 | | virtual sal_Int64 SAL_CALL getAccessibleStateSet() override; |
87 | | |
88 | | /** @return The parent's locale. */ |
89 | | virtual css::lang::Locale SAL_CALL getLocale() override; |
90 | | |
91 | | /** @return |
92 | | The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported. |
93 | | */ |
94 | | virtual sal_Int16 SAL_CALL getAccessibleRole() override; |
95 | | |
96 | | /* Derived classes have to implement: |
97 | | - getAccessibleChildCount, |
98 | | - getAccessibleChild, |
99 | | - getAccessibleRole. |
100 | | Derived classes may overwrite getAccessibleIndexInParent to increase |
101 | | performance. */ |
102 | | |
103 | | // XAccessibleComponent |
104 | | virtual sal_Int32 SAL_CALL getForeground( ) override; |
105 | | virtual sal_Int32 SAL_CALL getBackground( ) override; |
106 | | |
107 | | |
108 | | /* Derived classes have to implement: |
109 | | - getAccessibleAt, |
110 | | - grabFocus. */ |
111 | | |
112 | | /** @return |
113 | | The accessible child rendered under the given point. |
114 | | */ |
115 | | virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL |
116 | | getAccessibleAtPoint( const css::awt::Point& rPoint ) override; |
117 | | |
118 | | // XServiceInfo |
119 | | |
120 | | /** @return Whether the specified service is supported by this class. */ |
121 | | virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; |
122 | | |
123 | | /** @return a list of all supported services. */ |
124 | | virtual css::uno::Sequence< OUString > SAL_CALL |
125 | | getSupportedServiceNames() override; |
126 | | |
127 | | /* Derived classes have to implement: |
128 | | - getImplementationName. */ |
129 | | |
130 | | // helper methods |
131 | | |
132 | | /** @return The GridControl object type. */ |
133 | | inline AccessibleTableControlObjType getType() const; |
134 | | |
135 | | /** Commits an event to all listeners. */ |
136 | | virtual void commitEvent(sal_Int16 nEventId, const css::uno::Any& rNewValue, |
137 | | const css::uno::Any& rOldValue); |
138 | | |
139 | | protected: |
140 | | virtual css::awt::Rectangle implGetBounds() override; |
141 | | |
142 | | // internal virtual methods |
143 | | |
144 | | /** Determines whether the Grid control is really showing inside of |
145 | | its parent accessible window. Derived classes may implement different |
146 | | behaviour. |
147 | | @attention This method requires locked mutex's and a living object. |
148 | | @return TRUE, if the object is really showing. */ |
149 | | bool implIsShowing(); |
150 | | |
151 | | /** Return the bounding box relative to the parent. |
152 | | @attention This method requires locked mutex's and a living object. |
153 | | @return The bounding box (VCL rect.) relative to the parent. */ |
154 | | tools::Rectangle implGetBoundingBox(); |
155 | | |
156 | | ///** Derived classes return the bounding box in screen coordinates. |
157 | | // @attention This method requires locked mutex's and a living object. |
158 | | // @return The bounding box (VCL rect.) in screen coordinates. */ |
159 | | virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() = 0; |
160 | | |
161 | | /** Creates a bitset of states of the |
162 | | current object. This method calls FillStateSet at the GridControl which |
163 | | fills it with more states depending on the object type. Derived classes |
164 | | may overwrite this method and add more states. |
165 | | @attention This method requires locked mutex's. |
166 | | */ |
167 | | virtual sal_Int64 implCreateStateSet(); |
168 | | |
169 | | protected: |
170 | | // members |
171 | | |
172 | | /** The parent accessible object. */ |
173 | | css::uno::Reference< css::accessibility::XAccessible > m_xParent; |
174 | | /** The SVT Table control. */ |
175 | | svt::table::TableControl& m_aTable; |
176 | | /** The type of this object (for names, descriptions, state sets, ...). */ |
177 | | AccessibleTableControlObjType m_eObjType; |
178 | | }; |
179 | | |
180 | | // inlines |
181 | | |
182 | | inline AccessibleTableControlObjType AccessibleGridControlBase::getType() const |
183 | 0 | { |
184 | 0 | return m_eObjType; |
185 | 0 | } |
186 | | |
187 | | |
188 | | } // namespace accessibility |
189 | | |
190 | | |
191 | | |
192 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |