LCOV - code coverage report
Current view: top level - sw/source/core/access - acctable.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 18 44.4 %
Date: 2015-06-13 12:38:46 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             :     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 derived class additionally 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 :     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         476 :     virtual void SAL_CALL acquire(  ) throw () SAL_OVERRIDE
     102         476 :         { SwAccessibleContext::acquire(); };
     103             : 
     104         476 :     virtual void SAL_CALL release(  ) throw () SAL_OVERRIDE
     105         476 :         { 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()
     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()
     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()
     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( bool bRecursive = false ) SAL_OVERRIDE;
     228             : 
     229             :     virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj,
     230             :                                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< ::std::pair<SwAccessibleContext*,
     270             :         css::uno::WeakReference<css::accessibility::XAccessible> > > Cells_t;
     271             :     Cells_t m_vecCellAdd;
     272             :     Cells_t m_vecCellRemove;
     273             :     void FireSelectionEvent( );
     274             :     void AddSelectionCell(SwAccessibleContext*, bool bAddOrRemove);
     275             : };
     276             : 
     277          20 : inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
     278             : {
     279          20 :     if( !mpTableData )
     280           0 :         UpdateTableData();
     281          20 :     return *mpTableData;
     282             : }
     283             : 
     284             : // #i77106# - subclass to represent table column headers
     285             : class SwAccessibleTableColHeaders : public SwAccessibleTable
     286             : {
     287             : protected:
     288           0 :     virtual ~SwAccessibleTableColHeaders()
     289           0 :     {}
     290             : 
     291             :     virtual SwAccessibleTableData_Impl* CreateNewTableData() SAL_OVERRIDE;
     292             :     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) SAL_OVERRIDE;
     293             : 
     294             : public:
     295             :     SwAccessibleTableColHeaders( SwAccessibleMap *pMap, const SwTabFrm *pTabFrm );
     296             : 
     297             :     // XInterface
     298             : 
     299             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
     300             :         const ::com::sun::star::uno::Type& aType )
     301             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     302             : 
     303           0 :     virtual void SAL_CALL acquire(  ) throw () SAL_OVERRIDE
     304           0 :         { SwAccessibleContext::acquire(); };
     305             : 
     306           0 :     virtual void SAL_CALL release(  ) throw () SAL_OVERRIDE
     307           0 :         { SwAccessibleContext::release(); };
     308             : 
     309             :     // XAccessibleContext
     310             : 
     311             :     /// Return the number of currently visible children.
     312             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
     313             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     314             : 
     315             :     /// Return the specified child or NULL if index is invalid.
     316             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     317             :         getAccessibleChild (sal_Int32 nIndex)
     318             :         throw (::com::sun::star::uno::RuntimeException,
     319             :                 ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
     320             : 
     321             :     // XAccessibleTable
     322             : 
     323             :     virtual ::com::sun::star::uno::Reference<
     324             :                 ::com::sun::star::accessibility::XAccessibleTable >
     325             :         SAL_CALL getAccessibleRowHeaders(  )
     326             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     327             :     virtual ::com::sun::star::uno::Reference<
     328             :                 ::com::sun::star::accessibility::XAccessibleTable >
     329             :         SAL_CALL getAccessibleColumnHeaders(  )
     330             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     331             : 
     332             :     // XServiceInfo
     333             : 
     334             :     /** Returns an identifier for the implementation of this object.
     335             :     */
     336             :     virtual OUString SAL_CALL
     337             :         getImplementationName()
     338             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     339             : 
     340             : };
     341             : #endif
     342             : 
     343             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11