LCOV - code coverage report
Current view: top level - accessibility/inc/accessibility/extended - AccessibleGridControl.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 14 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX
      31                 :            : #define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX
      32                 :            : 
      33                 :            : #include <accessibility/extended/AccessibleGridControlBase.hxx>
      34                 :            : #include <accessibility/extended/AccessibleGridControlTable.hxx>
      35                 :            : #include <cppuhelper/weakref.hxx>
      36                 :            : #include <svtools/accessibletable.hxx>
      37                 :            : 
      38                 :            : 
      39                 :            : #include <memory>
      40                 :            : 
      41                 :            : using namespace ::svt::table;
      42                 :            : 
      43                 :            : // ============================================================================
      44                 :            : 
      45                 :            : namespace accessibility {
      46                 :            : 
      47                 :            :     class AccessibleGridControl_Impl;
      48                 :            : 
      49                 :            : // ============================================================================
      50                 :            : 
      51                 :            : /** This class represents the complete accessible Grid Control object. */
      52                 :            : class AccessibleGridControl : public AccessibleGridControlBase
      53                 :            : {
      54                 :            :     friend class AccessibleGridControlAccess;
      55                 :            : 
      56                 :            : protected:
      57                 :            :     AccessibleGridControl(
      58                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
      59                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator,
      60                 :            :     ::svt::table::IAccessibleTable& _rTable
      61                 :            :     );
      62                 :            : 
      63                 :            :     virtual ~AccessibleGridControl();
      64                 :            : 
      65                 :            :     /** Cleans up members. */
      66                 :            :     using AccessibleGridControlBase::disposing;
      67                 :            :     virtual void SAL_CALL disposing();
      68                 :            : 
      69                 :            : protected:
      70                 :            :     // XAccessibleContext -----------------------------------------------------
      71                 :            : 
      72                 :            :     /** @return  The count of visible children. */
      73                 :            :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
      74                 :            :         throw ( ::com::sun::star::uno::RuntimeException );
      75                 :            : 
      76                 :            :     /** @return  The XAccessible interface of the specified child. */
      77                 :            :     virtual ::com::sun::star::uno::Reference<
      78                 :            :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
      79                 :            :     getAccessibleChild( sal_Int32 nChildIndex )
      80                 :            :         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
      81                 :            :                 ::com::sun::star::uno::RuntimeException );
      82                 :            : 
      83                 :            :     /** @return  The role of this object (a table). */
      84                 :            :     virtual sal_Int16 SAL_CALL getAccessibleRole()
      85                 :            :         throw ( ::com::sun::star::uno::RuntimeException );
      86                 :            : 
      87                 :            :     // XAccessibleComponent ---------------------------------------------------
      88                 :            : 
      89                 :            :     /** @return
      90                 :            :             The accessible child rendered under the given point.
      91                 :            :     */
      92                 :            :     virtual ::com::sun::star::uno::Reference<
      93                 :            :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
      94                 :            :     getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
      95                 :            :         throw ( ::com::sun::star::uno::RuntimeException );
      96                 :            : 
      97                 :            :     /** Grabs the focus to the Grid Control. */
      98                 :            :     virtual void SAL_CALL grabFocus()
      99                 :            :         throw ( ::com::sun::star::uno::RuntimeException );
     100                 :            : 
     101                 :            :     /** @return  The key bindings associated with this object. */
     102                 :            :     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
     103                 :            :         throw ( ::com::sun::star::uno::RuntimeException );
     104                 :            : 
     105                 :            :     // XServiceInfo -----------------------------------------------------------
     106                 :            : 
     107                 :            :     /** @return
     108                 :            :             The name of this class.
     109                 :            :     */
     110                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName()
     111                 :            :         throw ( ::com::sun::star::uno::RuntimeException );
     112                 :            : 
     113                 :            : public:
     114                 :            :     // helper functions
     115                 :            :     /** returns the accessible object for the row or the column header bar
     116                 :            :     */
     117                 :            :     inline ::com::sun::star::uno::Reference<
     118                 :            :         ::com::sun::star::accessibility::XAccessible >
     119                 :          0 :         getHeaderBar( ::svt::table::AccessibleTableControlObjType _eObjType )
     120                 :            :         {
     121                 :          0 :             return implGetHeaderBar(_eObjType);
     122                 :            :         }
     123                 :            : 
     124                 :            :     /** returns the accessible object for the table representation
     125                 :            :     */
     126                 :            :     inline ::com::sun::star::uno::Reference<
     127                 :            :         ::com::sun::star::accessibility::XAccessible >
     128                 :          0 :         getTable( )
     129                 :            :         {
     130                 :          0 :             return implGetTable();
     131                 :            :         }
     132                 :            : 
     133                 :            : protected:
     134                 :            :     // internal virtual methods -----------------------------------------------
     135                 :            : 
     136                 :            :     /** @attention  This method requires locked mutex's and a living object.
     137                 :            :         @return  The bounding box (VCL rect.) relative to the parent window. */
     138                 :            :     virtual Rectangle implGetBoundingBox();
     139                 :            :     /** @attention  This method requires locked mutex's and a living object.
     140                 :            :         @return  The bounding box (VCL rect.) in screen coordinates. */
     141                 :            :     virtual Rectangle implGetBoundingBoxOnScreen();
     142                 :            : 
     143                 :            :     // internal helper methods ------------------------------------------------
     144                 :            : 
     145                 :            :     /** This method creates (once) and returns the accessible data table child.
     146                 :            :         @attention  This method requires locked mutex's and a living object.
     147                 :            :         @return  The XAccessible interface of the data table. */
     148                 :            :     virtual ::com::sun::star::uno::Reference<
     149                 :            :         ::com::sun::star::accessibility::XAccessible > implGetTable();
     150                 :            : 
     151                 :            :     /** This method creates (once) and returns the specified header bar.
     152                 :            :         @attention  This method requires locked mutex's and a living object.
     153                 :            :         @return  The XAccessible interface of the header bar. */
     154                 :            :     ::com::sun::star::uno::Reference<
     155                 :            :         ::com::sun::star::accessibility::XAccessible >
     156                 :            :         implGetHeaderBar( ::svt::table::AccessibleTableControlObjType eObjType );
     157                 :            : 
     158                 :            :     /** This method returns one of the children that are always present:
     159                 :            :         Data table, row and column header bar or corner control.
     160                 :            :         @attention  This method requires locked mutex's and a living object.
     161                 :            :         @return  The XAccessible interface of the specified child. */
     162                 :            :     ::com::sun::star::uno::Reference<
     163                 :            :         ::com::sun::star::accessibility::XAccessible >
     164                 :            :     implGetFixedChild( sal_Int32 nChildIndex );
     165                 :            : 
     166                 :            :     /** This method creates and returns an accessible table.
     167                 :            :         @return  An AccessibleGridControlTable. */
     168                 :            :     virtual AccessibleGridControlTable* createAccessibleTable();
     169                 :            : 
     170                 :            : private:
     171                 :            :     // members ----------------------------------------------------------------
     172                 :            :     ::std::auto_ptr< AccessibleGridControl_Impl > m_pImpl;
     173                 :            : };
     174                 :            : 
     175                 :            : // ============================================================================
     176                 :            : /** the XAccessible which creates/returns an AccessibleGridControl
     177                 :            : 
     178                 :            :     <p>The instance holds it's XAccessibleContext with a hard reference, while
     179                 :            :     the contxt holds this instance weak.</p>
     180                 :            : */
     181                 :            : typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base;
     182                 :            : 
     183                 :            : class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base
     184                 :            :     ,public ::svt::table::IAccessibleTableControl
     185                 :            : {
     186                 :            : private:
     187                 :            :     ::osl::Mutex                m_aMutex;
     188                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     189                 :            :                                         m_xParent;
     190                 :            :     ::svt::table::IAccessibleTable&    m_rTable;
     191                 :            : 
     192                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
     193                 :            :                                 m_xContext;
     194                 :            :     AccessibleGridControl*      m_pContext;
     195                 :            :                                     // note that this pointer is valid as long as m_xContext is valid!
     196                 :            : 
     197                 :            : public:
     198                 :            :     AccessibleGridControlAccess(
     199                 :            :         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
     200                 :            :         ::svt::table::IAccessibleTable& _rTable
     201                 :            :     );
     202                 :            : 
     203                 :            :     /// checks whether the accessible context is still alive
     204                 :            :     bool                            isContextAlive() const;
     205                 :            : 
     206                 :            :     /// returns the AccessibleContext belonging to this Accessible
     207                 :          0 :     inline AccessibleGridControl*            getContext()         { return m_pContext; }
     208                 :            :     inline const AccessibleGridControl*      getContext() const   { return m_pContext; }
     209                 :            : 
     210                 :            : protected:
     211                 :            :     virtual ~AccessibleGridControlAccess();
     212                 :            : 
     213                 :            :     // XAccessible
     214                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
     215                 :            :         SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
     216                 :            : 
     217                 :            :     // IAccessibleTable
     218                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     219                 :          0 :         getMyself()
     220                 :            :     {
     221                 :          0 :         return this;
     222                 :            :     }
     223                 :            :     void dispose();
     224                 :          0 :     virtual sal_Bool isAlive() const
     225                 :            :     {
     226                 :          0 :         return isContextAlive();
     227                 :            :     }
     228                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     229                 :          0 :         getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType )
     230                 :            :     {
     231                 :          0 :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
     232                 :          0 :         AccessibleGridControl* pContext( getContext() );
     233         [ #  # ]:          0 :         if ( pContext )
     234 [ #  # ][ #  # ]:          0 :             xAccessible = pContext->getHeaderBar( _eObjType );
     235                 :          0 :         return xAccessible;
     236                 :            :     }
     237                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     238                 :          0 :         getTable()
     239                 :            :     {
     240                 :          0 :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
     241                 :          0 :         AccessibleGridControl* pContext( getContext() );
     242         [ #  # ]:          0 :         if ( pContext )
     243 [ #  # ][ #  # ]:          0 :             xAccessible = pContext->getTable();
     244                 :          0 :         return xAccessible;
     245                 :            :     }
     246                 :          0 :     virtual void commitEvent( sal_Int16 nEventId,
     247                 :            :         const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
     248                 :            :     {
     249                 :          0 :         AccessibleGridControl* pContext( getContext() );
     250         [ #  # ]:          0 :         if ( pContext )
     251                 :          0 :             pContext->commitEvent( nEventId, rNewValue, rOldValue );
     252                 :          0 :     }
     253                 :            : 
     254                 :            : private:
     255                 :            :     AccessibleGridControlAccess();                                              // never implemented
     256                 :            :     AccessibleGridControlAccess( const AccessibleGridControlAccess& );      // never implemented
     257                 :            :     AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& );   // never implemented
     258                 :            : };
     259                 :            : 
     260                 :            : // ============================================================================
     261                 :            : } // namespace accessibility
     262                 :            : 
     263                 :            : // ============================================================================
     264                 :            : 
     265                 :            : #endif
     266                 :            : 
     267                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10