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