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