1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 29 #ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX 30 #define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX 31 32 #include "accessibility/extended/AccessibleBrowseBoxBase.hxx" 33 #include <cppuhelper/implbase1.hxx> 34 #include <com/sun/star/accessibility/XAccessibleTable.hpp> 35 36 // ============================================================================ 37 38 namespace accessibility { 39 40 typedef ::cppu::ImplHelper1< 41 ::com::sun::star::accessibility::XAccessibleTable > 42 AccessibleBrowseBoxTableImplHelper; 43 44 /** The BrowseBox accessible table objects inherit from this base class. It 45 implements basic functionality for the XAccessibleTable interface. 46 BrowseBox table objects are: the data table, the column header bar and the 47 row header bar. */ 48 class AccessibleBrowseBoxTableBase : 49 public BrowseBoxAccessibleElement, 50 public AccessibleBrowseBoxTableImplHelper 51 { 52 public: 53 /** Constructor sets specified name and description. If the constant of a 54 text is BBTEXT_NONE, the derived class has to set the text via 55 implSetName() and implSetDescription() (in Ctor) or later via 56 setAccessibleName() and setAccessibleDescription() (these methods 57 notify the listeners about the change). 58 @param rxParent XAccessible interface of the parent object. 59 @param rBrowseBox The BrowseBox control. 60 @param eNameText The constant for the name text. 61 @param eDescrText The constant for the description text. */ 62 AccessibleBrowseBoxTableBase( 63 const ::com::sun::star::uno::Reference< 64 ::com::sun::star::accessibility::XAccessible >& rxParent, 65 ::svt::IAccessibleTableProvider& rBrowseBox, 66 ::svt::AccessibleBrowseBoxObjType eObjType ); 67 68 protected: 69 virtual ~AccessibleBrowseBoxTableBase(); 70 71 public: 72 // XAccessibleContext ----------------------------------------------------- 73 74 /** @return The count of visible children. */ 75 virtual sal_Int32 SAL_CALL getAccessibleChildCount() 76 throw ( ::com::sun::star::uno::RuntimeException ); 77 78 /** @return The role of this object (a table). */ 79 virtual sal_Int16 SAL_CALL getAccessibleRole() 80 throw ( ::com::sun::star::uno::RuntimeException ); 81 82 /* Derived classes have to implement: 83 - getAccessibleChild, 84 - getAccessibleIndexInParent. */ 85 86 // XAccessibleComponent --------------------------------------------------- 87 88 /* Derived classes have to implement: 89 - getAccessibleAt, 90 - grabFocus, 91 - getAccessibleKeyBinding. */ 92 93 // XAccessibleTable ------------------------------------------------------- 94 95 /** @return The number of used rows in the table (0 = empty table). */ 96 virtual sal_Int32 SAL_CALL getAccessibleRowCount() 97 throw ( ::com::sun::star::uno::RuntimeException ); 98 99 /** @return The number of used columns in the table (0 = empty table). */ 100 virtual sal_Int32 SAL_CALL getAccessibleColumnCount() 101 throw ( ::com::sun::star::uno::RuntimeException ); 102 103 /** @return The row extent of the specified cell (always 1). */ 104 virtual sal_Int32 SAL_CALL 105 getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) 106 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 107 ::com::sun::star::uno::RuntimeException ); 108 109 /** @return The column extent of the specified cell (always 1). */ 110 virtual sal_Int32 SAL_CALL 111 getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) 112 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 113 ::com::sun::star::uno::RuntimeException ); 114 115 /** @return The caption cell of the table (not supported). */ 116 virtual ::com::sun::star::uno::Reference< 117 ::com::sun::star::accessibility::XAccessible > SAL_CALL 118 getAccessibleCaption() 119 throw ( ::com::sun::star::uno::RuntimeException ); 120 121 /** @return The summary object of the table (not supported). */ 122 virtual ::com::sun::star::uno::Reference< 123 ::com::sun::star::accessibility::XAccessible > SAL_CALL 124 getAccessibleSummary() 125 throw ( ::com::sun::star::uno::RuntimeException ); 126 127 /** @return The child index of the specified cell. */ 128 virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) 129 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 130 ::com::sun::star::uno::RuntimeException ); 131 132 /** @return The row index of the specified child cell. */ 133 virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) 134 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 135 ::com::sun::star::uno::RuntimeException ); 136 137 /** @return The column index of the specified child cell. */ 138 virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) 139 throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 140 ::com::sun::star::uno::RuntimeException ); 141 142 /* Derived classes have to implement: 143 - getAccessibleRowDescription, 144 - getAccessibleColumnDescription, 145 - getAccessibleRowHeaders, 146 - getAccessibleColumnHeaders, 147 - getSelectedAccessibleRows, 148 - getSelectedAccessibleColumns, 149 - isAccessibleRowSelected, 150 - isAccessibleColumnSelected, 151 - getAccessibleCellAt, 152 - isAccessibleSelected. */ 153 154 // XInterface ------------------------------------------------------------- 155 156 /** Queries for a new interface. */ 157 ::com::sun::star::uno::Any SAL_CALL queryInterface( 158 const ::com::sun::star::uno::Type& rType ) 159 throw ( ::com::sun::star::uno::RuntimeException ); 160 161 /** Aquires the object (calls acquire() on base class). */ 162 virtual void SAL_CALL acquire() throw (); 163 164 /** Releases the object (calls release() on base class). */ 165 virtual void SAL_CALL release() throw (); 166 167 // XTypeProvider ---------------------------------------------------------- 168 169 /** @return A sequence of possible types (received from base classes). */ 170 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() 171 throw ( ::com::sun::star::uno::RuntimeException ); 172 173 /** @return An unique implementation ID. */ 174 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 175 throw ( ::com::sun::star::uno::RuntimeException ); 176 177 // XServiceInfo ----------------------------------------------------------- 178 179 /* Derived classes have to implement: 180 - getImplementationName */ 181 182 protected: 183 // internal virtual methods ----------------------------------------------- 184 185 /** @attention This method requires locked mutex's and a living object. 186 @return The count of data rows without header bar. */ 187 virtual sal_Int32 implGetRowCount() const; 188 /** @attention This method requires locked mutex's and a living object. 189 @return The count of data columns without "handle column". */ 190 virtual sal_Int32 implGetColumnCount() const; 191 192 // internal helper methods ------------------------------------------------ 193 194 /** @return <TRUE/>, if first BrowseBox column is the "handle column". */ 195 sal_Bool implHasHandleColumn() const; 196 197 /** @attention This method requires locked mutex's and a living object. 198 @param nColumn 199 the position of the column in the Accessible world 200 @return 201 the position of the column in VCL the Accessible world 202 */ 203 sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const; 204 205 /** @attention This method requires locked mutex's and a living object. 206 @return The number of cells of the table. */ 207 sal_Int32 implGetChildCount() const; 208 209 /** @attention This method requires locked mutex's and a living object. 210 @return The row index of the specified cell index. */ 211 sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; 212 /** @attention This method requires locked mutex's and a living object. 213 @return The column index of the specified cell index. */ 214 sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; 215 /** @attention This method requires locked mutex's and a living object. 216 @return The child index of the specified cell address. */ 217 sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; 218 219 /** @attention This method requires locked mutex's and a living object. 220 @return <TRUE/>, if the specified row is selected. */ 221 sal_Bool implIsRowSelected( sal_Int32 nRow ) const; 222 /** @attention This method requires locked mutex's and a living object. 223 @return <TRUE/>, if the specified column is selected. */ 224 sal_Bool implIsColumnSelected( sal_Int32 nColumn ) const; 225 226 /** Selects/deselects a row (tries to expand selection). 227 @attention This method requires locked mutex's and a living object. 228 @param bSelect <TRUE/> = select, <FALSE/> = deselect */ 229 void implSelectRow( sal_Int32 nRow, sal_Bool bSelect ); 230 /** Selects/deselects a column (tries to expand selection). 231 @attention This method requires locked mutex's and a living object. 232 @param bSelect <TRUE/> = select, <FALSE/> = deselect */ 233 void implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect ); 234 235 /** @attention This method requires locked mutex's and a living object. 236 @return The count of selected rows. */ 237 sal_Int32 implGetSelectedRowCount() const; 238 /** @attention This method requires locked mutex's and a living object. 239 @return The count of selected columns. */ 240 sal_Int32 implGetSelectedColumnCount() const; 241 242 /** Fills a sequence with sorted indexes of completely selected rows. 243 @attention This method requires locked mutex's and a living object. 244 @param rSeq Out-parameter that takes the sorted row index list. */ 245 void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); 246 /** Fills a sequence with sorted indexes of completely selected columns. 247 @attention This method requires locked mutex's and a living object. 248 @param rSeq Out-parameter that takes the sorted column index list. */ 249 void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); 250 251 /** @attention This method requires locked mutex's and a living object. 252 @throws <type>IndexOutOfBoundsException</type> 253 If the specified row index is invalid. */ 254 void ensureIsValidRow( sal_Int32 nRow ) 255 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 256 /** @attention This method requires locked mutex's and a living object. 257 @throws <type>IndexOutOfBoundsException</type> 258 If the specified column index is invalid. */ 259 void ensureIsValidColumn( sal_Int32 nColumn ) 260 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 261 /** @attention This method requires locked mutex's and a living object. 262 @throws <type>IndexOutOfBoundsException</type> 263 If the specified cell address is invalid. */ 264 void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn ) 265 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 266 /** @attention This method requires locked mutex's and a living object. 267 @throws <type>IndexOutOfBoundsException</type> 268 If the specified child index is invalid. */ 269 void ensureIsValidIndex( sal_Int32 nChildIndex ) 270 throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); 271 }; 272 273 // ============================================================================ 274 275 } // namespace accessibility 276 277 // ============================================================================ 278 279 #endif 280 281