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

Generated by: LCOV version 1.10