LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/inc - AccessibleTreeNode.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 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             : #ifndef SD_ACCESSIBILITY_ACCESSIBLE_BASE_HXX
      21             : #define SD_ACCESSIBILITY_ACCESSIBLE_BASE_HXX
      22             : 
      23             : #include "MutexOwner.hxx"
      24             : #include <cppuhelper/compbase5.hxx>
      25             : #include <com/sun/star/accessibility/XAccessible.hpp>
      26             : #include <com/sun/star/accessibility/XAccessibleContext.hpp>
      27             : #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
      28             : #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      30             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      31             : #include <com/sun/star/lang/XServiceInfo.hpp>
      32             : #include <com/sun/star/lang/DisposedException.hpp>
      33             : #include <com/sun/star/awt/XFocusListener.hpp>
      34             : #include <com/sun/star/document/XEventListener.hpp>
      35             : #include <unotools/accessiblestatesethelper.hxx>
      36             : #include <tools/link.hxx>
      37             : #include <rtl/ref.hxx>
      38             : 
      39             : class VclWindowEvent;
      40             : 
      41             : namespace sd { namespace toolpanel {
      42             : class TreeNode;
      43             : class TreeNodeStateChangeEvent;
      44             : } }
      45             : 
      46             : 
      47             : namespace utl {
      48             : class AccessibleStateSetHelper;
      49             : }
      50             : 
      51             : namespace accessibility {
      52             : 
      53             : 
      54             : typedef ::cppu::PartialWeakComponentImplHelper5<
      55             :     ::com::sun::star::accessibility::XAccessible,
      56             :     ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      57             :     ::com::sun::star::accessibility::XAccessibleContext,
      58             :     ::com::sun::star::accessibility::XAccessibleComponent,
      59             :     ::com::sun::star::lang::XServiceInfo
      60             :     > AccessibleTreeNodeBase;
      61             : 
      62             : /** This class makes objects based on the sd::toolpanel::TreeNode
      63             :     accessible.
      64             : */
      65             : class AccessibleTreeNode
      66             :     : public ::sd::MutexOwner,
      67             :       public AccessibleTreeNodeBase
      68             : {
      69             : public:
      70             :     /** Create a new object for the given tree node.  The accessible parent
      71             :         is taken from the window returned by GetAccessibleParent() when
      72             :         called at the window of the node.
      73             :         @param rNode
      74             :             The TreeNode to make accessible.
      75             :         @param rsName
      76             :             The accessible name that will be returned by getAccessibleName().
      77             :         @param rsDescription
      78             :             The accessible description that will be returned by
      79             :             getAccessibleDescription().
      80             :         @param eRole
      81             :             The role that will be returned by getAccessibleRole().
      82             :     */
      83             :     AccessibleTreeNode(
      84             :         ::sd::toolpanel::TreeNode& rNode,
      85             :         const ::rtl::OUString& rsName,
      86             :         const ::rtl::OUString& rsDescription,
      87             :         sal_Int16 eRole);
      88             : 
      89             :     void FireAccessibleEvent (
      90             :         short nEventId,
      91             :         const ::com::sun::star::uno::Any& rOldValue,
      92             :         const ::com::sun::star::uno::Any& rNewValue);
      93             : 
      94             :     virtual void SAL_CALL disposing (void);
      95             : 
      96             :     //===== XComponent =======================================================
      97             : 
      98           0 :     virtual void SAL_CALL dispose()throw (::com::sun::star::uno::RuntimeException)
      99           0 :         { WeakComponentImplHelperBase::dispose(); }
     100           0 :     virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
     101           0 :         { WeakComponentImplHelperBase::addEventListener(xListener); }
     102           0 :     virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
     103           0 :         { WeakComponentImplHelperBase::removeEventListener(xListener); }
     104             : 
     105             :     //===== XAccessible =======================================================
     106             : 
     107             :     virtual ::com::sun::star::uno::Reference<
     108             :         ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
     109             :         getAccessibleContext (void)
     110             :         throw (::com::sun::star::uno::RuntimeException);
     111             : 
     112             : 
     113             :     //===== XAccessibleEventBroadcaster =======================================
     114             : 
     115             :     virtual void SAL_CALL
     116             :         addAccessibleEventListener(
     117             :             const ::com::sun::star::uno::Reference<
     118             :             ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener)
     119             :         throw (::com::sun::star::uno::RuntimeException);
     120             : 
     121             :     virtual void SAL_CALL
     122             :         removeAccessibleEventListener(
     123             :             const ::com::sun::star::uno::Reference<
     124             :             ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener )
     125             :         throw (::com::sun::star::uno::RuntimeException);
     126             : 
     127             :     //=====  XAccessibleContext  ==============================================
     128             : 
     129             :     /// Return the number of currently visible children.
     130             :     virtual sal_Int32 SAL_CALL
     131             :         getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
     132             : 
     133             :     /// Return the specified child or throw exception.
     134             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     135             :         getAccessibleChild (sal_Int32 nIndex)
     136             :         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     137             : 
     138             :     /// Return a reference to the parent.
     139             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
     140             :         getAccessibleParent (void)
     141             :         throw (::com::sun::star::uno::RuntimeException);
     142             : 
     143             :     /// Return this objects index among the parents children.
     144             :     virtual sal_Int32 SAL_CALL
     145             :         getAccessibleIndexInParent (void)
     146             :         throw (::com::sun::star::uno::RuntimeException);
     147             : 
     148             :     /// Return this object's role.
     149             :     virtual sal_Int16 SAL_CALL
     150             :         getAccessibleRole (void)
     151             :         throw (::com::sun::star::uno::RuntimeException);
     152             : 
     153             :     /// Return this object's description.
     154             :     virtual ::rtl::OUString SAL_CALL
     155             :         getAccessibleDescription (void)
     156             :         throw (::com::sun::star::uno::RuntimeException);
     157             : 
     158             :     /// Return the object's current name.
     159             :     virtual ::rtl::OUString SAL_CALL
     160             :         getAccessibleName (void)
     161             :         throw (::com::sun::star::uno::RuntimeException);
     162             : 
     163             :     /// Return NULL to indicate that an empty relation set.
     164             :     virtual ::com::sun::star::uno::Reference<
     165             :             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
     166             :         getAccessibleRelationSet (void)
     167             :         throw (::com::sun::star::uno::RuntimeException);
     168             : 
     169             :     /// Return the set of current states.
     170             :     virtual ::com::sun::star::uno::Reference<
     171             :             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     172             :         getAccessibleStateSet (void)
     173             :         throw (::com::sun::star::uno::RuntimeException);
     174             : 
     175             :     /** Return the parents locale or throw exception if this object has no
     176             :         parent yet/anymore.
     177             :     */
     178             :     virtual ::com::sun::star::lang::Locale SAL_CALL
     179             :         getLocale (void)
     180             :         throw (::com::sun::star::uno::RuntimeException,
     181             :             ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
     182             : 
     183             :     //=====  XAccessibleComponent  ================================================
     184             : 
     185             :     virtual sal_Bool SAL_CALL containsPoint (
     186             :         const ::com::sun::star::awt::Point& aPoint)
     187             :         throw (::com::sun::star::uno::RuntimeException);
     188             : 
     189             :     virtual ::com::sun::star::uno::Reference<
     190             :         ::com::sun::star::accessibility::XAccessible > SAL_CALL
     191             :         getAccessibleAtPoint (
     192             :             const ::com::sun::star::awt::Point& aPoint)
     193             :         throw (::com::sun::star::uno::RuntimeException);
     194             : 
     195             :     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
     196             :         throw (::com::sun::star::uno::RuntimeException);
     197             : 
     198             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
     199             :         throw (::com::sun::star::uno::RuntimeException);
     200             : 
     201             :     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
     202             :         throw (::com::sun::star::uno::RuntimeException);
     203             : 
     204             :     virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
     205             :         throw (::com::sun::star::uno::RuntimeException);
     206             : 
     207             :     virtual void SAL_CALL grabFocus (void)
     208             :         throw (::com::sun::star::uno::RuntimeException);
     209             : 
     210             :     virtual sal_Int32 SAL_CALL getForeground (void)
     211             :         throw (::com::sun::star::uno::RuntimeException);
     212             : 
     213             :     virtual sal_Int32 SAL_CALL getBackground (void)
     214             :         throw (::com::sun::star::uno::RuntimeException);
     215             : 
     216             : 
     217             :     //=====  XServiceInfo  ====================================================
     218             : 
     219             :     /** Returns an identifier for the implementation of this object.
     220             :     */
     221             :     virtual ::rtl::OUString SAL_CALL
     222             :         getImplementationName (void)
     223             :         throw (::com::sun::star::uno::RuntimeException);
     224             : 
     225             :     /** Return whether the specified service is supported by this class.
     226             :     */
     227             :     virtual sal_Bool SAL_CALL
     228             :         supportsService (const ::rtl::OUString& sServiceName)
     229             :         throw (::com::sun::star::uno::RuntimeException);
     230             : 
     231             :     /** Returns a list of all supported services.
     232             :     */
     233             :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
     234             :         getSupportedServiceNames (void)
     235             :         throw (::com::sun::star::uno::RuntimeException);
     236             : 
     237             : 
     238             : protected:
     239             :     ::com::sun::star::uno::Reference<
     240             :         ::com::sun::star::accessibility::XAccessible> mxParent;
     241             :     ::sd::toolpanel::TreeNode& mrTreeNode;
     242             :     ::rtl::Reference< ::utl::AccessibleStateSetHelper> mrStateSet;
     243             : 
     244             :     const ::rtl::OUString msName;
     245             :     const ::rtl::OUString msDescription;
     246             :     const sal_Int16 meRole;
     247             : 
     248             :     virtual ~AccessibleTreeNode (void);
     249             : 
     250             :     /** Check whether or not the object has been disposed (or is in the
     251             :         state of beeing disposed).  If that is the case then
     252             :         DisposedException is thrown to inform the (indirect) caller of the
     253             :         foul deed.
     254             :     */
     255             :     void ThrowIfDisposed (void)
     256             :         throw (::com::sun::star::lang::DisposedException);
     257             : 
     258             :     /** Check whether or not the object has been disposed (or is in the
     259             :         state of beeing disposed).
     260             : 
     261             :         @return sal_True, if the object is disposed or in the course
     262             :         of being disposed. Otherwise, sal_False is returned.
     263             :     */
     264             :     sal_Bool IsDisposed (void);
     265             : 
     266             :     /** Update the mpStateSet member to reflect the current state of the
     267             :         TreeNode.  When one of the states has changed since the last call
     268             :         then an appropriate event is sent.
     269             :     */
     270             :     virtual void UpdateStateSet (void);
     271             : 
     272             :     /** Update a single state and sent an event if its value changes.
     273             :     */
     274             :     void UpdateState(
     275             :         sal_Int16 aState,
     276             :         bool bValue);
     277             : 
     278             :     DECL_LINK(StateChangeListener, ::sd::toolpanel::TreeNodeStateChangeEvent*);
     279             :     DECL_LINK(WindowEventListener, VclWindowEvent*);
     280             : 
     281             : private:
     282             :     sal_uInt32 mnClientId;
     283             : 
     284             :     /// The common part of the constructor.
     285             :     void CommonConstructor (void);
     286             : };
     287             : 
     288             : } // end of namespace ::accessibility
     289             : 
     290             : #endif
     291             : 
     292             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10