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_ACCESSIBLETABLE_HXX
21 : #define _SVTOOLS_ACCESSIBLETABLE_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <unotools/accessiblestatesethelper.hxx>
25 : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26 :
27 : // ============================================================================
28 :
29 : namespace svt{ namespace table
30 : {
31 :
32 : typedef sal_Int32 RowPos;
33 :
34 : // ============================================================================
35 :
36 : enum AccessibleTableType
37 : {
38 : /** Child index of the column header bar (first row). */
39 : TCINDEX_COLUMNHEADERBAR = 0,
40 : /** Child index of the row header bar ("handle column"). */
41 : TCINDEX_ROWHEADERBAR = 1,
42 : /** Child index of the data table. */
43 : TCINDEX_TABLE = 2
44 : };
45 :
46 : enum AccessibleTableControlObjType
47 : {
48 : TCTYPE_GRIDCONTROL, /// The GridControl itself.
49 : TCTYPE_TABLE, /// The data table.
50 : TCTYPE_ROWHEADERBAR, /// The row header bar.
51 : TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar.
52 : TCTYPE_TABLECELL, /// A cell of the data table.
53 : TCTYPE_ROWHEADERCELL, /// A cell of the row header bar.
54 : TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar.
55 : };
56 :
57 : // ============================================================================
58 :
59 : #define XACC ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
60 :
61 : /** This abstract class provides methods to implement an accessible table object.
62 : */
63 0 : class IAccessibleTable
64 : {
65 : public:
66 : /** @return The position of the current row. */
67 : virtual sal_Int32 GetCurrentRow() const = 0;
68 : /** @return The position of the current column. */
69 : virtual sal_Int32 GetCurrentColumn() const = 0;
70 : /** Creates and returns the accessible object of the whole GridControl. */
71 : virtual XACC CreateAccessible()= 0;
72 : virtual XACC CreateAccessibleControl( sal_Int32 _nIndex )= 0;
73 : virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0;
74 : virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0;
75 : virtual sal_Bool HasColHeader() = 0;
76 : virtual sal_Bool HasRowHeader() = 0;
77 :
78 : /** return the description of the specified object.
79 : @param eObjType
80 : The type to ask for
81 : @param _nPosition
82 : The position of a tablecell (index position), header bar colum/row cell
83 : @return
84 : The description of the specified object.
85 : */
86 : virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0;
87 :
88 : /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
89 : the accessible object), depending on the specified object type. */
90 : virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet,
91 : AccessibleTableControlObjType eObjType ) const= 0;
92 :
93 : // Window
94 : virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
95 : virtual void GrabFocus()= 0;
96 : virtual XACC GetAccessible( sal_Bool bCreate = sal_True )= 0;
97 : virtual Window* GetAccessibleParentWindow() const= 0;
98 : virtual Window* GetWindowInstance()= 0;
99 : virtual sal_Int32 GetAccessibleControlCount() const = 0;
100 : virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0;
101 : virtual long GetRowCount() const= 0;
102 : virtual long GetColumnCount() const= 0;
103 : virtual sal_Bool HasRowHeader() const= 0;
104 : virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0;
105 : virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
106 : virtual Rectangle calcHeaderCellRect( sal_Bool _bColHeader, sal_Int32 _nPos ) = 0;
107 : virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
108 : virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) = 0;
109 : virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0;
110 : virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0;
111 : virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0;
112 : virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const = 0;
113 : virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0;
114 : virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0;
115 : virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
116 : virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
117 : virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0;
118 :
119 : virtual sal_Int32 GetSelectedRowCount() const = 0;
120 : virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const = 0;
121 : virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0;
122 : virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) = 0;
123 : virtual void SelectAllRows( bool const i_select ) = 0;
124 :
125 : protected:
126 0 : ~IAccessibleTable() {}
127 : };
128 :
129 : // ----------------------------------------------------------------------------
130 :
131 : /** interface for an implementation of a table control's Accesible component
132 : */
133 0 : class IAccessibleTableControl
134 : {
135 : public:
136 : /** returns the XAccessible object itself
137 :
138 : The reference returned here can be used to control the life time of the
139 : IAccessibleTableImplementation object.
140 :
141 : The returned reference is guaranteed to not be <NULL/>.
142 : */
143 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
144 : getMyself() = 0;
145 :
146 : /** disposes the accessible implementation, so that it becomes defunc
147 : */
148 : virtual void dispose() = 0;
149 :
150 : /** checks whether the accessible implementation, and its context, are still alive
151 : @return <TRUE/>, if the object is not disposed or disposing.
152 : */
153 : virtual sal_Bool isAlive() const = 0;
154 :
155 : /** returns the accessible object for the row or the column header bar
156 : */
157 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
158 : getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) = 0;
159 :
160 : /** returns the accessible object for the table representation
161 : */
162 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
163 : getTable() = 0;
164 :
165 : /** commits the event at all listeners of the cell
166 : @param nEventId
167 : the event id
168 : @param rNewValue
169 : the new value
170 : @param rOldValue
171 : the old value
172 : */
173 : virtual void commitCellEvent(
174 : sal_Int16 nEventId,
175 : const ::com::sun::star::uno::Any& rNewValue,
176 : const ::com::sun::star::uno::Any& rOldValue
177 : ) = 0;
178 : /** commits the event at all listeners of the table
179 : @param nEventId
180 : the event id
181 : @param rNewValue
182 : the new value
183 : @param rOldValue
184 : the old value
185 : */
186 : virtual void commitTableEvent(
187 : sal_Int16 nEventId,
188 : const ::com::sun::star::uno::Any& rNewValue,
189 : const ::com::sun::star::uno::Any& rOldValue
190 : ) = 0;
191 :
192 : ///** Commits an event to all listeners. */
193 : virtual void commitEvent(
194 : sal_Int16 nEventId,
195 : const ::com::sun::star::uno::Any& rNewValue,
196 : const ::com::sun::star::uno::Any& rOldValue
197 : ) = 0;
198 :
199 : protected:
200 0 : ~IAccessibleTableControl() {}
201 : };
202 :
203 : // ----------------------------------------------------------------------------
204 :
205 : // ============================================================================
206 : } // namespace table
207 : } // namespace svt
208 :
209 : // ============================================================================
210 :
211 : #endif // _SVTOOLS_ACCESSIBLETABLE_HXX
212 :
213 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|