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 _SC_ACCESSIBLETABLEBASE_HXX 26 #define _SC_ACCESSIBLETABLEBASE_HXX 27 28 #include "AccessibleContextBase.hxx" 29 #include "global.hxx" 30 #include "address.hxx" 31 #include <com/sun/star/accessibility/XAccessibleTable.hpp> 32 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 33 #include <cppuhelper/implbase2.hxx> 34 35 class ScTabViewShell; 36 37 /** @descr 38 This base class provides an implementation of the 39 <code>AccessibleTable</code> service. 40 */ 41 42 typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleTable, 43 ::com::sun::star::accessibility::XAccessibleSelection> 44 ScAccessibleTableBaseImpl; 45 46 class ScAccessibleTableBase : 47 public ScAccessibleContextBase, 48 public ScAccessibleTableBaseImpl 49 { 50 public: 51 //===== internal ======================================================== 52 ScAccessibleTableBase( 53 const ::com::sun::star::uno::Reference< 54 ::com::sun::star::accessibility::XAccessible>& rxParent, 55 ScDocument* pDoc, 56 const ScRange& rRange); 57 protected: 58 virtual ~ScAccessibleTableBase(); 59 public: 60 61 using ScAccessibleContextBase::disposing; 62 virtual void SAL_CALL disposing(); 63 64 ///===== XInterface ===================================================== 65 66 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 67 ::com::sun::star::uno::Type const & rType ) 68 throw (::com::sun::star::uno::RuntimeException); 69 70 virtual void SAL_CALL acquire() throw (); 71 72 virtual void SAL_CALL release() throw (); 73 74 ///===== XAccessibleTable ================================================ 75 76 /// Returns the number of rows in the table. 77 virtual sal_Int32 SAL_CALL 78 getAccessibleRowCount( ) 79 throw (::com::sun::star::uno::RuntimeException); 80 81 /// Returns the number of columns in the table. 82 virtual sal_Int32 SAL_CALL 83 getAccessibleColumnCount( ) 84 throw (::com::sun::star::uno::RuntimeException); 85 86 /// Returns the description of the specified row in the table. 87 virtual ::rtl::OUString SAL_CALL 88 getAccessibleRowDescription( sal_Int32 nRow ) 89 throw (::com::sun::star::uno::RuntimeException, 90 ::com::sun::star::lang::IndexOutOfBoundsException); 91 92 /// Returns the description text of the specified column in the table. 93 virtual ::rtl::OUString SAL_CALL 94 getAccessibleColumnDescription( sal_Int32 nColumn ) 95 throw (::com::sun::star::uno::RuntimeException, 96 ::com::sun::star::lang::IndexOutOfBoundsException); 97 98 /** Returns the number of rows occupied by the Accessible at a specified row and column in the table. 99 Returns 1 if it is only a cell and the number of rows the cell is merged if the cell is a merged cell. 100 */ 101 virtual sal_Int32 SAL_CALL 102 getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) 103 throw (::com::sun::star::uno::RuntimeException, 104 ::com::sun::star::lang::IndexOutOfBoundsException); 105 106 /** Returns the number of columns occupied by the Accessible at a specified row and column in the table. 107 Returns 1 if it is only a cell and the number of columns the cell is merged if the cell is a merged cell. 108 */ 109 virtual sal_Int32 SAL_CALL 110 getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) 111 throw (::com::sun::star::uno::RuntimeException, 112 ::com::sun::star::lang::IndexOutOfBoundsException); 113 114 /// Returns the row headers as an AccessibleTable. 115 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL 116 getAccessibleRowHeaders( ) 117 throw (::com::sun::star::uno::RuntimeException); 118 119 /// Returns the column headers as an AccessibleTable. 120 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL 121 getAccessibleColumnHeaders( ) 122 throw (::com::sun::star::uno::RuntimeException); 123 124 /// Returns the selected rows in a table. 125 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL 126 getSelectedAccessibleRows( ) 127 throw (::com::sun::star::uno::RuntimeException); 128 129 /// Returns the selected columns in a table. 130 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL 131 getSelectedAccessibleColumns( ) 132 throw (::com::sun::star::uno::RuntimeException); 133 134 /// Returns a boolean value indicating whether the specified row is selected. 135 virtual sal_Bool SAL_CALL 136 isAccessibleRowSelected( sal_Int32 nRow ) 137 throw (::com::sun::star::uno::RuntimeException, 138 ::com::sun::star::lang::IndexOutOfBoundsException); 139 140 /// Returns a boolean value indicating whether the specified column is selected. 141 virtual sal_Bool SAL_CALL 142 isAccessibleColumnSelected( sal_Int32 nColumn ) 143 throw (::com::sun::star::uno::RuntimeException, 144 ::com::sun::star::lang::IndexOutOfBoundsException); 145 146 /// Returns the Accessible at a specified row and column in the table. 147 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL 148 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) 149 throw (::com::sun::star::uno::RuntimeException, 150 ::com::sun::star::lang::IndexOutOfBoundsException); 151 152 /// Returns the caption for the table. 153 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL 154 getAccessibleCaption( ) 155 throw (::com::sun::star::uno::RuntimeException); 156 157 /// Returns the summary description of the table. 158 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL 159 getAccessibleSummary( ) 160 throw (::com::sun::star::uno::RuntimeException); 161 162 /// Returns a boolean value indicating whether the accessible at a specified row and column is selected. 163 virtual sal_Bool SAL_CALL 164 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) 165 throw (::com::sun::star::uno::RuntimeException, 166 ::com::sun::star::lang::IndexOutOfBoundsException); 167 168 ///===== XAccessibleExtendedTable ======================================== 169 170 /// Returns the index of the cell on the given position. 171 virtual sal_Int32 SAL_CALL 172 getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) 173 throw (::com::sun::star::uno::RuntimeException, 174 ::com::sun::star::lang::IndexOutOfBoundsException); 175 176 /// Returns the row number of an index in the table. 177 virtual sal_Int32 SAL_CALL 178 getAccessibleRow( sal_Int32 nChildIndex ) 179 throw (::com::sun::star::uno::RuntimeException, 180 ::com::sun::star::lang::IndexOutOfBoundsException); 181 182 /// Returns the column number of an index in the table. 183 virtual sal_Int32 SAL_CALL 184 getAccessibleColumn( sal_Int32 nChildIndex ) 185 throw (::com::sun::star::uno::RuntimeException, 186 ::com::sun::star::lang::IndexOutOfBoundsException); 187 188 //===== XAccessibleContext ============================================== 189 190 /// Return the number of currently visible children. 191 // is overloaded to calculate this on demand 192 virtual sal_Int32 SAL_CALL 193 getAccessibleChildCount(void) 194 throw (::com::sun::star::uno::RuntimeException); 195 196 /// Return the specified child or NULL if index is invalid. 197 // is overloaded to calculate this on demand 198 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 199 getAccessibleChild(sal_Int32 nIndex) 200 throw (::com::sun::star::uno::RuntimeException, 201 ::com::sun::star::lang::IndexOutOfBoundsException); 202 203 protected: 204 /// Return this object's description. 205 virtual ::rtl::OUString SAL_CALL 206 createAccessibleDescription(void) 207 throw (::com::sun::star::uno::RuntimeException); 208 209 /// Return the object's current name. 210 virtual ::rtl::OUString SAL_CALL 211 createAccessibleName(void) 212 throw (::com::sun::star::uno::RuntimeException); 213 214 public: 215 /// Return NULL to indicate that an empty relation set. 216 virtual ::com::sun::star::uno::Reference< 217 ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL 218 getAccessibleRelationSet(void) 219 throw (::com::sun::star::uno::RuntimeException); 220 221 /// Return the set of current states. 222 // perhaps sometimes to be implemented 223 virtual ::com::sun::star::uno::Reference< 224 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 225 getAccessibleStateSet(void) 226 throw (::com::sun::star::uno::RuntimeException); 227 228 ///===== XAccessibleSelection =========================================== 229 230 virtual void SAL_CALL 231 selectAccessibleChild( sal_Int32 nChildIndex ) 232 throw (::com::sun::star::lang::IndexOutOfBoundsException, 233 ::com::sun::star::uno::RuntimeException); 234 235 virtual sal_Bool SAL_CALL 236 isAccessibleChildSelected( sal_Int32 nChildIndex ) 237 throw (::com::sun::star::lang::IndexOutOfBoundsException, 238 ::com::sun::star::uno::RuntimeException); 239 240 virtual void SAL_CALL 241 clearAccessibleSelection( ) 242 throw (::com::sun::star::uno::RuntimeException); 243 244 virtual void SAL_CALL 245 selectAllAccessibleChildren( ) 246 throw (::com::sun::star::uno::RuntimeException); 247 248 virtual sal_Int32 SAL_CALL 249 getSelectedAccessibleChildCount( ) 250 throw (::com::sun::star::uno::RuntimeException); 251 252 virtual ::com::sun::star::uno::Reference< 253 ::com::sun::star::accessibility::XAccessible > SAL_CALL 254 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 255 throw (::com::sun::star::lang::IndexOutOfBoundsException, 256 ::com::sun::star::uno::RuntimeException); 257 258 virtual void SAL_CALL 259 deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) 260 throw (::com::sun::star::lang::IndexOutOfBoundsException, 261 ::com::sun::star::uno::RuntimeException); 262 263 ///===== XServiceInfo =================================================== 264 265 /** Returns an identifier for the implementation of this object. 266 */ 267 virtual ::rtl::OUString SAL_CALL 268 getImplementationName(void) 269 throw (::com::sun::star::uno::RuntimeException); 270 271 ///===== XTypeProvider =================================================== 272 273 /// returns the possible types 274 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL 275 getTypes() 276 throw (::com::sun::star::uno::RuntimeException); 277 278 /** Returns a implementation id. 279 */ 280 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL 281 getImplementationId(void) 282 throw (::com::sun::star::uno::RuntimeException); 283 284 protected: 285 /// contains the range of the table, because it could be a subrange of the complete table 286 ScRange maRange; 287 288 ScDocument* mpDoc; 289 290 void CommitTableModelChange(sal_Int32 nStartRow, sal_Int32 nStartCol, sal_Int32 nEndRow, sal_Int32 nEndCol, sal_uInt16 nId); 291 }; 292 293 294 #endif 295