Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
30 : : #define _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
31 : :
32 : : #include <vcl/window.hxx>
33 : : #include <unotools/accessiblestatesethelper.hxx>
34 : : #include <svtools/AccessibleBrowseBoxObjType.hxx>
35 : : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
36 : :
37 : : // ============================================================================
38 : :
39 : : namespace svt
40 : : {
41 : :
42 : : // ============================================================================
43 : :
44 : : #define OFFSET_DEFAULT ((sal_Int32)-1)
45 : : #define OFFSET_NONE ((sal_Int32)0)
46 : :
47 : : // ============================================================================
48 : :
49 : : enum AccessibleTableChildIndex
50 : : {
51 : : /** Child index of the column header bar (first row). Exists always. */
52 : : BBINDEX_COLUMNHEADERBAR = 0,
53 : : /** Child index of the row header bar ("handle column"). Exists always. */
54 : : BBINDEX_ROWHEADERBAR = 1,
55 : : /** Child index of the data table. */
56 : : BBINDEX_TABLE = 2,
57 : : /** Child index of the first additional control. */
58 : : BBINDEX_FIRSTCONTROL = 3
59 : : };
60 : :
61 : : // ============================================================================
62 : :
63 : : #define XACC ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
64 : :
65 : : /** This abstract class provides methods to implement an accessible table object.
66 : : */
67 : 40 : class IAccessibleTableProvider
68 : : {
69 : : public:
70 : : /** @return The count of the rows. */
71 : : virtual long GetRowCount() const = 0;
72 : : /** @return The count of the columns. */
73 : : virtual sal_uInt16 GetColumnCount() const = 0;
74 : :
75 : : /** @return The position of the current row. */
76 : : virtual sal_Int32 GetCurrRow() const = 0;
77 : : /** @return The position of the current column. */
78 : : virtual sal_uInt16 GetCurrColumn() const = 0;
79 : :
80 : : /** @return The description of a row.
81 : : @param _nRow The row which description is in demand. */
82 : : virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
83 : : /** @return The description of a column.
84 : : @param _nColumn The column which description is in demand. */
85 : : virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
86 : :
87 : : /** @return <TRUE/>, if the object has a row header. */
88 : : virtual sal_Bool HasRowHeader() const = 0; //GetColumnId
89 : : /** @return <TRUE/>, if the object can focus a cell. */
90 : : virtual sal_Bool IsCellFocusable() const = 0;
91 : : virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
92 : :
93 : : virtual void SetNoSelection() = 0;
94 : : virtual void SelectAll() = 0;
95 : : virtual void SelectRow( long _nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True ) = 0;
96 : : virtual void SelectColumn( sal_uInt16 _nColumnPos, sal_Bool _bSelect = sal_True ) = 0;
97 : : virtual sal_Int32 GetSelectedRowCount() const = 0;
98 : : virtual sal_Int32 GetSelectedColumnCount() const = 0;
99 : : /** @return <TRUE/>, if the row is selected. */
100 : : virtual bool IsRowSelected( long _nRow ) const = 0;
101 : : virtual sal_Bool IsColumnSelected( long _nColumnPos ) const = 0;
102 : : virtual void GetAllSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& _rRows ) const = 0;
103 : : virtual void GetAllSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& _rColumns ) const = 0;
104 : :
105 : : /** @return <TRUE/>, if the cell is visible. */
106 : : virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
107 : : virtual String GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const = 0;
108 : :
109 : : virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
110 : : virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
111 : : virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumnPos, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True ) = 0;
112 : :
113 : : virtual XACC CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
114 : : virtual XACC CreateAccessibleRowHeader( sal_Int32 _nRow ) = 0;
115 : : virtual XACC CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) = 0;
116 : :
117 : : virtual sal_Int32 GetAccessibleControlCount() const = 0;
118 : : virtual XACC CreateAccessibleControl( sal_Int32 _nIndex ) = 0;
119 : : virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) = 0;
120 : :
121 : : virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
122 : : virtual sal_Bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) = 0;
123 : : virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
124 : :
125 : : virtual ::rtl::OUString GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
126 : : virtual ::rtl::OUString GetAccessibleObjectDescription( ::svt::AccessibleBrowseBoxObjType _eType, sal_Int32 _nPos = -1 ) const = 0;
127 : :
128 : : virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& _rStateSet, ::svt::AccessibleBrowseBoxObjType _eType ) const = 0;
129 : : virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
130 : : virtual void GrabTableFocus() = 0;
131 : :
132 : : // OutputDevice
133 : : virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
134 : :
135 : : // Window
136 : : virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
137 : : virtual void GrabFocus() = 0;
138 : : virtual XACC GetAccessible( sal_Bool bCreate = sal_True ) = 0;
139 : : virtual Window* GetAccessibleParentWindow() const = 0;
140 : : virtual Window* GetWindowInstance() = 0;
141 : :
142 : : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) = 0;
143 : : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) = 0;
144 : :
145 : : protected:
146 : 40 : ~IAccessibleTableProvider() {}
147 : : };
148 : :
149 : : // ----------------------------------------------------------------------------
150 : :
151 : : /** interface for an implementation of a table control's Accesible component
152 : : */
153 : 0 : class IAccessibleTabListBox
154 : : {
155 : : public:
156 : : /** returns the XAccessible object itself
157 : :
158 : : The reference returned here can be used to control the life time of the
159 : : IAccessibleTableImplementation object.
160 : :
161 : : The returned reference is guaranteed to not be <NULL/>.
162 : : */
163 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
164 : : getMyself() = 0;
165 : :
166 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
167 : : SAL_CALL getAccessibleChild( sal_Int32 nChildIndex )
168 : : throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ) = 0;
169 : :
170 : : /** returns the accessible object for the row or the column header bar
171 : : */
172 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
173 : : getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
174 : :
175 : : protected:
176 : 0 : ~IAccessibleTabListBox() {}
177 : : };
178 : :
179 : : /** interface for an implementation of a browse box's Accesible component
180 : : */
181 : 0 : class IAccessibleBrowseBox
182 : : {
183 : : public:
184 : : /** returns the XAccessible object itself
185 : :
186 : : The reference returned here can be used to control the life time of the
187 : : IAccessibleTableImplementation object.
188 : :
189 : : The returned reference is guaranteed to not be <NULL/>.
190 : : */
191 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
192 : : getMyself() = 0;
193 : :
194 : : /** disposes the accessible implementation, so that it becomes defunc
195 : : */
196 : : virtual void dispose() = 0;
197 : :
198 : : /** checks whether the accessible implementation, and its context, are still alive
199 : : @return <TRUE/>, if the object is not disposed or disposing.
200 : : */
201 : : virtual sal_Bool isAlive() const = 0;
202 : :
203 : : /** returns the accessible object for the row or the column header bar
204 : : */
205 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
206 : : getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
207 : :
208 : : /** returns the accessible object for the table representation
209 : : */
210 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
211 : : getTable() = 0;
212 : :
213 : : /** commits the event at all listeners of the column/row header bar
214 : : @param nEventId
215 : : the event id
216 : : @param rNewValue
217 : : the new value
218 : : @param rOldValue
219 : : the old value
220 : : */
221 : : virtual void commitHeaderBarEvent(
222 : : sal_Int16 nEventId,
223 : : const ::com::sun::star::uno::Any& rNewValue,
224 : : const ::com::sun::star::uno::Any& rOldValue,
225 : : sal_Bool _bColumnHeaderBar
226 : : ) = 0;
227 : :
228 : : /** commits the event at all listeners of the table
229 : : @param nEventId
230 : : the event id
231 : : @param rNewValue
232 : : the new value
233 : : @param rOldValue
234 : : the old value
235 : : */
236 : : virtual void commitTableEvent(
237 : : sal_Int16 nEventId,
238 : : const ::com::sun::star::uno::Any& rNewValue,
239 : : const ::com::sun::star::uno::Any& rOldValue
240 : : ) = 0;
241 : :
242 : : /** Commits an event to all listeners. */
243 : : virtual void commitEvent(
244 : : sal_Int16 nEventId,
245 : : const ::com::sun::star::uno::Any& rNewValue,
246 : : const ::com::sun::star::uno::Any& rOldValue
247 : : ) = 0;
248 : :
249 : : protected:
250 : 0 : ~IAccessibleBrowseBox() {}
251 : : };
252 : :
253 : : // ----------------------------------------------------------------------------
254 : :
255 : : // ============================================================================
256 : :
257 : : } // namespace svt
258 : :
259 : : // ============================================================================
260 : :
261 : : #endif // _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
262 : :
263 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|