LCOV - code coverage report
Current view: top level - svx/source/inc - charmapacc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 13 0.0 %
Date: 2012-08-25 Functions: 0 9 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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                 :            : #include <osl/mutex.hxx>
      21                 :            : #include <tools/string.hxx>
      22                 :            : #include <vcl/image.hxx>
      23                 :            : #include <comphelper/accessibleselectionhelper.hxx>
      24                 :            : #include <com/sun/star/accessibility/XAccessibleTable.hpp>
      25                 :            : 
      26                 :            : #include <vector>
      27                 :            : class SvxShowCharSet;
      28                 :            : 
      29                 :            : namespace svx
      30                 :            : {
      31                 :            :     typedef ::cppu::ImplHelper1 <   ::com::sun::star::accessibility::XAccessible
      32                 :            :                                 >   OAccessibleHelper_Base_2;
      33                 :            : 
      34                 :            :     class SvxShowCharSetAcc;
      35                 :            :     /** The class SvxShowCharSetVirtualAcc is used as a virtual class which contains the table and the scrollbar.
      36                 :            :         In the vcl control, the table and the scrollbar exists in one class. This is not feasible for the accessibility api.
      37                 :            :     */
      38                 :            :     class SvxShowCharSetVirtualAcc : public ::comphelper::OAccessibleComponentHelper,
      39                 :            :                                      public OAccessibleHelper_Base_2
      40                 :            :     {
      41                 :            :         SvxShowCharSet*     mpParent; // the vcl control
      42                 :            :         SvxShowCharSetAcc*  m_pTable; // the table, which holds the characters shown by the vcl control
      43                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc; // the ref to the table
      44                 :            :     protected:
      45                 :            :         virtual ~SvxShowCharSetVirtualAcc();
      46                 :            : 
      47                 :            :         virtual void SAL_CALL disposing();
      48                 :            : 
      49                 :            :         virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
      50                 :            :     public:
      51                 :            :         SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent );
      52                 :            : 
      53                 :            :         // XInterface
      54                 :            :         DECLARE_XINTERFACE( )
      55                 :            :         DECLARE_XTYPEPROVIDER( )
      56                 :            : 
      57                 :            :         // XAccessibleComponent
      58                 :            :         virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
      59                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
      60                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
      61                 :            :         //OAccessibleContextHelper
      62                 :            :         // XAccessibleContext - still waiting to be overwritten
      63                 :            :         virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
      64                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
      65                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
      66                 :            :         virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
      67                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
      68                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
      69                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
      70                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
      71                 :            : 
      72                 :          0 :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException) { return this; }
      73                 :            :         virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
      74                 :            :         virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
      75                 :            : 
      76                 :            : 
      77                 :            :         // call the fireEvent method from the table when it exists.
      78                 :            :         void SAL_CALL fireEvent(
      79                 :            :                     const sal_Int16 _nEventId,
      80                 :            :                     const ::com::sun::star::uno::Any& _rOldValue,
      81                 :            :                     const ::com::sun::star::uno::Any& _rNewValue
      82                 :            :                 );
      83                 :            : 
      84                 :            :         // simple access methods
      85                 :          0 :         inline SvxShowCharSetAcc*   getTable() const { return m_pTable; }
      86                 :          0 :         inline SvxShowCharSet* getCharSetControl() const { return mpParent; }
      87                 :            :     };
      88                 :            : 
      89                 :            : 
      90                 :            :     class SvxShowCharSetItemAcc;
      91                 :            :     // ----------------
      92                 :            :     // - SvxShowCharSetItem -
      93                 :            :     // ----------------
      94                 :            :     /** Simple struct to hold some information about the single items of the table.
      95                 :            :     */
      96                 :            :     struct SvxShowCharSetItem
      97                 :            :     {
      98                 :            :         SvxShowCharSet&             mrParent;
      99                 :            :         sal_uInt16                      mnId;
     100                 :            :         XubString                   maText;
     101                 :            :         Rectangle                   maRect;
     102                 :            :         SvxShowCharSetItemAcc*      m_pItem;
     103                 :            :         SvxShowCharSetAcc*          m_pParent;
     104                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAcc;
     105                 :            : 
     106                 :            :         SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc*  _pParent,sal_uInt16 _nPos );
     107                 :            :         ~SvxShowCharSetItem();
     108                 :            : 
     109                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >    GetAccessible();
     110                 :            :          void                                                                                       ClearAccessible();
     111                 :            :     };
     112                 :            : 
     113                 :            :     // -----------------------------------------------------------------------------
     114                 :            : 
     115                 :            :     typedef ::cppu::ImplHelper2 <   ::com::sun::star::accessibility::XAccessible,
     116                 :            :                                     ::com::sun::star::accessibility::XAccessibleTable
     117                 :            :                                 >   OAccessibleHelper_Base;
     118                 :            :     // ---------------
     119                 :            :     // - SvxShowCharSetAcc -
     120                 :            :     // ---------------
     121                 :            :     /** The table implemtentation of the vcl control.
     122                 :            :     */
     123                 :            : 
     124                 :            :     class SvxShowCharSetAcc : public ::comphelper::OAccessibleSelectionHelper,
     125                 :            :                               public OAccessibleHelper_Base
     126                 :            :     {
     127                 :            :         ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > m_aChildren;
     128                 :            :         SvxShowCharSetVirtualAcc* m_pParent; // the virtual parent
     129                 :            :     protected:
     130                 :            :         virtual void SAL_CALL disposing();
     131                 :            :     public:
     132                 :            :         SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent );
     133                 :            : 
     134                 :            :         DECLARE_XINTERFACE( )
     135                 :            :         DECLARE_XTYPEPROVIDER( )
     136                 :            : 
     137                 :            :         // XAccessibleComponent
     138                 :            :         virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
     139                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
     140                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
     141                 :            : 
     142                 :            :         //OAccessibleContextHelper
     143                 :            :         // XAccessibleContext - still waiting to be overwritten
     144                 :            :         virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
     145                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     146                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
     147                 :            :         virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
     148                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
     149                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
     150                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
     151                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
     152                 :            : 
     153                 :          0 :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException) { return this; }
     154                 :            :         virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
     155                 :            :         virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
     156                 :            : 
     157                 :            :         // XAccessibleTable
     158                 :            :         virtual sal_Int32 SAL_CALL getAccessibleRowCount(  ) throw (::com::sun::star::uno::RuntimeException);
     159                 :            :         virtual sal_Int32 SAL_CALL getAccessibleColumnCount(  ) throw (::com::sun::star::uno::RuntimeException);
     160                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     161                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     162                 :            :         virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     163                 :            :         virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     164                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders(  ) throw (::com::sun::star::uno::RuntimeException);
     165                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders(  ) throw (::com::sun::star::uno::RuntimeException);
     166                 :            :         virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows(  ) throw (::com::sun::star::uno::RuntimeException);
     167                 :            :         virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns(  ) throw (::com::sun::star::uno::RuntimeException);
     168                 :            :         virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     169                 :            :         virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     170                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     171                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption(  ) throw (::com::sun::star::uno::RuntimeException);
     172                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary(  ) throw (::com::sun::star::uno::RuntimeException);
     173                 :            :         virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     174                 :            :         virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     175                 :            :         virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     176                 :            :         virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     177                 :            : 
     178                 :            : 
     179                 :          0 :         inline void SAL_CALL fireEvent(
     180                 :            :                     const sal_Int16 _nEventId,
     181                 :            :                     const ::com::sun::star::uno::Any& _rOldValue,
     182                 :            :                     const ::com::sun::star::uno::Any& _rNewValue
     183                 :            :                 )
     184                 :            :         {
     185                 :          0 :             NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue);
     186                 :          0 :         }
     187                 :            :     protected:
     188                 :            : 
     189                 :            :         virtual ~SvxShowCharSetAcc();
     190                 :            : 
     191                 :            :         // OCommonAccessibleSelection
     192                 :            :         // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
     193                 :            :         virtual sal_Bool
     194                 :            :             implIsSelected( sal_Int32 nAccessibleChildIndex )
     195                 :            :             throw (::com::sun::star::uno::RuntimeException);
     196                 :            : 
     197                 :            :         // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
     198                 :            :         virtual void
     199                 :            :             implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
     200                 :            :             throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     201                 :            : 
     202                 :            :         // OCommonAccessibleComponent
     203                 :            :         /// implements the calculation of the bounding rectangle - still waiting to be overwritten
     204                 :            :         virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
     205                 :            :     };
     206                 :            : 
     207                 :            :     // ----------------
     208                 :            :     // - SvxShowCharSetItemAcc -
     209                 :            :     // ----------------
     210                 :            :     /** The child implementation of the table.
     211                 :            :     */
     212                 :            :     class SvxShowCharSetItemAcc : public ::comphelper::OAccessibleComponentHelper,
     213                 :            :                                   public OAccessibleHelper_Base_2
     214                 :            :     {
     215                 :            :     private:
     216                 :            :         SvxShowCharSetItem* mpParent;
     217                 :            :     protected:
     218                 :            :         virtual ~SvxShowCharSetItemAcc();
     219                 :            : 
     220                 :            :         // OCommonAccessibleComponent
     221                 :            :         /// implements the calculation of the bounding rectangle - still waiting to be overwritten
     222                 :            :         virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
     223                 :            :     public:
     224                 :            : 
     225                 :            :         // XInterface
     226                 :            :         DECLARE_XINTERFACE( )
     227                 :            :         DECLARE_XTYPEPROVIDER( )
     228                 :            : 
     229                 :            :         SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent );
     230                 :            : 
     231                 :            :         void    ParentDestroyed();
     232                 :            : 
     233                 :            :         // XAccessibleComponent
     234                 :            :         virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
     235                 :            :         virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding(  ) throw (::com::sun::star::uno::RuntimeException);
     236                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
     237                 :            : 
     238                 :            :         //OAccessibleContextHelper
     239                 :            :         // XAccessibleContext - still waiting to be overwritten
     240                 :            :         virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
     241                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     242                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
     243                 :            :         virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
     244                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
     245                 :            :         virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
     246                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
     247                 :            :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
     248                 :            : 
     249                 :          0 :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException) { return this; }
     250                 :            : 
     251                 :          0 :         virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException) { return mpParent->m_pParent->getForeground(); }
     252                 :          0 :         virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException) { return mpParent->m_pParent->getBackground(); }
     253                 :            : 
     254                 :          0 :         inline void SAL_CALL fireEvent(
     255                 :            :                     const sal_Int16 _nEventId,
     256                 :            :                     const ::com::sun::star::uno::Any& _rOldValue,
     257                 :            :                     const ::com::sun::star::uno::Any& _rNewValue
     258                 :            :                 )
     259                 :            :         {
     260                 :          0 :             NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue);
     261                 :          0 :         }
     262                 :            :     };
     263                 :            : }
     264                 :            : 
     265                 :            : 
     266                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10