LCOV - code coverage report
Current view: top level - libreoffice/accessibility/inc/accessibility/extended - AccessibleGridControl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 Functions: 0 10 0.0 %
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             : 
      21             : #ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX
      22             : #define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX
      23             : 
      24             : #include <accessibility/extended/AccessibleGridControlBase.hxx>
      25             : #include <accessibility/extended/AccessibleGridControlTable.hxx>
      26             : #include <cppuhelper/weakref.hxx>
      27             : #include <svtools/accessibletable.hxx>
      28             : 
      29             : #include <memory>
      30             : 
      31             : using namespace ::svt::table;
      32             : 
      33             : // ============================================================================
      34             : 
      35             : namespace accessibility {
      36             : 
      37             :     class AccessibleGridControl_Impl;
      38             : 
      39             : // ============================================================================
      40             : 
      41             : /** This class represents the complete accessible Grid Control object. */
      42             : class AccessibleGridControl : public AccessibleGridControlBase
      43             : {
      44             :     friend class AccessibleGridControlAccess;
      45             : 
      46             : protected:
      47             :     AccessibleGridControl(
      48             :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
      49             :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator,
      50             :     ::svt::table::IAccessibleTable& _rTable
      51             :     );
      52             : 
      53             :     virtual ~AccessibleGridControl();
      54             : 
      55             :     /** Cleans up members. */
      56             :     using AccessibleGridControlBase::disposing;
      57             :     virtual void SAL_CALL disposing();
      58             : 
      59             : protected:
      60             :     // XAccessibleContext -----------------------------------------------------
      61             : 
      62             :     /** @return  The count of visible children. */
      63             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
      64             :         throw ( ::com::sun::star::uno::RuntimeException );
      65             : 
      66             :     /** @return  The XAccessible interface of the specified child. */
      67             :     virtual ::com::sun::star::uno::Reference<
      68             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
      69             :     getAccessibleChild( sal_Int32 nChildIndex )
      70             :         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
      71             :                 ::com::sun::star::uno::RuntimeException );
      72             : 
      73             :     /** @return  The role of this object (a table). */
      74             :     virtual sal_Int16 SAL_CALL getAccessibleRole()
      75             :         throw ( ::com::sun::star::uno::RuntimeException );
      76             : 
      77             :     // XAccessibleComponent ---------------------------------------------------
      78             : 
      79             :     /** @return
      80             :             The accessible child rendered under the given point.
      81             :     */
      82             :     virtual ::com::sun::star::uno::Reference<
      83             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
      84             :     getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
      85             :         throw ( ::com::sun::star::uno::RuntimeException );
      86             : 
      87             :     /** Grabs the focus to the Grid Control. */
      88             :     virtual void SAL_CALL grabFocus()
      89             :         throw ( ::com::sun::star::uno::RuntimeException );
      90             : 
      91             :     /** @return  The key bindings associated with this object. */
      92             :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
      93             :         throw ( ::com::sun::star::uno::RuntimeException );
      94             : 
      95             :     // XServiceInfo -----------------------------------------------------------
      96             : 
      97             :     /** @return
      98             :             The name of this class.
      99             :     */
     100             :     virtual OUString SAL_CALL getImplementationName()
     101             :         throw ( ::com::sun::star::uno::RuntimeException );
     102             : 
     103             : public:
     104             :     // helper functions
     105             : 
     106             :      /** commitCellEvent commit the event at all listeners of the table
     107             :          @param nEventId
     108             :              the event id
     109             :          @param rNewValue
     110             :              the new value
     111             :          @param rOldValue
     112             :              the old value
     113             :      */
     114             :      void commitCellEvent(sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue,
     115             :              const ::com::sun::star::uno::Any& rOldValue);
     116             : 
     117             :      /** commitTableEvent commit the event at all listeners of the table
     118             :          @param nEventId
     119             :              the event id
     120             :          @param rNewValue
     121             :              the new value
     122             :          @param rOldValue
     123             :              the old value
     124             :      */
     125             :      void commitTableEvent(sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue,
     126             :              const ::com::sun::star::uno::Any& rOldValue);
     127             :     /** returns the accessible object for the row or the column header bar
     128             :     */
     129             :     inline ::com::sun::star::uno::Reference<
     130             :         ::com::sun::star::accessibility::XAccessible >
     131           0 :         getHeaderBar( ::svt::table::AccessibleTableControlObjType _eObjType )
     132             :         {
     133           0 :             return implGetHeaderBar(_eObjType);
     134             :         }
     135             : 
     136             :     /** returns the accessible object for the table representation
     137             :     */
     138             :     inline ::com::sun::star::uno::Reference<
     139             :         ::com::sun::star::accessibility::XAccessible >
     140           0 :         getTable( )
     141             :         {
     142           0 :             return implGetTable();
     143             :         }
     144             : 
     145             : protected:
     146             :     // internal virtual methods -----------------------------------------------
     147             : 
     148             :     /** @attention  This method requires locked mutex's and a living object.
     149             :         @return  The bounding box (VCL rect.) relative to the parent window. */
     150             :     virtual Rectangle implGetBoundingBox();
     151             :     /** @attention  This method requires locked mutex's and a living object.
     152             :         @return  The bounding box (VCL rect.) in screen coordinates. */
     153             :     virtual Rectangle implGetBoundingBoxOnScreen();
     154             : 
     155             :     // internal helper methods ------------------------------------------------
     156             : 
     157             :     /** This method creates (once) and returns the accessible data table child.
     158             :         @attention  This method requires locked mutex's and a living object.
     159             :         @return  The XAccessible interface of the data table. */
     160             :     virtual ::com::sun::star::uno::Reference<
     161             :         ::com::sun::star::accessibility::XAccessible > implGetTable();
     162             : 
     163             :     /** This method creates (once) and returns the specified header bar.
     164             :         @attention  This method requires locked mutex's and a living object.
     165             :         @return  The XAccessible interface of the header bar. */
     166             :     ::com::sun::star::uno::Reference<
     167             :         ::com::sun::star::accessibility::XAccessible >
     168             :         implGetHeaderBar( ::svt::table::AccessibleTableControlObjType eObjType );
     169             : 
     170             :     /** This method returns one of the children that are always present:
     171             :         Data table, row and column header bar or corner control.
     172             :         @attention  This method requires locked mutex's and a living object.
     173             :         @return  The XAccessible interface of the specified child. */
     174             :     ::com::sun::star::uno::Reference<
     175             :         ::com::sun::star::accessibility::XAccessible >
     176             :     implGetFixedChild( sal_Int32 nChildIndex );
     177             : 
     178             :     /** This method creates and returns an accessible table.
     179             :         @return  An AccessibleGridControlTable. */
     180             :     virtual AccessibleGridControlTable* createAccessibleTable();
     181             : 
     182             : private:
     183             :     // members ----------------------------------------------------------------
     184             :     ::std::auto_ptr< AccessibleGridControl_Impl > m_pImpl;
     185             : };
     186             : 
     187             : // ============================================================================
     188             : /** the XAccessible which creates/returns an AccessibleGridControl
     189             : 
     190             :     <p>The instance holds it's XAccessibleContext with a hard reference, while
     191             :     the contxt holds this instance weak.</p>
     192             : */
     193             : typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base;
     194             : 
     195             : class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base
     196             :     ,public ::svt::table::IAccessibleTableControl
     197             : {
     198             : private:
     199             :     ::osl::Mutex                m_aMutex;
     200             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     201             :                                         m_xParent;
     202             :     ::svt::table::IAccessibleTable&    m_rTable;
     203             : 
     204             :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
     205             :                                 m_xContext;
     206             :     AccessibleGridControl*      m_pContext;
     207             :                                     // note that this pointer is valid as long as m_xContext is valid!
     208             : 
     209             : public:
     210             :     AccessibleGridControlAccess(
     211             :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
     212             :         ::svt::table::IAccessibleTable& _rTable
     213             :     );
     214             : 
     215             :     /// checks whether the accessible context is still alive
     216             :     bool                            isContextAlive() const;
     217             : 
     218             :     /// returns the AccessibleContext belonging to this Accessible
     219           0 :     inline AccessibleGridControl*            getContext()         { return m_pContext; }
     220             :     inline const AccessibleGridControl*      getContext() const   { return m_pContext; }
     221             : 
     222             : protected:
     223             :     virtual ~AccessibleGridControlAccess();
     224             : 
     225             :     // XAccessible
     226             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
     227             :         SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
     228             : 
     229             :     // IAccessibleTable
     230             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     231           0 :         getMyself()
     232             :     {
     233           0 :         return this;
     234             :     }
     235             :     void dispose();
     236           0 :     virtual sal_Bool isAlive() const
     237             :     {
     238           0 :         return isContextAlive();
     239             :     }
     240             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     241           0 :         getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType )
     242             :     {
     243           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
     244           0 :         AccessibleGridControl* pContext( getContext() );
     245           0 :         if ( pContext )
     246           0 :             xAccessible = pContext->getHeaderBar( _eObjType );
     247           0 :         return xAccessible;
     248             :     }
     249             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     250           0 :         getTable()
     251             :     {
     252           0 :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
     253           0 :         AccessibleGridControl* pContext( getContext() );
     254           0 :         if ( pContext )
     255           0 :             xAccessible = pContext->getTable();
     256           0 :         return xAccessible;
     257             :     }
     258           0 :     virtual void commitCellEvent( sal_Int16 nEventId,
     259             :          const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
     260             :     {
     261           0 :          AccessibleGridControl* pContext( getContext() );
     262           0 :          if ( pContext )
     263           0 :             pContext->commitCellEvent( nEventId, rNewValue, rOldValue );
     264           0 :     }
     265           0 :     virtual void commitTableEvent( sal_Int16 nEventId,
     266             :          const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
     267             :     {
     268           0 :          AccessibleGridControl* pContext( getContext() );
     269           0 :          if ( pContext )
     270           0 :             pContext->commitTableEvent( nEventId, rNewValue, rOldValue );
     271           0 :     }
     272           0 :     virtual void commitEvent( sal_Int16 nEventId,
     273             :         const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
     274             :     {
     275           0 :         AccessibleGridControl* pContext( getContext() );
     276           0 :         if ( pContext )
     277           0 :             pContext->commitEvent( nEventId, rNewValue, rOldValue );
     278           0 :     }
     279             : 
     280             : private:
     281             :     AccessibleGridControlAccess();                                              // never implemented
     282             :     AccessibleGridControlAccess( const AccessibleGridControlAccess& );      // never implemented
     283             :     AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& );   // never implemented
     284             : };
     285             : 
     286             : // ============================================================================
     287             : } // namespace accessibility
     288             : 
     289             : // ============================================================================
     290             : 
     291             : #endif
     292             : 
     293             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10