LCOV - code coverage report
Current view: top level - sc/source/ui/inc - AccessibleContextBase.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 3 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             : 
      21             : #ifndef _SC_ACCESSIBLECONTEXTBASE_HXX
      22             : #define _SC_ACCESSIBLECONTEXTBASE_HXX
      23             : 
      24             : #include <com/sun/star/accessibility/XAccessible.hpp>
      25             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      26             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      27             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      28             : #include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
      29             : #include <com/sun/star/lang/DisposedException.hpp>
      30             : #include <com/sun/star/uno/Reference.hxx>
      31             : #include <cppuhelper/weak.hxx>
      32             : #include <com/sun/star/lang/XServiceInfo.hpp>
      33             : #include <com/sun/star/lang/XTypeProvider.hpp>
      34             : #include <com/sun/star/lang/XServiceName.hpp>
      35             : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      36             : #include <osl/mutex.hxx>
      37             : #include <cppuhelper/interfacecontainer.h>
      38             : 
      39             : 
      40             : #include <svl/lstner.hxx>
      41             : #include <cppuhelper/compbase5.hxx>
      42             : #include <cppuhelper/implbase1.hxx>
      43             : #include <comphelper/servicehelper.hxx>
      44             : #include <comphelper/broadcasthelper.hxx>
      45             : 
      46             : class Rectangle;
      47             : 
      48             : /** @descr
      49             :         This base class provides an implementation of the
      50             :         <code>AccessibleContext</code> service.
      51             : */
      52             : 
      53             : typedef cppu::WeakAggComponentImplHelper5<
      54             :                 ::com::sun::star::accessibility::XAccessible,
      55             :                 ::com::sun::star::accessibility::XAccessibleComponent,
      56             :                 ::com::sun::star::accessibility::XAccessibleContext,
      57             :                 ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      58             :                 ::com::sun::star::lang::XServiceInfo
      59             :                 > ScAccessibleContextBaseWeakImpl;
      60             : 
      61             : typedef cppu::ImplHelper1<
      62             :                 ::com::sun::star::accessibility::XAccessibleEventListener
      63             :                 > ScAccessibleContextBaseImplEvent;
      64             : 
      65             : class ScAccessibleContextBase
      66             :     :   public comphelper::OBaseMutex,
      67             :         public ScAccessibleContextBaseWeakImpl,
      68             :         public ScAccessibleContextBaseImplEvent,
      69             :         public SfxListener
      70             : {
      71             : public:
      72             :     //=====  internal  ========================================================
      73             :     ScAccessibleContextBase(
      74             :         const ::com::sun::star::uno::Reference<
      75             :         ::com::sun::star::accessibility::XAccessible>& rxParent,
      76             :         const sal_Int16 aRole);
      77             : 
      78             :     virtual void Init();
      79             :     virtual void SAL_CALL disposing() SAL_OVERRIDE;
      80             : protected:
      81             :     virtual ~ScAccessibleContextBase(void);
      82             : public:
      83             :     ///=====  SfxListener  =====================================================
      84             : 
      85             :     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
      86             : 
      87             :     ///=====  XInterface  =====================================================
      88             : 
      89             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
      90             :         ::com::sun::star::uno::Type const & rType )
      91             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             : 
      93             :     virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
      94             : 
      95             :     virtual void SAL_CALL release() throw () SAL_OVERRIDE;
      96             : 
      97             :     ///=====  XAccessible  =====================================================
      98             : 
      99             :     /// Return the XAccessibleContext.
     100             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
     101             :         getAccessibleContext(void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             : 
     103             :     ///=====  XAccessibleComponent  ============================================
     104             : 
     105             :     virtual sal_Bool SAL_CALL containsPoint(
     106             :         const ::com::sun::star::awt::Point& rPoint )
     107             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     108             : 
     109             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
     110             :         SAL_CALL getAccessibleAtPoint(
     111             :         const ::com::sun::star::awt::Point& rPoint )
     112             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     113             : 
     114             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  )
     115             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     116             : 
     117             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  )
     118             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  )
     121             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     122             : 
     123             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  )
     124             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     125             : 
     126             :     virtual sal_Bool SAL_CALL isShowing(  )
     127             :         throw (::com::sun::star::uno::RuntimeException);
     128             : 
     129             :     virtual sal_Bool SAL_CALL isVisible()
     130             :         throw (::com::sun::star::uno::RuntimeException, std::exception);
     131             : 
     132             :     virtual void SAL_CALL grabFocus(  )
     133             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             : 
     135             :     virtual sal_Int32 SAL_CALL getForeground(  )
     136             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     137             : 
     138             :     virtual sal_Int32 SAL_CALL getBackground(  )
     139             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     140             : 
     141             :     ///=====  XAccessibleContext  ==============================================
     142             : 
     143             :     /// Return the number of currently visible children.
     144             :     virtual sal_Int32 SAL_CALL getAccessibleChildCount()
     145             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             : 
     147             :     /// Return the specified child or NULL if index is invalid.
     148             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     149             :         getAccessibleChild(sal_Int32 nIndex)
     150             :         throw (::com::sun::star::uno::RuntimeException,
     151             :                ::com::sun::star::lang::IndexOutOfBoundsException,
     152             :                std::exception) SAL_OVERRIDE;
     153             : 
     154             :     /// Return a reference to the parent.
     155             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     156             :         getAccessibleParent(void)
     157             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     158             : 
     159             :     /// Return this objects index among the parents children.
     160             :     virtual sal_Int32 SAL_CALL
     161             :         getAccessibleIndexInParent(void)
     162             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     163             : 
     164             :     /// Return this object's role.
     165             :     virtual sal_Int16 SAL_CALL
     166             :         getAccessibleRole(void)
     167             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     168             : 
     169             :     /// Return this object's description.
     170             :     virtual OUString SAL_CALL
     171             :         getAccessibleDescription(void)
     172             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             : 
     174             :     /// Return the object's current name.
     175             :     virtual OUString SAL_CALL
     176             :         getAccessibleName(void)
     177             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     178             : 
     179             :     /// Return NULL to indicate that an empty relation set.
     180             :     virtual ::com::sun::star::uno::Reference<
     181             :             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
     182             :         getAccessibleRelationSet()
     183             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             : 
     185             :     /// Return the set of current states.
     186             :     virtual ::com::sun::star::uno::Reference<
     187             :             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     188             :         getAccessibleStateSet(void)
     189             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     190             : 
     191             :     /** Return the parents locale or throw exception if this object has no
     192             :         parent yet/anymore.
     193             :     */
     194             :     virtual ::com::sun::star::lang::Locale SAL_CALL
     195             :         getLocale(void)
     196             :         throw (::com::sun::star::uno::RuntimeException,
     197             :             ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, std::exception) SAL_OVERRIDE;
     198             : 
     199             :     ///=====  XAccessibleEventBroadcaster  =====================================
     200             : 
     201             :     /** Add listener that is informed of future changes of name,
     202             :           description and so on events.
     203             :     */
     204             :     virtual void SAL_CALL
     205             :         addAccessibleEventListener(
     206             :             const ::com::sun::star::uno::Reference<
     207             :                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
     208             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     209             : 
     210             :     //  Remove an existing event listener.
     211             :     virtual void SAL_CALL
     212             :         removeAccessibleEventListener(
     213             :             const ::com::sun::star::uno::Reference<
     214             :                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
     215             :         throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     216             : 
     217             :     ///=====  XAccessibleEventListener  ========================================
     218             : 
     219             :     virtual void SAL_CALL
     220             :         disposing( const ::com::sun::star::lang::EventObject& Source )
     221             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     222             : 
     223             :     virtual void SAL_CALL
     224             :         notifyEvent(
     225             :         const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
     226             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     227             : 
     228             :     ///=====  XServiceInfo  ====================================================
     229             : 
     230             :     /** Returns an identifier for the implementation of this object.
     231             :     */
     232             :     virtual OUString SAL_CALL
     233             :         getImplementationName(void)
     234             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     235             : 
     236             :     /** Return whether the specified service is supported by this class.
     237             :     */
     238             :     virtual sal_Bool SAL_CALL
     239             :         supportsService(const OUString& sServiceName)
     240             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     241             : 
     242             :     /** Returns a list of all supported services.  In this case that is just
     243             :         the AccessibleContext and Accessible service.
     244             :     */
     245             :     virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
     246             :         getSupportedServiceNames(void)
     247             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     248             : 
     249             :     ///=====  XTypeProvider  ===================================================
     250             : 
     251             :      /// returns the possible types
     252             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
     253             :         getTypes()
     254             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     255             : 
     256             :     /** Returns a implementation id.
     257             :     */
     258             :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
     259             :         getImplementationId(void)
     260             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     261             : 
     262             : protected:
     263             :     /// Return this object's description.
     264             :     virtual OUString SAL_CALL
     265             :         createAccessibleDescription(void)
     266             :         throw (::com::sun::star::uno::RuntimeException);
     267             : 
     268             :     /// Return the object's current name.
     269             :     virtual OUString SAL_CALL
     270             :         createAccessibleName(void)
     271             :         throw (::com::sun::star::uno::RuntimeException,
     272             :                std::exception);
     273             : 
     274             :     /// Return the object's current bounding box relative to the desktop.
     275             :     virtual Rectangle GetBoundingBoxOnScreen() const
     276             :         throw (::com::sun::star::uno::RuntimeException, std::exception);
     277             : 
     278             :     /// Return the object's current bounding box relative to the parent object.
     279             :     virtual Rectangle GetBoundingBox() const
     280             :         throw (::com::sun::star::uno::RuntimeException, std::exception);
     281             : 
     282             : public:
     283             :     /// Calls all Listener to tell they the change.
     284             :     void
     285             :         CommitChange(const com::sun::star::accessibility::AccessibleEventObject& rEvent) const;
     286             : 
     287             : protected:
     288             :     /// Calls all FocusListener to tell they that the focus is gained.
     289             :     void CommitFocusGained() const;
     290             : 
     291             :     /// Calls all FocusListener to tell they that the focus is lost.
     292             :     void CommitFocusLost() const;
     293             : 
     294           0 :     bool IsDefunc() const { return rBHelper.bDisposed; }
     295             : 
     296             :     virtual void IsObjectValid() const
     297             :         throw (::com::sun::star::lang::DisposedException);
     298             : 
     299             :     /// Use this method to set initial Name without notification
     300           0 :     void SetName(const OUString& rName) { msName = rName; }
     301             :     /// Use this method to set initial Description without notification
     302           0 :     void SetDescription(const OUString& rDesc) { msDescription = rDesc; }
     303             : 
     304             :     /// Reference to the parent object.
     305             :     ::com::sun::star::uno::Reference<
     306             :          ::com::sun::star::accessibility::XAccessible> mxParent;
     307             : 
     308             : private:
     309             :     /** Description of this object.  This is not a constant because it can
     310             :         be set from the outside.  Furthermore, it changes according the the
     311             :         draw page's display mode.
     312             :     */
     313             :     OUString msDescription;
     314             : 
     315             :     /** Name of this object.  It changes according the draw page's
     316             :         display mode.
     317             :     */
     318             :     OUString msName;
     319             : 
     320             :     /// client id in the AccessibleEventNotifier queue
     321             :     sal_uInt32 mnClientId;
     322             : 
     323             :     /** This is the role of this object.
     324             :     */
     325             :     sal_Int16 maRole;
     326             : };
     327             : 
     328             : 
     329             : #endif
     330             : 
     331             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10