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

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

Generated by: LCOV version 1.10