1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SVTOOLS_ACCESSIBLETABLE_HXX 29 #define _SVTOOLS_ACCESSIBLETABLE_HXX 30 31 #include <vcl/window.hxx> 32 #include <unotools/accessiblestatesethelper.hxx> 33 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> 34 35 // ============================================================================ 36 37 namespace svt{ namespace table 38 { 39 40 typedef sal_Int32 RowPos; 41 42 // ============================================================================ 43 44 enum AccessibleTableType 45 { 46 /** Child index of the column header bar (first row). */ 47 TCINDEX_COLUMNHEADERBAR = 0, 48 /** Child index of the row header bar ("handle column"). */ 49 TCINDEX_ROWHEADERBAR = 1, 50 /** Child index of the data table. */ 51 TCINDEX_TABLE = 2 52 }; 53 54 enum AccessibleTableControlObjType 55 { 56 TCTYPE_GRIDCONTROL, /// The GridControl itself. 57 TCTYPE_TABLE, /// The data table. 58 TCTYPE_ROWHEADERBAR, /// The row header bar. 59 TCTYPE_COLUMNHEADERBAR, /// The horizontal column header bar. 60 TCTYPE_TABLECELL, /// A cell of the data table. 61 TCTYPE_ROWHEADERCELL, /// A cell of the row header bar. 62 TCTYPE_COLUMNHEADERCELL, /// A cell of the column header bar. 63 }; 64 65 // ============================================================================ 66 67 #define XACC ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 68 69 /** This abstract class provides methods to implement an accessible table object. 70 */ 71 class IAccessibleTable 72 { 73 public: 74 /** @return The position of the current row. */ 75 virtual sal_Int32 GetCurrentRow() const = 0; 76 /** @return The position of the current column. */ 77 virtual sal_Int32 GetCurrentColumn() const = 0; 78 /** Creates and returns the accessible object of the whole GridControl. */ 79 virtual XACC CreateAccessible()= 0; 80 virtual XACC CreateAccessibleControl( sal_Int32 _nIndex )= 0; 81 virtual ::rtl::OUString GetAccessibleObjectName(AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0; 82 virtual sal_Bool GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0; 83 virtual sal_Bool HasColHeader() = 0; 84 virtual sal_Bool HasRowHeader() = 0; 85 86 /** return the description of the specified object. 87 @param eObjType 88 The type to ask for 89 @param _nPosition 90 The position of a tablecell (index position), header bar colum/row cell 91 @return 92 The description of the specified object. 93 */ 94 virtual ::rtl::OUString GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType, sal_Int32 _nPosition = -1) const= 0; 95 96 /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by 97 the accessible object), depending on the specified object type. */ 98 virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& rStateSet, 99 AccessibleTableControlObjType eObjType ) const= 0; 100 101 // Window 102 virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ) const = 0; 103 virtual void GrabFocus()= 0; 104 virtual XACC GetAccessible( sal_Bool bCreate = sal_True )= 0; 105 virtual Window* GetAccessibleParentWindow() const= 0; 106 virtual Window* GetWindowInstance()= 0; 107 virtual sal_Int32 GetAccessibleControlCount() const = 0; 108 virtual sal_Bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )= 0; 109 virtual long GetRowCount() const= 0; 110 virtual long GetColumnCount() const= 0; 111 virtual sal_Bool HasRowHeader() const= 0; 112 virtual sal_Bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )= 0; 113 virtual Rectangle calcHeaderRect( sal_Bool _bIsColumnBar, sal_Bool _bOnScreen = sal_True ) = 0; 114 virtual Rectangle calcHeaderCellRect( sal_Bool _bColHeader, sal_Int32 _nPos ) = 0; 115 virtual Rectangle calcTableRect( sal_Bool _bOnScreen = sal_True ) = 0; 116 virtual Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) = 0; 117 virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)= 0; 118 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)= 0; 119 virtual void FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0; 120 virtual ::rtl::OUString GetRowDescription( sal_Int32 _nRow ) const = 0; 121 virtual ::rtl::OUString GetRowName(sal_Int32 _nIndex) const = 0; 122 virtual ::rtl::OUString GetColumnDescription( sal_uInt16 _nColumnPos ) const = 0; 123 virtual ::rtl::OUString GetColumnName( sal_Int32 _nIndex ) const = 0; 124 virtual ::com::sun::star::uno::Any GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; 125 virtual ::rtl::OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const = 0; 126 127 virtual sal_Int32 GetSelectedRowCount() const = 0; 128 virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const = 0; 129 virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0; 130 virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) = 0; 131 virtual void SelectAllRows( bool const i_select ) = 0; 132 }; 133 134 // ---------------------------------------------------------------------------- 135 136 /** interface for an implementation of a table control's Accesible component 137 */ 138 class IAccessibleTableControl 139 { 140 public: 141 /** returns the XAccessible object itself 142 143 The reference returned here can be used to control the life time of the 144 IAccessibleTableImplementation object. 145 146 The returned reference is guaranteed to not be <NULL/>. 147 */ 148 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 149 getMyself() = 0; 150 151 /** disposes the accessible implementation, so that it becomes defunc 152 */ 153 virtual void dispose() = 0; 154 155 /** checks whether the accessible implementation, and its context, are still alive 156 @return <TRUE/>, if the object is not disposed or disposing. 157 */ 158 virtual sal_Bool isAlive() const = 0; 159 160 /** returns the accessible object for the row or the column header bar 161 */ 162 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 163 getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) = 0; 164 165 /** returns the accessible object for the table representation 166 */ 167 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 168 getTable() = 0; 169 170 /** commits the event at all listeners of the cell 171 @param nEventId 172 the event id 173 @param rNewValue 174 the new value 175 @param rOldValue 176 the old value 177 */ 178 virtual void commitCellEvent( 179 sal_Int16 nEventId, 180 const ::com::sun::star::uno::Any& rNewValue, 181 const ::com::sun::star::uno::Any& rOldValue 182 ) = 0; 183 /** commits the event at all listeners of the table 184 @param nEventId 185 the event id 186 @param rNewValue 187 the new value 188 @param rOldValue 189 the old value 190 */ 191 virtual void commitTableEvent( 192 sal_Int16 nEventId, 193 const ::com::sun::star::uno::Any& rNewValue, 194 const ::com::sun::star::uno::Any& rOldValue 195 ) = 0; 196 197 ///** Commits an event to all listeners. */ 198 virtual void commitEvent( 199 sal_Int16 nEventId, 200 const ::com::sun::star::uno::Any& rNewValue, 201 const ::com::sun::star::uno::Any& rOldValue 202 ) = 0; 203 }; 204 205 // ---------------------------------------------------------------------------- 206 207 // ============================================================================ 208 } // namespace table 209 } // namespace svt 210 211 // ============================================================================ 212 213 #endif // _SVTOOLS_ACCESSIBLETABLE_HXX 214 215