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 25 #ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX 26 #define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX 27 28 #include "accessibility/extended/AccessibleGridControlBase.hxx" 29 #include <cppuhelper/implbase1.hxx> 30 #include <com/sun/star/accessibility/XAccessibleTable.hpp> 31 32 // ============================================================================ 33 34 namespace accessibility { 35 36 typedef ::cppu::ImplHelper1< 37 ::com::sun::star::accessibility::XAccessibleTable > 38 AccessibleGridControlTableImplHelper; 39 40 /** The Grid Control accessible table objects inherit from this base class. It 41 implements basic functionality for the XAccessibleTable interface. 42 Grid COntrol table objects are: the data table, the column header bar and the 43 row header bar. */ 44 class AccessibleGridControlTableBase : 45 public GridControlAccessibleElement, 46 public AccessibleGridControlTableImplHelper 47 { 48 public: 49 /** Constructor sets specified name and description. 50 @param rxParent XAccessible interface of the parent object. 51 @param rTable The Table control. 52 @param eNameText The constant for the name text. 53 @param eDescrText The constant for the description text. */ 54 AccessibleGridControlTableBase( 55 const ::com::sun::star::uno::Reference< 56 ::com::sun::star::accessibility::XAccessible >& rxParent, 57 ::svt::table::IAccessibleTable& rTable, 58 ::svt::table::AccessibleTableControlObjType eObjType ); 59 60 protected: 61 virtual ~AccessibleGridControlTableBase(); 62 63 public: 64 // XAccessibleContext ----------------------------------------------------- 65 66 /** @return The count of visible children. */ 67 virtual sal_Int32 SAL_CALL getAccessibleChildCount() 68 throw ( ::com::sun::star::uno::RuntimeException ); 69 70 /** @return The role of this object (a table). */ 71 virtual sal_Int16 SAL_CALL getAccessibleRole() 72 throw ( ::com::sun::star::uno::RuntimeException ); 73 74 /* Derived classes have to implement: 75 - getAccessibleChild, 76 - getAccessibleIndexInParent. */ 77 78 // XAccessibleComponent --------------------------------------------------- 79 80 /* Derived classes have to implement: 81 - getAccessibleAt, 82 - grabFocus, 83 - getAccessibleKeyBinding. */ 84 85 // XAccessibleTable ------------------------------------------------------- 86 87 /** @return The number of used rows in the table (0 = empty table). */ 88 virtual sal_Int32 SAL_CALL getAccessibleRowCount() 89 throw ( ::com::sun::star::uno::RuntimeException ); 90 91 /** @return The number of used columns in the table (0 = empty table). */ 92 virtual sal_Int32 SAL_CALL getAccessibleColumnCount() 93 throw ( ::com::sun::star::uno::RuntimeException ); 94 95 /** @return The row extent of the specified cell (always 1). */ 96 virtual sal_Int32 SAL_CALL 97 getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) 98 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 99 ::com::sun::star::uno::RuntimeException ); 100 101 /** @return The column extent of the specified cell (always 1). */ 102 virtual sal_Int32 SAL_CALL 103 getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) 104 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 105 ::com::sun::star::uno::RuntimeException ); 106 107 /** @return The caption cell of the table (not supported). */ 108 virtual ::com::sun::star::uno::Reference< 109 ::com::sun::star::accessibility::XAccessible > SAL_CALL 110 getAccessibleCaption() 111 throw ( ::com::sun::star::uno::RuntimeException ); 112 113 /** @return The summary object of the table (not supported). */ 114 virtual ::com::sun::star::uno::Reference< 115 ::com::sun::star::accessibility::XAccessible > SAL_CALL 116 getAccessibleSummary() 117 throw ( ::com::sun::star::uno::RuntimeException ); 118 119 /** @return The child index of the specified cell. */ 120 virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) 121 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 122 ::com::sun::star::uno::RuntimeException ); 123 124 /** @return The row index of the specified child cell. */ 125 virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) 126 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 127 ::com::sun::star::uno::RuntimeException ); 128 129 /** @return The column index of the specified child cell. */ 130 virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) 131 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 132 ::com::sun::star::uno::RuntimeException ); 133 134 /* Derived classes have to implement: 135 - getAccessibleRowDescription, 136 - getAccessibleColumnDescription, 137 - getAccessibleRowHeaders, 138 - getAccessibleColumnHeaders, 139 - getSelectedAccessibleRows, 140 - getSelectedAccessibleColumns, 141 - isAccessibleRowSelected, 142 - isAccessibleColumnSelected, 143 - getAccessibleCellAt, 144 - isAccessibleSelected. */ 145 146 // XInterface ------------------------------------------------------------- 147 148 /** Queries for a new interface. */ 149 ::com::sun::star::uno::Any SAL_CALL queryInterface( 150 const ::com::sun::star::uno::Type& rType ) 151 throw ( ::com::sun::star::uno::RuntimeException ); 152 153 /** Aquires the object (calls acquire() on base class). */ 154 virtual void SAL_CALL acquire() throw (); 155 156 /** Releases the object (calls release() on base class). */ 157 virtual void SAL_CALL release() throw (); 158 159 // XTypeProvider ---------------------------------------------------------- 160 161 /** @return A sequence of possible types (received from base classes). */ 162 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() 163 throw ( ::com::sun::star::uno::RuntimeException ); 164 165 /** @return An unique implementation ID. */ 166 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 167 throw ( ::com::sun::star::uno::RuntimeException ); 168 169 protected: 170 // internal helper methods ------------------------------------------------ 171 172 // /** @attention This method requires locked mutex's and a living object. 173 // @param nColumn 174 // the position of the column in the Accessible world 175 // @return 176 // the position of the column in VCL the Accessible world 177 // */ 178 // sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const; 179 180 /** @attention This method requires locked mutex's and a living object. 181 @return The number of cells of the table. */ 182 sal_Int32 implGetChildCount() const; 183 184 /** @attention This method requires locked mutex's and a living object. 185 @return The row index of the specified cell index. */ 186 sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; 187 /** @attention This method requires locked mutex's and a living object. 188 @return The column index of the specified cell index. */ 189 sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; 190 /** @attention This method requires locked mutex's and a living object. 191 @return The child index of the specified cell address. */ 192 sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; 193 194 /** Fills a sequence with sorted indexes of completely selected rows. 195 @attention This method requires locked mutex's and a living object. 196 @param rSeq Out-parameter that takes the sorted row index list. */ 197 void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); 198 /** Fills a sequence with sorted indexes of completely selected columns. 199 @attention This method requires locked mutex's and a living object. 200 @param rSeq Out-parameter that takes the sorted column index list. */ 201 //void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); 202 203 /** @attention This method requires locked mutex's and a living object. 204 @throws <type>IndexOutOfBoundsException</type> 205 If the specified row index is invalid. */ 206 void ensureIsValidRow( sal_Int32 nRow ) 207 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 208 /** @attention This method requires locked mutex's and a living object. 209 @throws <type>IndexOutOfBoundsException</type> 210 If the specified column index is invalid. */ 211 void ensureIsValidColumn( sal_Int32 nColumn ) 212 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 213 /** @attention This method requires locked mutex's and a living object. 214 @throws <type>IndexOutOfBoundsException</type> 215 If the specified cell address is invalid. */ 216 void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn ) 217 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 218 /** @attention This method requires locked mutex's and a living object. 219 @throws <type>IndexOutOfBoundsException</type> 220 If the specified child index is invalid. */ 221 void ensureIsValidIndex( sal_Int32 nChildIndex ) 222 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 223 }; 224 225 // ============================================================================ 226 227 } // namespace accessibility 228 229 // ============================================================================ 230 231 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLEBASE_HXX 232 233