1a462bbb7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3a462bbb7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4a462bbb7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5a462bbb7SAndrew Rist * distributed with this work for additional information 6a462bbb7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7a462bbb7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8a462bbb7SAndrew Rist * "License"); you may not use this file except in compliance 9a462bbb7SAndrew Rist * with the License. You may obtain a copy of the License at 10a462bbb7SAndrew Rist * 11a462bbb7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12a462bbb7SAndrew Rist * 13a462bbb7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14a462bbb7SAndrew Rist * software distributed under the License is distributed on an 15a462bbb7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16a462bbb7SAndrew Rist * KIND, either express or implied. See the License for the 17a462bbb7SAndrew Rist * specific language governing permissions and limitations 18a462bbb7SAndrew Rist * under the License. 19a462bbb7SAndrew Rist * 20a462bbb7SAndrew Rist *************************************************************/ 21a462bbb7SAndrew Rist 22a462bbb7SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX 25cdf0e10cSrcweir #define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "AccessibleBrowseBoxTable.hxx" 28cdf0e10cSrcweir #include <comphelper/uno3.hxx> 29cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 30cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 31cdf0e10cSrcweir 32cdf0e10cSrcweir class SvHeaderTabListBox; 33cdf0e10cSrcweir 34cdf0e10cSrcweir // ============================================================================ 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace accessibility { 37cdf0e10cSrcweir 38cdf0e10cSrcweir typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > 39cdf0e10cSrcweir AccessibleTabListBoxTableImplHelper; 40cdf0e10cSrcweir 41cdf0e10cSrcweir class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper 42cdf0e10cSrcweir { 43cdf0e10cSrcweir private: 44cdf0e10cSrcweir SvHeaderTabListBox* m_pTabListBox; 45*21075d77SSteve Yin 46*21075d77SSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xCurChild; 47cdf0e10cSrcweir 48cdf0e10cSrcweir void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); 49cdf0e10cSrcweir DECL_LINK( WindowEventListener, VclSimpleEvent* ); 50cdf0e10cSrcweir 51cdf0e10cSrcweir // helpers ---------------------------------------------------------------- 52cdf0e10cSrcweir 53cdf0e10cSrcweir /** Throws an exception, if nIndex is not a valid child index. */ 54cdf0e10cSrcweir void ensureValidIndex( sal_Int32 _nIndex ) const 55cdf0e10cSrcweir SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ); 56cdf0e10cSrcweir 57cdf0e10cSrcweir /** Returns true, if the specified row is selected. */ 58cdf0e10cSrcweir sal_Bool implIsRowSelected( sal_Int32 _nRow ) const; 59cdf0e10cSrcweir /** Selects the specified row. */ 60cdf0e10cSrcweir void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect ); 61cdf0e10cSrcweir 62cdf0e10cSrcweir /** Returns the count of rows in the table. */ 63cdf0e10cSrcweir sal_Int32 implGetRowCount() const; 64cdf0e10cSrcweir /** Returns the total column count in the table. */ 65cdf0e10cSrcweir sal_Int32 implGetColumnCount() const; 66cdf0e10cSrcweir /** Returns the count of selected rows in the table. */ 67cdf0e10cSrcweir sal_Int32 implGetSelRowCount() const; 68cdf0e10cSrcweir /** Returns the total cell count in the table (including header). */ implGetCellCount() const69cdf0e10cSrcweir inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); } 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** Returns the row index from cell index. */ implGetRow(sal_Int32 _nIndex) const72cdf0e10cSrcweir inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); } 73cdf0e10cSrcweir /** Returns the column index from cell index. */ implGetColumn(sal_Int32 _nIndex) const74cdf0e10cSrcweir inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); } 75cdf0e10cSrcweir /** Returns the absolute row index of the nSelRow-th selected row. */ 76cdf0e10cSrcweir sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const; 77cdf0e10cSrcweir /** Returns the child index from cell position. */ implGetIndex(sal_Int32 _nRow,sal_Int32 _nColumn) const78cdf0e10cSrcweir inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; } 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir /** ctor() 82cdf0e10cSrcweir @param rxParent XAccessible interface of the parent object. 83cdf0e10cSrcweir @param rBox The HeaderTabListBox control. */ 84cdf0e10cSrcweir AccessibleTabListBoxTable( 85cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, 86cdf0e10cSrcweir SvHeaderTabListBox& rBox ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir protected: 89cdf0e10cSrcweir /** dtor() */ 90cdf0e10cSrcweir virtual ~AccessibleTabListBoxTable(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir public: 93cdf0e10cSrcweir // XInterface 94cdf0e10cSrcweir DECLARE_XINTERFACE( ) 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XTypeProvider 97cdf0e10cSrcweir DECLARE_XTYPEPROVIDER( ) 98cdf0e10cSrcweir 99cdf0e10cSrcweir // XServiceInfo 100cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName (void) 101cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir 103cdf0e10cSrcweir // XAccessibleSelection 104cdf0e10cSrcweir void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 105cdf0e10cSrcweir sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 107cdf0e10cSrcweir void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 111cdf0e10cSrcweir }; 112cdf0e10cSrcweir 113cdf0e10cSrcweir // ============================================================================ 114cdf0e10cSrcweir 115cdf0e10cSrcweir } // namespace accessibility 116cdf0e10cSrcweir 117cdf0e10cSrcweir // ============================================================================ 118cdf0e10cSrcweir 119cdf0e10cSrcweir #endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX 120cdf0e10cSrcweir 121