LCOV - code coverage report
Current view: top level - sw/source/core/access - acctable.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 8 18 44.4 %
Date: 2014-04-11 Functions: 4 9 44.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SW_SOURCE_CORE_ACCESS_ACCTABLE_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCTABLE_HXX
      22             : 
      23             : #include <com/sun/star/accessibility/XAccessibleTable.hpp>
      24             : #include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
      25             : #include <vector>
      26             : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
      27             : 
      28             : #include <acccontext.hxx>
      29             : 
      30             : class SwTabFrm;
      31             : class SwAccessibleTableData_Impl;
      32             : class SwTableBox;
      33             : class SwSelBoxes;
      34             : 
      35             : namespace sw { namespace access {
      36             :     class SwAccessibleChild;
      37             : } }
      38             : 
      39             : class SwAccessibleTable :
      40             :         public SwAccessibleContext,
      41             :         public ::com::sun::star::accessibility::XAccessibleTable,
      42             :         public ::com::sun::star::accessibility::XAccessibleSelection,
      43             :         public   ::com::sun::star::accessibility::XAccessibleTableSelection,
      44             :         public SwClient
      45             : {
      46             :     SwAccessibleTableData_Impl *mpTableData;    // the table's data, prot by Sol-Mutex
      47             :     OUString sDesc;
      48             :     const SwSelBoxes *GetSelBoxes() const;
      49             : 
      50             :     void FireTableChangeEvent( const SwAccessibleTableData_Impl& rTableData );
      51             : 
      52             :     /** get the SwTableBox* for the given child */
      53             :     const SwTableBox* GetTableBox( sal_Int32 ) const;
      54             : 
      55             :     sal_Bool IsChildSelected( sal_Int32 nChildIndex ) const;
      56             : 
      57             :     sal_Int32 GetIndexOfSelectedChild( sal_Int32 nSelectedChildIndex ) const;
      58             : 
      59             : protected:
      60             :     // Set states for getAccessibleStateSet.
      61             :     // This drived class additinaly sets MULTISELECTABLE(+)
      62             :     virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) SAL_OVERRIDE;
      63             : 
      64             :     virtual ~SwAccessibleTable();
      65             : 
      66             :     // #i77106#
      67           0 :     inline void SetDesc( const OUString& sNewDesc )
      68             :     {
      69           0 :         sDesc = sNewDesc;
      70           0 :     }
      71             : 
      72             :     virtual SwAccessibleTableData_Impl* CreateNewTableData(); // #i77106#
      73             : 
      74             :     // force update of table data
      75             :     void UpdateTableData();
      76             : 
      77             :     // remove the current table data
      78             :     void ClearTableData();
      79             : 
      80             :     // get table data, update if necessary
      81             :     inline SwAccessibleTableData_Impl& GetTableData();
      82             : 
      83             :     // Is table data evailable?
      84          11 :     sal_Bool HasTableData() const { return (mpTableData != 0); }
      85             : 
      86             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
      87             : 
      88             : public:
      89             :     SwAccessibleTable( SwAccessibleMap* pInitMap, const SwTabFrm* pTableFrm );
      90             : 
      91             :     //=====  XInterface  ======================================================
      92             : 
      93             :     // (XInterface methods need to be implemented to disambigouate
      94             :     // between those inherited through SwAcessibleContext and
      95             :     // XAccessibleTable).
      96             : 
      97             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
      98             :         const ::com::sun::star::uno::Type& aType )
      99             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             : 
     101         394 :     virtual void SAL_CALL acquire(  ) throw () SAL_OVERRIDE
     102         394 :         { SwAccessibleContext::acquire(); };
     103             : 
     104         394 :     virtual void SAL_CALL release(  ) throw () SAL_OVERRIDE
     105         394 :         { SwAccessibleContext::release(); };
     106             : 
     107             :     //====== XTypeProvider ====================================================
     108             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     110             : 
     111             :     //=====  XAccessibleContext  ==============================================
     112             : 
     113             :     /// Return this object's description.
     114             :     virtual OUString SAL_CALL
     115             :         getAccessibleDescription (void)
     116             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     117             : 
     118             :     //=====  XAccessibleTable  ================================================
     119             : 
     120             :     virtual sal_Int32 SAL_CALL getAccessibleRowCount()
     121             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             :     virtual sal_Int32 SAL_CALL getAccessibleColumnCount(  )
     123             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     124             :     virtual OUString SAL_CALL getAccessibleRowDescription(
     125             :             sal_Int32 nRow )
     126             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     127             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     virtual OUString SAL_CALL getAccessibleColumnDescription(
     129             :             sal_Int32 nColumn )
     130             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     131             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     132             :     virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(
     133             :             sal_Int32 nRow, sal_Int32 nColumn )
     134             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     135             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(
     137             :                sal_Int32 nRow, sal_Int32 nColumn )
     138             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     139             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             :     virtual ::com::sun::star::uno::Reference<
     141             :                 ::com::sun::star::accessibility::XAccessibleTable >
     142             :         SAL_CALL getAccessibleRowHeaders(  )
     143             :            throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     144             :     virtual ::com::sun::star::uno::Reference<
     145             :                 ::com::sun::star::accessibility::XAccessibleTable >
     146             :         SAL_CALL getAccessibleColumnHeaders(  )
     147             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
     149             :         getSelectedAccessibleRows(  )
     150             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     151             :     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
     152             :         getSelectedAccessibleColumns(  )
     153             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             :     virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
     155             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     156             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             :     virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
     158             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     159             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             :     virtual ::com::sun::star::uno::Reference<
     161             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
     162             :         getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
     163             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     164             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     165             :     virtual ::com::sun::star::uno::Reference<
     166             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
     167             :         getAccessibleCaption(  )
     168             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             :     virtual ::com::sun::star::uno::Reference<
     170             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
     171             :         getAccessibleSummary(  )
     172             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             :     virtual sal_Bool SAL_CALL isAccessibleSelected(
     174             :             sal_Int32 nRow, sal_Int32 nColumn )
     175             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     176             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             :     virtual sal_Int32 SAL_CALL getAccessibleIndex(
     178             :             sal_Int32 nRow, sal_Int32 nColumn )
     179             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     180             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     181             :     virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
     182             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     183             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             :     virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
     185             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     186             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     187             :     //=====  XAccessibleTableSelection  ============================================
     188             :     virtual sal_Bool SAL_CALL selectRow( sal_Int32 row )
     189             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     190             :     virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column )
     191             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     192             :     virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row )
     193             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     194             :                ::com::sun::star::uno::RuntimeException,
     195             :                std::exception) SAL_OVERRIDE;
     196             :     virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column )
     197             :         throw (::com::sun::star::lang::IndexOutOfBoundsException,
     198             :                ::com::sun::star::uno::RuntimeException,
     199             :                std::exception) SAL_OVERRIDE;
     200             :     //=====  XServiceInfo  ====================================================
     201             : 
     202             :     /** Returns an identifier for the implementation of this object.
     203             :     */
     204             :     virtual OUString SAL_CALL
     205             :         getImplementationName (void)
     206             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     207             : 
     208             :     /** Return whether the specified service is supported by this class.
     209             :     */
     210             :     virtual sal_Bool SAL_CALL
     211             :         supportsService (const OUString& sServiceName)
     212             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     213             : 
     214             :     /** Returns a list of all supported services.  In this case that is just
     215             :         the AccessibleContext service.
     216             :     */
     217             :     virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
     218             :         getSupportedServiceNames (void)
     219             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     220             : 
     221             :     //===== C++ interface ======================================================
     222             : 
     223             :     // The object has been moved by the layout
     224             :     virtual void InvalidatePosOrSize( const SwRect& rOldBox ) SAL_OVERRIDE;
     225             : 
     226             :     // The object is not visible an longer and should be destroyed
     227             :     virtual void Dispose( sal_Bool bRecursive = sal_False ) SAL_OVERRIDE;
     228             : 
     229             :     virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
     230             :                                sal_Bool bRecursive ) SAL_OVERRIDE;
     231             :     virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
     232             :                                            const SwRect& rFrm ) SAL_OVERRIDE;
     233             : 
     234             :     //=====  XAccessibleSelection  ============================================
     235             : 
     236             :     virtual void SAL_CALL selectAccessibleChild(
     237             :         sal_Int32 nChildIndex )
     238             :         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
     239             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     240             : 
     241             :     virtual sal_Bool SAL_CALL isAccessibleChildSelected(
     242             :         sal_Int32 nChildIndex )
     243             :         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
     244             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     245             : 
     246             :     virtual void SAL_CALL clearAccessibleSelection(  )
     247             :         throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     248             : 
     249             :     virtual void SAL_CALL selectAllAccessibleChildren(  )
     250             :         throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     251             : 
     252             :     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  )
     253             :         throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     254             : 
     255             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
     256             :         sal_Int32 nSelectedChildIndex )
     257             :         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
     258             :                 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     259             : 
     260             :     // index has to be treated as global child index.
     261             :     virtual void SAL_CALL deselectAccessibleChild(
     262             :         sal_Int32 nChildIndex )
     263             :         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
     264             :                 ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     265             : 
     266             :     //=====  XAccessibleComponent  ============================================
     267             :     sal_Int32 SAL_CALL getBackground()
     268             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     269             :     typedef std::vector<const SwAccessibleContext*> VEC_CELL;
     270             :     VEC_CELL m_vecCellAdd;
     271             :     VEC_CELL m_vecCellRemove;
     272             :     void FireSelectionEvent( );
     273             :     void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove);
     274             : };
     275             : 
     276          20 : inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
     277             : {
     278          20 :     if( !mpTableData )
     279           0 :         UpdateTableData();
     280          20 :     return *mpTableData;
     281             : }
     282             : 
     283             : // #i77106# - subclass to represent table column headers
     284             : class SwAccessibleTableColHeaders : public SwAccessibleTable
     285             : {
     286             : protected:
     287           0 :     virtual ~SwAccessibleTableColHeaders()
     288           0 :     {}
     289             : 
     290             :     virtual SwAccessibleTableData_Impl* CreateNewTableData() SAL_OVERRIDE;
     291             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
     292             : 
     293             : public:
     294             :     SwAccessibleTableColHeaders( SwAccessibleMap *pMap, const SwTabFrm *pTabFrm );
     295             : 
     296             :     //=====  XInterface  ======================================================
     297             : 
     298             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
     299             :         const ::com::sun::star::uno::Type& aType )
     300             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     301             : 
     302           0 :     virtual void SAL_CALL acquire(  ) throw () SAL_OVERRIDE
     303           0 :         { SwAccessibleContext::acquire(); };
     304             : 
     305           0 :     virtual void SAL_CALL release(  ) throw () SAL_OVERRIDE
     306           0 :         { SwAccessibleContext::release(); };
     307             : 
     308             :     //=====  XAccessibleContext  ==============================================
     309             : 
     310             :     /// Return the number of currently visible children.
     311             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
     312             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     313             : 
     314             :     /// Return the specified child or NULL if index is invalid.
     315             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     316             :         getAccessibleChild (sal_Int32 nIndex)
     317             :         throw (::com::sun::star::uno::RuntimeException,
     318             :                 ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     319             : 
     320             :     //=====  XAccessibleTable  ================================================
     321             : 
     322             :     virtual ::com::sun::star::uno::Reference<
     323             :                 ::com::sun::star::accessibility::XAccessibleTable >
     324             :         SAL_CALL getAccessibleRowHeaders(  )
     325             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     326             :     virtual ::com::sun::star::uno::Reference<
     327             :                 ::com::sun::star::accessibility::XAccessibleTable >
     328             :         SAL_CALL getAccessibleColumnHeaders(  )
     329             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     330             : 
     331             :     //=====  XServiceInfo  ====================================================
     332             : 
     333             :     /** Returns an identifier for the implementation of this object.
     334             :     */
     335             :     virtual OUString SAL_CALL
     336             :         getImplementationName (void)
     337             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     338             : 
     339             : };
     340             : #endif
     341             : 
     342             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10