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

Generated by: LCOV version 1.10