Line data Source code
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 : #ifndef _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
21 : #define _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <unotools/accessiblestatesethelper.hxx>
25 : #include <svtools/AccessibleBrowseBoxObjType.hxx>
26 : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
27 :
28 :
29 : namespace svt
30 : {
31 :
32 : #define OFFSET_DEFAULT ((sal_Int32)-1)
33 : #define OFFSET_NONE ((sal_Int32)0)
34 :
35 : enum AccessibleTableChildIndex
36 : {
37 : /** Child index of the column header bar (first row). Exists always. */
38 : BBINDEX_COLUMNHEADERBAR = 0,
39 : /** Child index of the row header bar ("handle column"). Exists always. */
40 : BBINDEX_ROWHEADERBAR = 1,
41 : /** Child index of the data table. */
42 : BBINDEX_TABLE = 2,
43 : /** Child index of the first additional control. */
44 : BBINDEX_FIRSTCONTROL = 3
45 : };
46 :
47 :
48 : /** This abstract class provides methods to implement an accessible table object.
49 : */
50 21 : class IAccessibleTableProvider
51 : {
52 : public:
53 : /** @return The count of the rows. */
54 : virtual long GetRowCount() const = 0;
55 : /** @return The count of the columns. */
56 : virtual sal_uInt16 GetColumnCount() const = 0;
57 :
58 : /** @return The position of the current row. */
59 : virtual sal_Int32 GetCurrRow() const = 0;
60 : /** @return The position of the current column. */
61 : virtual sal_uInt16 GetCurrColumn() const = 0;
62 :
63 : /** @return The description of a row.
64 : @param _nRow The row which description is in demand. */
65 : virtual OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
66 : /** @return The description of a column.
67 : @param _nColumn The column which description is in demand. */
68 : virtual OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
69 :
70 : /** @return <TRUE/>, if the object has a row header. */
71 : virtual sal_Bool HasRowHeader() const = 0; //GetColumnId
72 : /** @return <TRUE/>, if the object can focus a cell. */
73 : virtual sal_Bool IsCellFocusable() const = 0;
74 : virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
75 :
76 : virtual void SetNoSelection() = 0;
77 : virtual void SelectAll() = 0;
78 : virtual void SelectRow( long _nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True ) = 0;
79 : virtual void SelectColumn( sal_uInt16 _nColumnPos, sal_Bool _bSelect = sal_True ) = 0;
80 : virtual sal_Int32 GetSelectedRowCount() const = 0;
81 : virtual sal_Int32 GetSelectedColumnCount() const = 0;
82 : /** @return <TRUE/>, if the row is selected. */
83 : virtual bool IsRowSelected( long _nRow ) const = 0;
84 : virtual sal_Bool IsColumnSelected( long _nColumnPos ) const = 0;
85 : virtual void GetAllSelectedRows( css::uno::Sequence< sal_Int32 >& _rRows ) const = 0;
86 : virtual void GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumns ) const = 0;
87 :
88 : /** @return <TRUE/>, if the cell is visible. */
89 : virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
90 : virtual String GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const = 0;
91 :
92 : virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
93 : virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
94 : virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumnPos, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True ) = 0;
95 :
96 : virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
97 : virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0;
98 : virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) = 0;
99 :
100 : virtual sal_Int32 GetAccessibleControlCount() const = 0;
101 : virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) = 0;
102 : virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) = 0;
103 :
104 : virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
105 : virtual sal_Bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) = 0;
106 : virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
107 :
108 : virtual OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
109 : virtual OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
110 :
111 : virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const = 0;
112 : virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
113 : virtual void GrabTableFocus() = 0;
114 :
115 : // OutputDevice
116 : virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
117 :
118 : // Window
119 : virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
120 : virtual void GrabFocus() = 0;
121 : virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True ) = 0;
122 : virtual Window* GetAccessibleParentWindow() const = 0;
123 : virtual Window* GetWindowInstance() = 0;
124 :
125 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) = 0;
126 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) = 0;
127 :
128 : protected:
129 21 : ~IAccessibleTableProvider() {}
130 : };
131 :
132 :
133 : /** interface for an implementation of a table control's Accesible component
134 : */
135 0 : class IAccessibleTabListBox
136 : {
137 : public:
138 : /** returns the XAccessible object itself
139 :
140 : The reference returned here can be used to control the life time of the
141 : IAccessibleTableImplementation object.
142 :
143 : The returned reference is guaranteed to not be <NULL/>.
144 : */
145 : virtual css::uno::Reference< css::accessibility::XAccessible >
146 : getMyself() = 0;
147 :
148 : virtual css::uno::Reference< css::accessibility::XAccessible >
149 : SAL_CALL getAccessibleChild( sal_Int32 nChildIndex )
150 : throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ) = 0;
151 :
152 : /** returns the accessible object for the row or the column header bar
153 : */
154 : virtual css::uno::Reference< css::accessibility::XAccessible >
155 : getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
156 :
157 : protected:
158 0 : ~IAccessibleTabListBox() {}
159 : };
160 :
161 : /** interface for an implementation of a browse box's Accesible component
162 : */
163 0 : class IAccessibleBrowseBox
164 : {
165 : public:
166 : /** returns the XAccessible object itself
167 :
168 : The reference returned here can be used to control the life time of the
169 : IAccessibleTableImplementation object.
170 :
171 : The returned reference is guaranteed to not be <NULL/>.
172 : */
173 : virtual css::uno::Reference< css::accessibility::XAccessible >
174 : getMyself() = 0;
175 :
176 : /** disposes the accessible implementation, so that it becomes defunc
177 : */
178 : virtual void dispose() = 0;
179 :
180 : /** checks whether the accessible implementation, and its context, are still alive
181 : @return <TRUE/>, if the object is not disposed or disposing.
182 : */
183 : virtual sal_Bool isAlive() const = 0;
184 :
185 : /** returns the accessible object for the row or the column header bar
186 : */
187 : virtual css::uno::Reference< css::accessibility::XAccessible >
188 : getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
189 :
190 : /** returns the accessible object for the table representation
191 : */
192 : virtual css::uno::Reference< css::accessibility::XAccessible >
193 : getTable() = 0;
194 :
195 : /** commits the event at all listeners of the column/row header bar
196 : @param nEventId
197 : the event id
198 : @param rNewValue
199 : the new value
200 : @param rOldValue
201 : the old value
202 : */
203 : virtual void commitHeaderBarEvent(
204 : sal_Int16 nEventId,
205 : const css::uno::Any& rNewValue,
206 : const css::uno::Any& rOldValue,
207 : sal_Bool _bColumnHeaderBar
208 : ) = 0;
209 :
210 : /** commits the event at all listeners of the table
211 : @param nEventId
212 : the event id
213 : @param rNewValue
214 : the new value
215 : @param rOldValue
216 : the old value
217 : */
218 : virtual void commitTableEvent(
219 : sal_Int16 nEventId,
220 : const css::uno::Any& rNewValue,
221 : const css::uno::Any& rOldValue
222 : ) = 0;
223 :
224 : /** Commits an event to all listeners. */
225 : virtual void commitEvent(
226 : sal_Int16 nEventId,
227 : const css::uno::Any& rNewValue,
228 : const css::uno::Any& rOldValue
229 : ) = 0;
230 :
231 : protected:
232 0 : ~IAccessibleBrowseBox() {}
233 : };
234 :
235 :
236 : } // namespace svt
237 :
238 :
239 : #endif // _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
240 :
241 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|