update credits
[LibreOffice.git] / include / svtools / accessibletableprovider.hxx
blob775ac23c8ab2616a2d42ae29d1ad6c1d46a339da
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
21 #define _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
23 #include <vcl/window.hxx>
24 #include <unotools/accessiblestatesethelper.hxx>
25 #include <svtools/AccessibleBrowseBoxObjType.hxx>
26 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
29 namespace svt
32 #define OFFSET_DEFAULT ((sal_Int32)-1)
33 #define OFFSET_NONE ((sal_Int32)0)
35 enum AccessibleTableChildIndex
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
48 /** This abstract class provides methods to implement an accessible table object.
50 class IAccessibleTableProvider
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;
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;
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;
70 /** @return <TRUE/>, if the object has a row header. */
71 virtual sal_Bool HasRowHeader() const = 0; //GetColumnId
72 /** @return <TRUE/>, if the object can focus a cell. */
73 virtual sal_Bool IsCellFocusable() const = 0;
74 virtual sal_Bool GoToCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) = 0;
76 virtual void SetNoSelection() = 0;
77 virtual void SelectAll() = 0;
78 virtual void SelectRow( long _nRow, sal_Bool _bSelect = sal_True, sal_Bool bExpand = sal_True ) = 0;
79 virtual void SelectColumn( sal_uInt16 _nColumnPos, sal_Bool _bSelect = sal_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 sal_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;
88 /** @return <TRUE/>, if the cell is visible. */
89 virtual sal_Bool IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const = 0;
90 virtual String GetAccessibleCellText( long _nRow, sal_uInt16 _nColumnPos ) const = 0;
92 virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0;
93 virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0;
94 virtual Rectangle GetFieldRectPixelAbs( sal_Int32 _nRow, sal_uInt16 _nColumnPos, sal_Bool _bIsHeader, sal_Bool _bOnScreen = sal_True ) = 0;
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;
100 virtual sal_Int32 GetAccessibleControlCount() const = 0;
101 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) = 0;
102 virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) = 0;
104 virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
105 virtual sal_Bool ConvertPointToRowHeader( sal_Int32& _rnRow, const Point& _rPoint ) = 0;
106 virtual sal_Bool ConvertPointToColumnHeader( sal_uInt16& _rnColPos, const Point& _rPoint ) = 0;
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;
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;
115 // OutputDevice
116 virtual sal_Bool GetGlyphBoundRects( const Point& rOrigin, const String& rStr, int nIndex, int nLen, int nBase, MetricVector& rVector ) = 0;
118 // Window
119 virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0;
120 virtual void GrabFocus() = 0;
121 virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible( sal_Bool bCreate = sal_True ) = 0;
122 virtual Window* GetAccessibleParentWindow() const = 0;
123 virtual Window* GetWindowInstance() = 0;
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;
128 protected:
129 ~IAccessibleTableProvider() {}
133 /** interface for an implementation of a table control's Accesible component
135 class IAccessibleTabListBox
137 public:
138 /** returns the XAccessible object itself
140 The reference returned here can be used to control the life time of the
141 IAccessibleTableImplementation object.
143 The returned reference is guaranteed to not be <NULL/>.
145 virtual css::uno::Reference< css::accessibility::XAccessible >
146 getMyself() = 0;
148 virtual css::uno::Reference< css::accessibility::XAccessible >
149 SAL_CALL getAccessibleChild( sal_Int32 nChildIndex )
150 throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ) = 0;
152 /** returns the accessible object for the row or the column header bar
154 virtual css::uno::Reference< css::accessibility::XAccessible >
155 getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
157 protected:
158 ~IAccessibleTabListBox() {}
161 /** interface for an implementation of a browse box's Accesible component
163 class IAccessibleBrowseBox
165 public:
166 /** returns the XAccessible object itself
168 The reference returned here can be used to control the life time of the
169 IAccessibleTableImplementation object.
171 The returned reference is guaranteed to not be <NULL/>.
173 virtual css::uno::Reference< css::accessibility::XAccessible >
174 getMyself() = 0;
176 /** disposes the accessible implementation, so that it becomes defunc
178 virtual void dispose() = 0;
180 /** checks whether the accessible implementation, and its context, are still alive
181 @return <TRUE/>, if the object is not disposed or disposing.
183 virtual sal_Bool isAlive() const = 0;
185 /** returns the accessible object for the row or the column header bar
187 virtual css::uno::Reference< css::accessibility::XAccessible >
188 getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) = 0;
190 /** returns the accessible object for the table representation
192 virtual css::uno::Reference< css::accessibility::XAccessible >
193 getTable() = 0;
195 /** commits the event at all listeners of the column/row header bar
196 @param nEventId
197 the event id
198 @param rNewValue
199 the new value
200 @param rOldValue
201 the old value
203 virtual void commitHeaderBarEvent(
204 sal_Int16 nEventId,
205 const css::uno::Any& rNewValue,
206 const css::uno::Any& rOldValue,
207 sal_Bool _bColumnHeaderBar
208 ) = 0;
210 /** commits the event at all listeners of the table
211 @param nEventId
212 the event id
213 @param rNewValue
214 the new value
215 @param rOldValue
216 the old value
218 virtual void commitTableEvent(
219 sal_Int16 nEventId,
220 const css::uno::Any& rNewValue,
221 const css::uno::Any& rOldValue
222 ) = 0;
224 /** Commits an event to all listeners. */
225 virtual void commitEvent(
226 sal_Int16 nEventId,
227 const css::uno::Any& rNewValue,
228 const css::uno::Any& rOldValue
229 ) = 0;
231 protected:
232 ~IAccessibleBrowseBox() {}
236 } // namespace svt
239 #endif // _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */