LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/inc - AccessibleContextBase.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-12-27 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();
      80             : protected:
      81             :     virtual ~ScAccessibleContextBase(void);
      82             : public:
      83             :     ///=====  SfxListener  =====================================================
      84             : 
      85             :     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
      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);
      92             : 
      93             :     virtual void SAL_CALL acquire() throw ();
      94             : 
      95             :     virtual void SAL_CALL release() throw ();
      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);
     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);
     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);
     113             : 
     114             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  )
     115             :         throw (::com::sun::star::uno::RuntimeException);
     116             : 
     117             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  )
     118             :         throw (::com::sun::star::uno::RuntimeException);
     119             : 
     120             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  )
     121             :         throw (::com::sun::star::uno::RuntimeException);
     122             : 
     123             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize(  )
     124             :         throw (::com::sun::star::uno::RuntimeException);
     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);
     131             : 
     132             :     virtual void SAL_CALL grabFocus(  )
     133             :         throw (::com::sun::star::uno::RuntimeException);
     134             : 
     135             :     virtual sal_Int32 SAL_CALL getForeground(  )
     136             :         throw (::com::sun::star::uno::RuntimeException);
     137             : 
     138             :     virtual sal_Int32 SAL_CALL getBackground(  )
     139             :         throw (::com::sun::star::uno::RuntimeException);
     140             : 
     141             :     ///=====  XAccessibleContext  ==============================================
     142             : 
     143             :     /// Return the number of currently visible children.
     144             :     virtual sal_Int32 SAL_CALL
     145             :         getAccessibleChildCount(void) throw (::com::sun::star::uno::RuntimeException);
     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             : 
     153             :     /// Return a reference to the parent.
     154             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     155             :         getAccessibleParent(void)
     156             :         throw (::com::sun::star::uno::RuntimeException);
     157             : 
     158             :     /// Return this objects index among the parents children.
     159             :     virtual sal_Int32 SAL_CALL
     160             :         getAccessibleIndexInParent(void)
     161             :         throw (::com::sun::star::uno::RuntimeException);
     162             : 
     163             :     /// Return this object's role.
     164             :     virtual sal_Int16 SAL_CALL
     165             :         getAccessibleRole(void)
     166             :         throw (::com::sun::star::uno::RuntimeException);
     167             : 
     168             :     /// Return this object's description.
     169             :     virtual ::rtl::OUString SAL_CALL
     170             :         getAccessibleDescription(void)
     171             :         throw (::com::sun::star::uno::RuntimeException);
     172             : 
     173             :     /// Return the object's current name.
     174             :     virtual ::rtl::OUString SAL_CALL
     175             :         getAccessibleName(void)
     176             :         throw (::com::sun::star::uno::RuntimeException);
     177             : 
     178             :     /// Return NULL to indicate that an empty relation set.
     179             :     virtual ::com::sun::star::uno::Reference<
     180             :             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
     181             :         getAccessibleRelationSet(void)
     182             :         throw (::com::sun::star::uno::RuntimeException);
     183             : 
     184             :     /// Return the set of current states.
     185             :     virtual ::com::sun::star::uno::Reference<
     186             :             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     187             :         getAccessibleStateSet(void)
     188             :         throw (::com::sun::star::uno::RuntimeException);
     189             : 
     190             :     /** Return the parents locale or throw exception if this object has no
     191             :         parent yet/anymore.
     192             :     */
     193             :     virtual ::com::sun::star::lang::Locale SAL_CALL
     194             :         getLocale(void)
     195             :         throw (::com::sun::star::uno::RuntimeException,
     196             :             ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
     197             : 
     198             :     ///=====  XAccessibleEventBroadcaster  =====================================
     199             : 
     200             :     /** Add listener that is informed of future changes of name,
     201             :           description and so on events.
     202             :     */
     203             :     virtual void SAL_CALL
     204             :         addAccessibleEventListener(
     205             :             const ::com::sun::star::uno::Reference<
     206             :                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
     207             :         throw (com::sun::star::uno::RuntimeException);
     208             : 
     209             :     //  Remove an existing event listener.
     210             :     virtual void SAL_CALL
     211             :         removeAccessibleEventListener(
     212             :             const ::com::sun::star::uno::Reference<
     213             :                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
     214             :         throw (com::sun::star::uno::RuntimeException);
     215             : 
     216             :     ///=====  XAccessibleEventListener  ========================================
     217             : 
     218             :     virtual void SAL_CALL
     219             :         disposing( const ::com::sun::star::lang::EventObject& Source )
     220             :         throw (::com::sun::star::uno::RuntimeException);
     221             : 
     222             :     virtual void SAL_CALL
     223             :         notifyEvent(
     224             :         const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
     225             :         throw (::com::sun::star::uno::RuntimeException);
     226             : 
     227             :     ///=====  XServiceInfo  ====================================================
     228             : 
     229             :     /** Returns an identifier for the implementation of this object.
     230             :     */
     231             :     virtual ::rtl::OUString SAL_CALL
     232             :         getImplementationName(void)
     233             :         throw (::com::sun::star::uno::RuntimeException);
     234             : 
     235             :     /** Return whether the specified service is supported by this class.
     236             :     */
     237             :     virtual sal_Bool SAL_CALL
     238             :         supportsService(const ::rtl::OUString& sServiceName)
     239             :         throw (::com::sun::star::uno::RuntimeException);
     240             : 
     241             :     /** Returns a list of all supported services.  In this case that is just
     242             :         the AccessibleContext and Accessible service.
     243             :     */
     244             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
     245             :         getSupportedServiceNames(void)
     246             :         throw (::com::sun::star::uno::RuntimeException);
     247             : 
     248             :     ///=====  XTypeProvider  ===================================================
     249             : 
     250             :      /// returns the possible types
     251             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
     252             :         getTypes()
     253             :         throw (::com::sun::star::uno::RuntimeException);
     254             : 
     255             :     /** Returns a implementation id.
     256             :     */
     257             :     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
     258             :         getImplementationId(void)
     259             :         throw (::com::sun::star::uno::RuntimeException);
     260             : 
     261             : protected:
     262             :     /// Return this object's description.
     263             :     virtual ::rtl::OUString SAL_CALL
     264             :         createAccessibleDescription(void)
     265             :         throw (::com::sun::star::uno::RuntimeException);
     266             : 
     267             :     /// Return the object's current name.
     268             :     virtual ::rtl::OUString SAL_CALL
     269             :         createAccessibleName(void)
     270             :         throw (::com::sun::star::uno::RuntimeException);
     271             : 
     272             :     /// Return the object's current bounding box relative to the desktop.
     273             :     virtual Rectangle GetBoundingBoxOnScreen(void) const
     274             :         throw (::com::sun::star::uno::RuntimeException);
     275             : 
     276             :     /// Return the object's current bounding box relative to the parent object.
     277             :     virtual Rectangle GetBoundingBox(void) const
     278             :         throw (::com::sun::star::uno::RuntimeException);
     279             : 
     280             : public:
     281             :     /// Calls all Listener to tell they the change.
     282             :     void
     283             :         CommitChange(const com::sun::star::accessibility::AccessibleEventObject& rEvent) const;
     284             : 
     285             :     /// change the name and call the listener to tell they the change
     286             :     void
     287             :         ChangeName();
     288             : 
     289             : protected:
     290             :     /// Calls all FocusListener to tell they that the focus is gained.
     291             :     void CommitFocusGained() const;
     292             : 
     293             :     /// Calls all FocusListener to tell they that the focus is lost.
     294             :     void CommitFocusLost() const;
     295             : 
     296           0 :     sal_Bool IsDefunc() const { return rBHelper.bDisposed; }
     297             : 
     298             :     virtual void IsObjectValid() const
     299             :         throw (::com::sun::star::lang::DisposedException);
     300             : 
     301             :     /// Use this method to set initial Name without notification
     302           0 :     void SetName(const rtl::OUString& rName) { msName = rName; }
     303             :     /// Use this method to set initial Description without notification
     304           0 :     void SetDescription(const rtl::OUString& rDesc) { msDescription = rDesc; }
     305             : 
     306             :     /// Reference to the parent object.
     307             :     ::com::sun::star::uno::Reference<
     308             :          ::com::sun::star::accessibility::XAccessible> mxParent;
     309             : 
     310             : private:
     311             :     /** Description of this object.  This is not a constant because it can
     312             :         be set from the outside.  Furthermore, it changes according the the
     313             :         draw page's display mode.
     314             :     */
     315             :     ::rtl::OUString msDescription;
     316             : 
     317             :     /** Name of this object.  It changes according the the draw page's
     318             :         display mode.
     319             :     */
     320             :     ::rtl::OUString msName;
     321             : 
     322             :     /// client id in the AccessibleEventNotifier queue
     323             :     sal_uInt32 mnClientId;
     324             : 
     325             :     /** This is the role of this object.
     326             :     */
     327             :     sal_Int16 maRole;
     328             : };
     329             : 
     330             : 
     331             : #endif
     332             : 
     333             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10