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