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