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