LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sd/source/ui/accessibility - AccessibleTreeNode.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 261 0.4 %
Date: 2013-07-09 Functions: 2 42 4.8 %
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             : #include "AccessibleTreeNode.hxx"
      22             : 
      23             : #include "taskpane/TaskPaneTreeNode.hxx"
      24             : #include "taskpane/ControlContainer.hxx"
      25             : 
      26             : #include "sdresid.hxx"
      27             : #include "accessibility.hrc"
      28             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      30             : #include <comphelper/accessibleeventnotifier.hxx>
      31             : 
      32             : #include <vcl/svapp.hxx>
      33             : #include <vcl/window.hxx>
      34             : #include <svtools/colorcfg.hxx>
      35             : 
      36             : using namespace ::com::sun::star;
      37             : using namespace ::com::sun::star::uno;
      38             : using namespace ::com::sun::star::accessibility;
      39             : using namespace ::sd::toolpanel;
      40             : 
      41             : namespace accessibility {
      42             : 
      43             : 
      44             : 
      45             : //===== AccessibleTreeNode =============================================
      46             : 
      47           0 : AccessibleTreeNode::AccessibleTreeNode(
      48             :     ::sd::toolpanel::TreeNode& rNode,
      49             :     const OUString& rsName,
      50             :     const OUString& rsDescription,
      51             :     sal_Int16 eRole)
      52             :     : AccessibleTreeNodeBase(MutexOwner::maMutex),
      53             :       mxParent(NULL),
      54             :       mrTreeNode(rNode),
      55           0 :       mrStateSet(new ::utl::AccessibleStateSetHelper()),
      56             :       msName(rsName),
      57             :       msDescription(rsDescription),
      58             :       meRole(eRole),
      59           0 :       mnClientId(0)
      60             : {
      61           0 :     ::Window* pWindow = mrTreeNode.GetWindow();
      62           0 :     if (pWindow != NULL)
      63             :     {
      64           0 :         ::Window* pParentWindow = pWindow->GetAccessibleParentWindow();
      65           0 :         if (pParentWindow != NULL && pParentWindow != pWindow)
      66           0 :             mxParent = pParentWindow->GetAccessible();
      67             :     }
      68           0 :     CommonConstructor();
      69           0 : }
      70             : 
      71             : 
      72             : 
      73             : 
      74           0 : void AccessibleTreeNode::CommonConstructor (void)
      75             : {
      76           0 :     UpdateStateSet();
      77             : 
      78           0 :     Link aStateChangeLink (LINK(this,AccessibleTreeNode,StateChangeListener));
      79           0 :     mrTreeNode.AddStateChangeListener(aStateChangeLink);
      80             : 
      81           0 :     if (mrTreeNode.GetWindow() != NULL)
      82             :     {
      83           0 :         Link aWindowEventLink (LINK(this,AccessibleTreeNode,WindowEventListener));
      84           0 :         mrTreeNode.GetWindow()->AddEventListener(aWindowEventLink);
      85             :     }
      86           0 : }
      87             : 
      88             : 
      89             : 
      90             : 
      91           0 : AccessibleTreeNode::~AccessibleTreeNode (void)
      92             : {
      93             :     OSL_ASSERT(IsDisposed());
      94           0 : }
      95             : 
      96             : 
      97             : 
      98             : 
      99           0 : void AccessibleTreeNode::FireAccessibleEvent (
     100             :     short nEventId,
     101             :     const uno::Any& rOldValue,
     102             :     const uno::Any& rNewValue )
     103             : {
     104           0 :     if (mnClientId != 0)
     105             :     {
     106           0 :         AccessibleEventObject aEventObject;
     107             : 
     108           0 :         aEventObject.Source = Reference<XWeak>(this);
     109           0 :         aEventObject.EventId = nEventId;
     110           0 :         aEventObject.NewValue = rNewValue;
     111           0 :         aEventObject.OldValue = rOldValue;
     112             : 
     113           0 :         comphelper::AccessibleEventNotifier::addEvent (mnClientId, aEventObject);
     114             :     }
     115           0 : }
     116             : 
     117             : 
     118             : 
     119             : 
     120           0 : void SAL_CALL AccessibleTreeNode::disposing (void)
     121             : {
     122             :     // We are still listening to the tree node and its window.  Both
     123             :     // probably are by now more or less dead and we must not call them to
     124             :     // unregister.
     125             : 
     126           0 :     if (mnClientId != 0)
     127             :     {
     128           0 :         comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
     129           0 :         mnClientId = 0;
     130             :     }
     131           0 : }
     132             : 
     133             : 
     134             : 
     135             : 
     136             : //=====  XAccessible  =========================================================
     137             : 
     138             : Reference<XAccessibleContext > SAL_CALL
     139           0 :     AccessibleTreeNode::getAccessibleContext (void)
     140             :     throw (uno::RuntimeException)
     141             : {
     142           0 :     ThrowIfDisposed ();
     143           0 :     return this;
     144             : }
     145             : 
     146             : 
     147             : 
     148             : 
     149             : //=====  XAccessibleContext  ==================================================
     150             : 
     151           0 : sal_Int32 SAL_CALL AccessibleTreeNode::getAccessibleChildCount (void)
     152             :     throw (RuntimeException)
     153             : {
     154           0 :     ThrowIfDisposed();
     155           0 :     const SolarMutexGuard aSolarGuard;
     156           0 :     return mrTreeNode.GetControlContainer().GetControlCount();
     157             : }
     158             : 
     159             : 
     160             : 
     161             : 
     162             : Reference<XAccessible > SAL_CALL
     163           0 :     AccessibleTreeNode::getAccessibleChild (sal_Int32 nIndex)
     164             :     throw (lang::IndexOutOfBoundsException, RuntimeException)
     165             : {
     166           0 :     ThrowIfDisposed();
     167           0 :     const SolarMutexGuard aSolarGuard;
     168             : 
     169           0 :     if (nIndex<0 || (sal_uInt32)nIndex>=mrTreeNode.GetControlContainer().GetControlCount())
     170           0 :         throw lang::IndexOutOfBoundsException();
     171             : 
     172           0 :     Reference<XAccessible> xChild;
     173             : 
     174           0 :     ::sd::toolpanel::TreeNode* pNode = mrTreeNode.GetControlContainer().GetControl(nIndex);
     175           0 :     if (pNode != NULL)
     176           0 :         xChild = pNode->GetAccessibleObject();
     177             : 
     178           0 :     return xChild;
     179             : }
     180             : 
     181             : 
     182             : 
     183             : 
     184           0 : Reference<XAccessible > SAL_CALL AccessibleTreeNode::getAccessibleParent (void)
     185             :     throw (uno::RuntimeException)
     186             : {
     187           0 :     ThrowIfDisposed();
     188           0 :     const SolarMutexGuard aSolarGuard;
     189           0 :     return mxParent;
     190             : }
     191             : 
     192             : 
     193             : 
     194             : 
     195           0 : sal_Int32 SAL_CALL AccessibleTreeNode::getAccessibleIndexInParent (void)
     196             :     throw (uno::RuntimeException)
     197             : {
     198             :     OSL_ASSERT(getAccessibleParent().is());
     199           0 :     ThrowIfDisposed();
     200           0 :     const SolarMutexGuard aSolarGuard;
     201           0 :     sal_Int32 nIndexInParent(-1);
     202             : 
     203             : 
     204           0 :     Reference<XAccessibleContext> xParentContext (getAccessibleParent()->getAccessibleContext());
     205           0 :     if (xParentContext.is())
     206             :     {
     207           0 :         sal_Int32 nChildCount (xParentContext->getAccessibleChildCount());
     208           0 :         for (sal_Int32 i=0; i<nChildCount; ++i)
     209           0 :             if (xParentContext->getAccessibleChild(i).get()
     210           0 :                     == static_cast<XAccessible*>(this))
     211             :             {
     212           0 :                 nIndexInParent = i;
     213           0 :                 break;
     214             :             }
     215             :     }
     216             : 
     217           0 :     return nIndexInParent;
     218             : }
     219             : 
     220             : 
     221             : 
     222             : 
     223           0 : sal_Int16 SAL_CALL AccessibleTreeNode::getAccessibleRole (void)
     224             :     throw (uno::RuntimeException)
     225             : {
     226           0 :     ThrowIfDisposed();
     227           0 :     return meRole;
     228             : }
     229             : 
     230             : 
     231             : 
     232             : 
     233           0 : OUString SAL_CALL AccessibleTreeNode::getAccessibleDescription (void)
     234             :     throw (uno::RuntimeException)
     235             : {
     236           0 :     ThrowIfDisposed();
     237           0 :     return msDescription;
     238             : }
     239             : 
     240             : 
     241             : 
     242             : 
     243           0 : OUString SAL_CALL AccessibleTreeNode::getAccessibleName (void)
     244             :     throw (uno::RuntimeException)
     245             : {
     246           0 :     ThrowIfDisposed();
     247           0 :     return msName;
     248             : }
     249             : 
     250             : 
     251             : 
     252             : 
     253             : Reference<XAccessibleRelationSet> SAL_CALL
     254           0 :     AccessibleTreeNode::getAccessibleRelationSet (void)
     255             :     throw (uno::RuntimeException)
     256             : {
     257           0 :     ThrowIfDisposed();
     258           0 :     return Reference<XAccessibleRelationSet>();
     259             : }
     260             : 
     261             : 
     262             : 
     263             : 
     264             : Reference<XAccessibleStateSet > SAL_CALL
     265           0 :     AccessibleTreeNode::getAccessibleStateSet (void)
     266             :     throw (uno::RuntimeException)
     267             : {
     268           0 :     ThrowIfDisposed();
     269           0 :     const SolarMutexGuard aSolarGuard;
     270           0 :     return mrStateSet.get();
     271             : }
     272             : 
     273             : 
     274             : 
     275             : 
     276           0 : void AccessibleTreeNode::UpdateStateSet (void)
     277             : {
     278           0 :     if (mrTreeNode.IsExpandable())
     279             :     {
     280           0 :         UpdateState(AccessibleStateType::EXPANDABLE, true);
     281           0 :         UpdateState(AccessibleStateType::EXPANDED, mrTreeNode.IsExpanded());
     282             :     }
     283             : 
     284           0 :     UpdateState(AccessibleStateType::FOCUSABLE, true);
     285             : 
     286           0 :     ::Window* pWindow = mrTreeNode.GetWindow();
     287           0 :     if (pWindow != NULL)
     288             :     {
     289           0 :         UpdateState(AccessibleStateType::ENABLED, pWindow->IsEnabled());
     290           0 :         UpdateState(AccessibleStateType::FOCUSED, pWindow->HasFocus());
     291           0 :         UpdateState(AccessibleStateType::VISIBLE, pWindow->IsVisible());
     292           0 :         UpdateState(AccessibleStateType::SHOWING, pWindow->IsReallyVisible());
     293             :     }
     294           0 : }
     295             : 
     296             : 
     297             : 
     298             : 
     299           0 : void AccessibleTreeNode::UpdateState(
     300             :     sal_Int16 aState,
     301             :     bool bValue)
     302             : {
     303           0 :     if ((mrStateSet->contains(aState)!=sal_False) != bValue)
     304             :     {
     305           0 :         if (bValue)
     306             :         {
     307           0 :             mrStateSet->AddState(aState);
     308           0 :             FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(),Any(aState));
     309             :         }
     310             :         else
     311             :         {
     312           0 :             mrStateSet->RemoveState(aState);
     313           0 :             FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(aState),Any());
     314             :         }
     315             :     }
     316           0 : }
     317             : 
     318             : 
     319             : 
     320             : 
     321           0 : lang::Locale SAL_CALL AccessibleTreeNode::getLocale (void)
     322             :     throw (IllegalAccessibleComponentStateException,
     323             :         RuntimeException)
     324             : {
     325           0 :     ThrowIfDisposed ();
     326           0 :     Reference<XAccessibleContext> xParentContext;
     327           0 :     Reference<XAccessible> xParent (getAccessibleParent());
     328           0 :     if (xParent.is())
     329           0 :         xParentContext = xParent->getAccessibleContext();
     330             : 
     331           0 :     if (xParentContext.is())
     332           0 :         return xParentContext->getLocale();
     333             :     else
     334             :         // Strange, no parent!  Anyway, return the default locale.
     335           0 :         return Application::GetSettings().GetLanguageTag().getLocale();
     336             : }
     337             : 
     338             : 
     339             : 
     340             : 
     341           0 : void SAL_CALL AccessibleTreeNode::addAccessibleEventListener(
     342             :     const Reference<XAccessibleEventListener >& rxListener)
     343             :     throw (RuntimeException)
     344             : {
     345           0 :     if (rxListener.is())
     346             :     {
     347           0 :         const osl::MutexGuard aGuard(maMutex);
     348             : 
     349           0 :         if (IsDisposed())
     350             :         {
     351           0 :             uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
     352           0 :             rxListener->disposing (lang::EventObject (x));
     353             :         }
     354             :         else
     355             :         {
     356           0 :             if (mnClientId == 0)
     357           0 :                 mnClientId = comphelper::AccessibleEventNotifier::registerClient();
     358           0 :             if (mnClientId != 0)
     359           0 :                 comphelper::AccessibleEventNotifier::addEventListener(mnClientId, rxListener);
     360           0 :         }
     361             :     }
     362           0 : }
     363             : 
     364             : 
     365             : 
     366             : 
     367           0 : void SAL_CALL AccessibleTreeNode::removeAccessibleEventListener(
     368             :     const Reference<XAccessibleEventListener >& rxListener)
     369             :     throw (RuntimeException)
     370             : {
     371           0 :     ThrowIfDisposed();
     372           0 :     if (rxListener.is())
     373             :     {
     374           0 :         const osl::MutexGuard aGuard(maMutex);
     375             : 
     376           0 :         sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
     377           0 :         if ( !nListenerCount )
     378             :         {
     379             :             // no listeners anymore
     380             :             // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
     381             :             // and at least to us not firing any events anymore, in case somebody calls
     382             :             // NotifyAccessibleEvent, again
     383           0 :             if (mnClientId != 0)
     384             :             {
     385           0 :                 comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
     386           0 :                 mnClientId = 0;
     387             :             }
     388           0 :         }
     389             :     }
     390           0 : }
     391             : 
     392             : 
     393             : 
     394             : 
     395             : //===== XAccessibleComponent ==================================================
     396             : 
     397           0 : sal_Bool SAL_CALL AccessibleTreeNode::containsPoint (const awt::Point& aPoint)
     398             :     throw (RuntimeException)
     399             : {
     400           0 :     ThrowIfDisposed();
     401           0 :     const awt::Rectangle aBBox (getBounds());
     402           0 :     return (aPoint.X >= 0)
     403           0 :         && (aPoint.X < aBBox.Width)
     404           0 :         && (aPoint.Y >= 0)
     405           0 :         && (aPoint.Y < aBBox.Height);
     406             : }
     407             : 
     408             : 
     409             : 
     410             : 
     411             : Reference<XAccessible> SAL_CALL
     412           0 :     AccessibleTreeNode::getAccessibleAtPoint (const awt::Point& aPoint)
     413             :     throw (RuntimeException)
     414             : {
     415           0 :     ThrowIfDisposed();
     416           0 :     Reference<XAccessible> xChildAtPoint;
     417           0 :     const SolarMutexGuard aSolarGuard;
     418             : 
     419           0 :     sal_Int32 nChildCount = getAccessibleChildCount();
     420           0 :     for (sal_Int32 nIndex=0; nIndex<nChildCount; ++nIndex)
     421             :     {
     422             :         Reference<XAccessibleComponent> xChildComponent(
     423           0 :             getAccessibleChild(nIndex), UNO_QUERY);
     424           0 :         if (xChildComponent.is())
     425             :         {
     426           0 :             awt::Point aChildPoint(aPoint);
     427           0 :             awt::Point aChildOrigin(xChildComponent->getLocation());
     428           0 :             aChildPoint.X -= aChildOrigin.X;
     429           0 :             aChildPoint.Y -= aChildOrigin.Y;
     430           0 :             if (xChildComponent->containsPoint(aChildPoint))
     431             :             {
     432           0 :                 xChildAtPoint = getAccessibleChild(nIndex);
     433           0 :                 break;
     434             :             }
     435             :         }
     436           0 :     }
     437             : 
     438           0 :     return xChildAtPoint;
     439             : }
     440             : 
     441             : 
     442             : 
     443             : 
     444           0 : awt::Rectangle SAL_CALL AccessibleTreeNode::getBounds (void)
     445             :     throw (RuntimeException)
     446             : {
     447           0 :     ThrowIfDisposed ();
     448             : 
     449           0 :     awt::Rectangle aBBox;
     450             : 
     451           0 :     ::Window* pWindow = mrTreeNode.GetWindow();
     452           0 :     if (pWindow != NULL)
     453             :     {
     454           0 :         Point aPosition;
     455           0 :         if (mxParent.is())
     456             :         {
     457           0 :             aPosition = pWindow->OutputToAbsoluteScreenPixel(Point(0,0));
     458             :             Reference<XAccessibleComponent> xParentComponent (
     459           0 :                 mxParent->getAccessibleContext(), UNO_QUERY);
     460           0 :             if (xParentComponent.is())
     461             :             {
     462           0 :                 awt::Point aParentPosition (xParentComponent->getLocationOnScreen());
     463           0 :                 aPosition.X() -= aParentPosition.X;
     464           0 :                 aPosition.Y() -= aParentPosition.Y;
     465           0 :             }
     466             :         }
     467             :         else
     468           0 :             aPosition = pWindow->GetPosPixel();
     469           0 :         aBBox.X = aPosition.X();
     470           0 :         aBBox.Y = aPosition.Y();
     471             : 
     472           0 :         Size aSize (pWindow->GetSizePixel());
     473           0 :         aBBox.Width = aSize.Width();
     474           0 :         aBBox.Height = aSize.Height();
     475             :     }
     476             : 
     477           0 :     return aBBox;
     478             : }
     479             : 
     480             : 
     481             : 
     482             : 
     483           0 : awt::Point SAL_CALL AccessibleTreeNode::getLocation (void)
     484             :     throw (uno::RuntimeException)
     485             : {
     486           0 :     ThrowIfDisposed();
     487           0 :     const awt::Rectangle aBBox (getBounds());
     488           0 :     return awt::Point(aBBox.X,aBBox.Y);
     489             : }
     490             : 
     491             : 
     492             : 
     493             : 
     494             : /** Calculate the location on screen from the parent's location on screen
     495             :     and our own relative location.
     496             : */
     497           0 : awt::Point SAL_CALL AccessibleTreeNode::getLocationOnScreen()
     498             :     throw (uno::RuntimeException)
     499             : {
     500           0 :     ThrowIfDisposed();
     501           0 :     const SolarMutexGuard aSolarGuard;
     502           0 :     awt::Point aLocationOnScreen;
     503             : 
     504           0 :     ::Window* pWindow = mrTreeNode.GetWindow();
     505           0 :     if (pWindow != NULL)
     506             :     {
     507           0 :         Point aPoint (pWindow->OutputToAbsoluteScreenPixel(Point(0,0)));
     508           0 :         aLocationOnScreen.X = aPoint.X();
     509           0 :         aLocationOnScreen.Y = aPoint.Y();
     510             :     }
     511             : 
     512           0 :     return aLocationOnScreen;
     513             : }
     514             : 
     515             : 
     516             : 
     517             : 
     518           0 : awt::Size SAL_CALL AccessibleTreeNode::getSize (void)
     519             :     throw (uno::RuntimeException)
     520             : {
     521           0 :     ThrowIfDisposed();
     522           0 :     const awt::Rectangle aBBox (getBounds());
     523           0 :     return awt::Size(aBBox.Width,aBBox.Height);
     524             : }
     525             : 
     526             : 
     527             : 
     528             : 
     529           0 : void SAL_CALL AccessibleTreeNode::grabFocus (void)
     530             :     throw (uno::RuntimeException)
     531             : {
     532           0 :     ThrowIfDisposed();
     533           0 :     const SolarMutexGuard aSolarGuard;
     534             : 
     535           0 :     if (mrTreeNode.GetWindow() != NULL)
     536           0 :         mrTreeNode.GetWindow()->GrabFocus();
     537           0 : }
     538             : 
     539             : 
     540             : 
     541             : 
     542           0 : sal_Int32 SAL_CALL AccessibleTreeNode::getForeground (void)
     543             :     throw (RuntimeException)
     544             : {
     545           0 :     ThrowIfDisposed();
     546           0 :     svtools::ColorConfig aColorConfig;
     547           0 :     sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
     548           0 :     return static_cast<sal_Int32>(nColor);
     549             : }
     550             : 
     551             : 
     552             : 
     553             : 
     554           0 : sal_Int32 SAL_CALL AccessibleTreeNode::getBackground (void)
     555             :     throw (RuntimeException)
     556             : {
     557           0 :     ThrowIfDisposed();
     558           0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     559           0 :     return static_cast<sal_Int32>(nColor);
     560             : }
     561             : 
     562             : 
     563             : 
     564             : 
     565             : //=====  XServiceInfo  ========================================================
     566             : 
     567             : OUString SAL_CALL
     568           0 :        AccessibleTreeNode::getImplementationName (void)
     569             :     throw (::com::sun::star::uno::RuntimeException)
     570             : {
     571           0 :     return OUString("AccessibleTreeNode");
     572             : }
     573             : 
     574             : 
     575             : 
     576             : 
     577             : sal_Bool SAL_CALL
     578           0 :      AccessibleTreeNode::supportsService (const OUString& sServiceName)
     579             :     throw (::com::sun::star::uno::RuntimeException)
     580             : {
     581           0 :     ThrowIfDisposed ();
     582             : 
     583             :     //  Iterate over all supported service names and return true if on of them
     584             :     //  matches the given name.
     585             :     uno::Sequence< OUString> aSupportedServices (
     586           0 :         getSupportedServiceNames ());
     587           0 :     for (int i=0; i<aSupportedServices.getLength(); i++)
     588           0 :         if (sServiceName == aSupportedServices[i])
     589           0 :             return sal_True;
     590           0 :     return sal_False;
     591             : }
     592             : 
     593             : 
     594             : 
     595             : 
     596             : uno::Sequence< OUString> SAL_CALL
     597           0 :        AccessibleTreeNode::getSupportedServiceNames (void)
     598             :     throw (::com::sun::star::uno::RuntimeException)
     599             : {
     600           0 :     ThrowIfDisposed ();
     601             :     static const OUString sServiceNames[2] = {
     602             :             OUString("com.sun.star.accessibility.Accessible"),
     603             :             OUString("com.sun.star.accessibility.AccessibleContext"),
     604           0 :     };
     605           0 :     return uno::Sequence<OUString> (sServiceNames, 2);
     606             : }
     607             : 
     608             : 
     609             : 
     610             : 
     611           0 : void AccessibleTreeNode::ThrowIfDisposed (void)
     612             :     throw (lang::DisposedException)
     613             : {
     614           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     615             :     {
     616             :         OSL_TRACE ("Calling disposed object. Throwing exception:");
     617             :         throw lang::DisposedException ("object has been already disposed",
     618           0 :             static_cast<uno::XWeak*>(this));
     619             :     }
     620           0 : }
     621             : 
     622             : 
     623             : 
     624           0 : sal_Bool AccessibleTreeNode::IsDisposed (void)
     625             : {
     626           0 :     return (rBHelper.bDisposed || rBHelper.bInDispose);
     627             : }
     628             : 
     629             : 
     630             : 
     631             : 
     632           0 : IMPL_LINK(AccessibleTreeNode, StateChangeListener, TreeNodeStateChangeEvent*, pEvent)
     633             : {
     634           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     635           0 :         return 1; // mrTreeNode is probably dead
     636             : 
     637             :     OSL_ASSERT(pEvent!=NULL);
     638             :     OSL_ASSERT(&pEvent->mrSource==&mrTreeNode);
     639             : 
     640           0 :     switch(pEvent->meEventId)
     641             :     {
     642             :         case EID_CHILD_ADDED:
     643           0 :             if (pEvent->mpChild != NULL)
     644             :                 FireAccessibleEvent(AccessibleEventId::CHILD,
     645             :                     Any(),
     646           0 :                     Any(pEvent->mpChild->GetAccessibleObject()));
     647             :             else
     648           0 :                 FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN,Any(),Any());
     649           0 :             break;
     650             : 
     651             :         case EID_ALL_CHILDREN_REMOVED:
     652           0 :             FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN,Any(),Any());
     653           0 :             break;
     654             : 
     655             :         case EID_EXPANSION_STATE_CHANGED:
     656             :         case EID_FOCUSED_STATE_CHANGED:
     657             :         case EID_SHOWING_STATE_CHANGED:
     658           0 :             UpdateStateSet();
     659           0 :             break;
     660             :     }
     661           0 :     return 1;
     662             : }
     663             : 
     664             : 
     665             : 
     666             : 
     667           0 : IMPL_LINK(AccessibleTreeNode, WindowEventListener, VclWindowEvent*, pEvent)
     668             : {
     669           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     670           0 :         return 1; // mrTreeNode is probably dead
     671             : 
     672           0 :     switch (pEvent->GetId())
     673             :     {
     674             :         case VCLEVENT_WINDOW_HIDE:
     675             :             // This event may be sent while the window is destroyed so do
     676             :             // not call UpdateStateSet() which calls back to the window but
     677             :             // just set the two states VISIBLE and SHOWING to false.
     678           0 :             UpdateState(AccessibleStateType::VISIBLE, false);
     679           0 :             UpdateState(AccessibleStateType::SHOWING, false);
     680           0 :             break;
     681             : 
     682             :         case VCLEVENT_WINDOW_SHOW:
     683             :         case VCLEVENT_WINDOW_DATACHANGED:
     684           0 :             UpdateStateSet();
     685           0 :             break;
     686             : 
     687             :         case VCLEVENT_WINDOW_MOVE:
     688             :         case VCLEVENT_WINDOW_RESIZE:
     689           0 :             FireAccessibleEvent(AccessibleEventId::BOUNDRECT_CHANGED,Any(),Any());
     690           0 :             break;
     691             : 
     692             :         case VCLEVENT_WINDOW_GETFOCUS:
     693             :         case VCLEVENT_WINDOW_LOSEFOCUS:
     694           0 :             UpdateStateSet();
     695           0 :             break;
     696             :     }
     697           0 :     return 1;
     698             : }
     699             : 
     700          33 : } // end of namespace ::accessibility
     701             : 
     702             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10