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 ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX 25 #define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX 26 27 #include "AccessibleBrowseBoxTable.hxx" 28 #include <comphelper/uno3.hxx> 29 #include <cppuhelper/implbase1.hxx> 30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 31 32 class SvHeaderTabListBox; 33 34 // ============================================================================ 35 36 namespace accessibility { 37 38 typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > 39 AccessibleTabListBoxTableImplHelper; 40 41 class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper 42 { 43 private: 44 SvHeaderTabListBox* m_pTabListBox; 45 46 void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); 47 DECL_LINK( WindowEventListener, VclSimpleEvent* ); 48 49 // helpers ---------------------------------------------------------------- 50 51 /** Throws an exception, if nIndex is not a valid child index. */ 52 void ensureValidIndex( sal_Int32 _nIndex ) const 53 SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ); 54 55 /** Returns true, if the specified row is selected. */ 56 sal_Bool implIsRowSelected( sal_Int32 _nRow ) const; 57 /** Selects the specified row. */ 58 void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect ); 59 60 /** Returns the count of rows in the table. */ 61 sal_Int32 implGetRowCount() const; 62 /** Returns the total column count in the table. */ 63 sal_Int32 implGetColumnCount() const; 64 /** Returns the count of selected rows in the table. */ 65 sal_Int32 implGetSelRowCount() const; 66 /** Returns the total cell count in the table (including header). */ 67 inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); } 68 69 /** Returns the row index from cell index. */ 70 inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); } 71 /** Returns the column index from cell index. */ 72 inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); } 73 /** Returns the absolute row index of the nSelRow-th selected row. */ 74 sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const; 75 /** Returns the child index from cell position. */ 76 inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; } 77 78 public: 79 /** ctor() 80 @param rxParent XAccessible interface of the parent object. 81 @param rBox The HeaderTabListBox control. */ 82 AccessibleTabListBoxTable( 83 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, 84 SvHeaderTabListBox& rBox ); 85 86 protected: 87 /** dtor() */ 88 virtual ~AccessibleTabListBoxTable(); 89 90 public: 91 // XInterface 92 DECLARE_XINTERFACE( ) 93 94 // XTypeProvider 95 DECLARE_XTYPEPROVIDER( ) 96 97 // XServiceInfo 98 virtual ::rtl::OUString SAL_CALL getImplementationName (void) 99 throw (::com::sun::star::uno::RuntimeException); 100 101 // XAccessibleSelection 102 void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 103 sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 104 void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); 105 void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); 106 sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); 107 ::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); 108 void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 109 }; 110 111 // ============================================================================ 112 113 } // namespace accessibility 114 115 // ============================================================================ 116 117 #endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX 118 119