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 INCLUDED_SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
21 : #define INCLUDED_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 20 : 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 bool HasRowHeader() const = 0; //GetColumnId
72 : /** @return <TRUE/>, if the object can focus a cell. */
73 : virtual bool IsCellFocusable() const = 0;
74 : virtual 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, bool _bSelect = true, bool bExpand = true ) = 0;
79 : virtual void SelectColumn( sal_uInt16 _nColumnPos, bool _bSelect = 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 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 bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
90 : virtual OUString GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const = 0;
91 :
92 : virtual Rectangle calcHeaderRect( bool _bIsColumnBar, bool _bOnScreen = true ) = 0;
93 : virtual Rectangle calcTableRect( bool _bOnScreen = true ) = 0;
94 : virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumnPos, bool _bIsHeader, bool _bOnScreen = 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 bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) = 0;
103 :
104 : virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
105 : virtual bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) = 0;
106 : virtual 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 bool GetGlyphBoundRects( const Point& rOrigin, const OUString& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
117 :
118 : // Window
119 : virtual Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const = 0;
120 : virtual void GrabFocus() = 0;
121 : virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( bool bCreate = true ) = 0;
122 : virtual vcl::Window* GetAccessibleParentWindow() const = 0;
123 : virtual vcl::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 20 : ~IAccessibleTableProvider() {}
130 : };
131 :
132 :
133 : /** interface for an implementation of a table control's Accessible 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 : /** returns the accessible object for the column header bar
149 : */
150 : virtual css::uno::Reference< css::accessibility::XAccessible >
151 : getHeaderBar() = 0;
152 :
153 : protected:
154 0 : ~IAccessibleTabListBox() {}
155 : };
156 :
157 : /** interface for an implementation of a browse box's Accessible component
158 : */
159 0 : class IAccessibleBrowseBox
160 : {
161 : public:
162 : /** returns the XAccessible object itself
163 :
164 : The reference returned here can be used to control the life time of the
165 : IAccessibleTableImplementation object.
166 :
167 : The returned reference is guaranteed to not be <NULL/>.
168 : */
169 : virtual css::uno::Reference< css::accessibility::XAccessible >
170 : getMyself() = 0;
171 :
172 : /** disposes the accessible implementation, so that it becomes defunc
173 : */
174 : virtual void dispose() = 0;
175 :
176 : /** checks whether the accessible implementation, and its context, are still alive
177 : @return <TRUE/>, if the object is not disposed or disposing.
178 : */
179 : virtual bool isAlive() const = 0;
180 :
181 : /** returns the accessible object for the row or the column header bar
182 : */
183 : virtual css::uno::Reference< css::accessibility::XAccessible >
184 : getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
185 :
186 : /** returns the accessible object for the table representation
187 : */
188 : virtual css::uno::Reference< css::accessibility::XAccessible >
189 : getTable() = 0;
190 :
191 : /** commits the event at all listeners of the column/row header bar
192 : @param nEventId
193 : the event id
194 : @param rNewValue
195 : the new value
196 : @param rOldValue
197 : the old value
198 : */
199 : virtual void commitHeaderBarEvent(
200 : sal_Int16 nEventId,
201 : const css::uno::Any& rNewValue,
202 : const css::uno::Any& rOldValue,
203 : bool _bColumnHeaderBar
204 : ) = 0;
205 :
206 : /** commits the event at all listeners of the table
207 : @param nEventId
208 : the event id
209 : @param rNewValue
210 : the new value
211 : @param rOldValue
212 : the old value
213 : */
214 : virtual void commitTableEvent(
215 : sal_Int16 nEventId,
216 : const css::uno::Any& rNewValue,
217 : const css::uno::Any& rOldValue
218 : ) = 0;
219 :
220 : /** Commits an event to all listeners. */
221 : virtual void commitEvent(
222 : sal_Int16 nEventId,
223 : const css::uno::Any& rNewValue,
224 : const css::uno::Any& rOldValue
225 : ) = 0;
226 :
227 : protected:
228 0 : ~IAccessibleBrowseBox() {}
229 : };
230 :
231 :
232 : } // namespace svt
233 :
234 :
235 : #endif // INCLUDED_SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
236 :
237 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|