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