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