LCOV - code coverage report
Current view: top level - libreoffice/editeng/source/accessibility - AccessibleContextBase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 201 0.0 %
Date: 2012-12-27 Functions: 0 36 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             : #include <editeng/AccessibleContextBase.hxx>
      21             : 
      22             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      23             : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
      24             : #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
      25             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      26             : #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
      27             : 
      28             : #include <unotools/accessiblestatesethelper.hxx>
      29             : #include <unotools/accessiblerelationsethelper.hxx>
      30             : #include <comphelper/accessibleeventnotifier.hxx>
      31             : #include <comphelper/servicehelper.hxx>
      32             : #include <osl/mutex.hxx>
      33             : 
      34             : #include <utility>
      35             : 
      36             : using namespace ::rtl;
      37             : using namespace ::com::sun::star;
      38             : using namespace ::com::sun::star::accessibility;
      39             : using ::com::sun::star::uno::Reference;
      40             : 
      41             : namespace accessibility {
      42             : 
      43             : //=====  internal  ============================================================
      44             : 
      45             : // Define a shortcut for the somewhot longish base class name.
      46             : typedef ::cppu::PartialWeakComponentImplHelper4<
      47             :     ::com::sun::star::accessibility::XAccessible,
      48             :     ::com::sun::star::accessibility::XAccessibleContext,
      49             :     ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
      50             :     ::com::sun::star::lang::XServiceInfo> BaseClass;
      51             : 
      52           0 : AccessibleContextBase::AccessibleContextBase (
      53             :         const uno::Reference<XAccessible>& rxParent,
      54             :         const sal_Int16 aRole)
      55             :     :   BaseClass (MutexOwner::maMutex),
      56             :         mxStateSet (NULL),
      57             :         mxRelationSet (NULL),
      58             :         mxParent(rxParent),
      59             :         msDescription(),
      60             :         meDescriptionOrigin(NotSet),
      61             :         msName(),
      62             :         meNameOrigin(NotSet),
      63             :         mnClientId(0),
      64           0 :         maRole(aRole)
      65             : {
      66             :     // Create the state set.
      67           0 :     ::utl::AccessibleStateSetHelper* pStateSet  = new ::utl::AccessibleStateSetHelper ();
      68           0 :     mxStateSet = pStateSet;
      69             : 
      70             :     // Set some states.  Don't use the SetState method because no events
      71             :     // shall be broadcastet (that is not yet initialized anyway).
      72           0 :     if (pStateSet != NULL)
      73             :     {
      74           0 :         pStateSet->AddState (AccessibleStateType::ENABLED);
      75           0 :         pStateSet->AddState (AccessibleStateType::SENSITIVE);
      76           0 :         pStateSet->AddState (AccessibleStateType::SHOWING);
      77           0 :         pStateSet->AddState (AccessibleStateType::VISIBLE);
      78           0 :         pStateSet->AddState (AccessibleStateType::FOCUSABLE);
      79           0 :         pStateSet->AddState (AccessibleStateType::SELECTABLE);
      80             :     }
      81             : 
      82             :     // Create the relation set.
      83           0 :     ::utl::AccessibleRelationSetHelper* pRelationSet = new ::utl::AccessibleRelationSetHelper ();
      84           0 :     mxRelationSet = pRelationSet;
      85           0 : }
      86             : 
      87             : 
      88             : 
      89             : 
      90           0 : AccessibleContextBase::~AccessibleContextBase(void)
      91             : {
      92           0 : }
      93             : 
      94             : 
      95             : 
      96             : 
      97           0 : sal_Bool AccessibleContextBase::SetState (sal_Int16 aState)
      98             : {
      99           0 :     ::osl::ClearableMutexGuard aGuard (maMutex);
     100             :     ::utl::AccessibleStateSetHelper* pStateSet =
     101           0 :         static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     102           0 :     if ((pStateSet != NULL) && !pStateSet->contains(aState))
     103             :     {
     104           0 :         pStateSet->AddState (aState);
     105             :         // Clear the mutex guard so that it is not locked during calls to
     106             :         // listeners.
     107           0 :         aGuard.clear();
     108             : 
     109             :         // Send event for all states except the DEFUNC state.
     110           0 :         if (aState != AccessibleStateType::DEFUNC)
     111             :         {
     112           0 :             uno::Any aNewValue;
     113           0 :             aNewValue <<= aState;
     114             :             CommitChange(
     115             :                 AccessibleEventId::STATE_CHANGED,
     116             :                 aNewValue,
     117           0 :                 uno::Any());
     118             :         }
     119           0 :         return sal_True;
     120             :     }
     121             :     else
     122           0 :         return sal_False;
     123             : }
     124             : 
     125             : 
     126             : 
     127             : 
     128           0 : sal_Bool AccessibleContextBase::ResetState (sal_Int16 aState)
     129             : {
     130           0 :     ::osl::ClearableMutexGuard aGuard (maMutex);
     131             :     ::utl::AccessibleStateSetHelper* pStateSet =
     132           0 :         static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     133           0 :     if ((pStateSet != NULL) && pStateSet->contains(aState))
     134             :     {
     135           0 :         pStateSet->RemoveState (aState);
     136             :         // Clear the mutex guard so that it is not locked during calls to listeners.
     137           0 :         aGuard.clear();
     138             : 
     139           0 :         uno::Any aOldValue;
     140           0 :         aOldValue <<= aState;
     141             :         CommitChange(
     142             :             AccessibleEventId::STATE_CHANGED,
     143             :             uno::Any(),
     144           0 :             aOldValue);
     145           0 :         return sal_True;
     146             :     }
     147             :     else
     148           0 :         return sal_False;
     149             : }
     150             : 
     151             : 
     152             : 
     153             : 
     154           0 : sal_Bool AccessibleContextBase::GetState (sal_Int16 aState)
     155             : {
     156           0 :     ::osl::MutexGuard aGuard (maMutex);
     157             :     ::utl::AccessibleStateSetHelper* pStateSet =
     158           0 :         static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     159           0 :     if (pStateSet != NULL)
     160           0 :         return pStateSet->contains(aState);
     161             :     else
     162             :         // If there is no state set then return false as a default value.
     163           0 :         return sal_False;
     164             : }
     165             : 
     166             : 
     167             : 
     168             : 
     169           0 : void AccessibleContextBase::SetRelationSet (
     170             :     const uno::Reference<XAccessibleRelationSet>& rxNewRelationSet)
     171             :     throw (::com::sun::star::uno::RuntimeException)
     172             : {
     173             :     OSL_TRACE ("setting relation set");
     174             : 
     175             :     // Try to emit some meaningfull events indicating differing relations in
     176             :     // both sets.
     177             :     typedef std::pair<short int,short int> RD;
     178             :     const RD aRelationDescriptors[] = {
     179             :         RD(AccessibleRelationType::CONTROLLED_BY, AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED),
     180             :         RD(AccessibleRelationType::CONTROLLER_FOR, AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED),
     181             :         RD(AccessibleRelationType::LABELED_BY, AccessibleEventId::LABELED_BY_RELATION_CHANGED),
     182             :         RD(AccessibleRelationType::LABEL_FOR, AccessibleEventId::LABEL_FOR_RELATION_CHANGED),
     183             :         RD(AccessibleRelationType::MEMBER_OF, AccessibleEventId::MEMBER_OF_RELATION_CHANGED),
     184             :         RD(AccessibleRelationType::INVALID, -1),
     185           0 :     };
     186           0 :     for (int i=0; aRelationDescriptors[i].first!=AccessibleRelationType::INVALID; i++)
     187           0 :         if (mxRelationSet->containsRelation(aRelationDescriptors[i].first)
     188           0 :         != rxNewRelationSet->containsRelation(aRelationDescriptors[i].first))
     189           0 :         CommitChange (aRelationDescriptors[i].second, uno::Any(), uno::Any());
     190             : 
     191           0 :     mxRelationSet = rxNewRelationSet;
     192           0 : }
     193             : 
     194             : 
     195             : 
     196             : 
     197             : //=====  XAccessible  =========================================================
     198             : 
     199             : uno::Reference< XAccessibleContext> SAL_CALL
     200           0 :     AccessibleContextBase::getAccessibleContext (void)
     201             :     throw (uno::RuntimeException)
     202             : {
     203           0 :     ThrowIfDisposed ();
     204           0 :     return this;
     205             : }
     206             : 
     207             : 
     208             : 
     209             : 
     210             : //=====  XAccessibleContext  ==================================================
     211             : 
     212             : /** No children.
     213             : */
     214             : sal_Int32 SAL_CALL
     215           0 :        AccessibleContextBase::getAccessibleChildCount (void)
     216             :     throw (uno::RuntimeException)
     217             : {
     218           0 :     ThrowIfDisposed ();
     219           0 :     return 0;
     220             : }
     221             : 
     222             : 
     223             : 
     224             : 
     225             : /** Forward the request to the shape.  Return the requested shape or throw
     226             :     an exception for a wrong index.
     227             : */
     228             : uno::Reference<XAccessible> SAL_CALL
     229           0 :     AccessibleContextBase::getAccessibleChild (sal_Int32 nIndex)
     230             :     throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
     231             : {
     232           0 :     ThrowIfDisposed ();
     233             :     throw lang::IndexOutOfBoundsException (
     234             :         ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no child with index ") + nIndex),
     235           0 :         NULL);
     236             : }
     237             : 
     238             : 
     239             : 
     240             : 
     241             : uno::Reference<XAccessible> SAL_CALL
     242           0 :        AccessibleContextBase::getAccessibleParent (void)
     243             :     throw (::com::sun::star::uno::RuntimeException)
     244             : {
     245           0 :     ThrowIfDisposed ();
     246           0 :     return mxParent;
     247             : }
     248             : 
     249             : 
     250             : 
     251             : 
     252             : sal_Int32 SAL_CALL
     253           0 :        AccessibleContextBase::getAccessibleIndexInParent (void)
     254             :     throw (::com::sun::star::uno::RuntimeException)
     255             : {
     256           0 :     ThrowIfDisposed ();
     257             :     //  Use a simple but slow solution for now.  Optimize later.
     258             : 
     259             :     //  Iterate over all the parent's children and search for this object.
     260           0 :     if (mxParent.is())
     261             :     {
     262             :         uno::Reference<XAccessibleContext> xParentContext (
     263           0 :             mxParent->getAccessibleContext());
     264           0 :         if (xParentContext.is())
     265             :         {
     266           0 :             sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
     267           0 :             for (sal_Int32 i=0; i<nChildCount; i++)
     268             :             {
     269           0 :                 uno::Reference<XAccessible> xChild (xParentContext->getAccessibleChild (i));
     270           0 :                 if (xChild.is())
     271             :                 {
     272           0 :                     uno::Reference<XAccessibleContext> xChildContext = xChild->getAccessibleContext();
     273           0 :                     if (xChildContext == (XAccessibleContext*)this)
     274           0 :                         return i;
     275             :                 }
     276           0 :             }
     277           0 :         }
     278             :    }
     279             : 
     280             :    //   Return -1 to indicate that this object's parent does not know about the
     281             :    //   object.
     282           0 :    return -1;
     283             : }
     284             : 
     285             : 
     286             : 
     287             : 
     288             : sal_Int16 SAL_CALL
     289           0 :     AccessibleContextBase::getAccessibleRole (void)
     290             :     throw (::com::sun::star::uno::RuntimeException)
     291             : {
     292           0 :     ThrowIfDisposed ();
     293           0 :     return maRole;
     294             : }
     295             : 
     296             : 
     297             : 
     298             : 
     299             : ::rtl::OUString SAL_CALL
     300           0 :        AccessibleContextBase::getAccessibleDescription (void)
     301             :     throw (::com::sun::star::uno::RuntimeException)
     302             : {
     303           0 :     ThrowIfDisposed ();
     304             : 
     305           0 :     return msDescription;
     306             : }
     307             : 
     308             : 
     309             : 
     310             : 
     311             : OUString SAL_CALL
     312           0 :        AccessibleContextBase::getAccessibleName (void)
     313             :     throw (::com::sun::star::uno::RuntimeException)
     314             : {
     315           0 :     ThrowIfDisposed ();
     316             : 
     317           0 :     if (meNameOrigin == NotSet)
     318             :     {
     319             :         // Do not send an event because this is the first time it has been
     320             :         // requested.
     321           0 :         msName = CreateAccessibleName();
     322           0 :         meNameOrigin = AutomaticallyCreated;
     323             :     }
     324             : 
     325           0 :     return msName;
     326             : }
     327             : 
     328             : 
     329             : 
     330             : 
     331             : /** Return a copy of the relation set.
     332             : */
     333             : uno::Reference<XAccessibleRelationSet> SAL_CALL
     334           0 :        AccessibleContextBase::getAccessibleRelationSet (void)
     335             :     throw (::com::sun::star::uno::RuntimeException)
     336             : {
     337           0 :     ThrowIfDisposed ();
     338             : 
     339             :     // Create a copy of the relation set and return it.
     340             :     ::utl::AccessibleRelationSetHelper* pRelationSet =
     341           0 :         static_cast< ::utl::AccessibleRelationSetHelper*>(mxRelationSet.get());
     342           0 :     if (pRelationSet != NULL)
     343             :     {
     344             :         return uno::Reference<XAccessibleRelationSet> (
     345           0 :             new ::utl::AccessibleRelationSetHelper (*pRelationSet));
     346             :     }
     347             :     else
     348           0 :         return uno::Reference<XAccessibleRelationSet>(NULL);
     349             : }
     350             : 
     351             : 
     352             : 
     353             : 
     354             : /** Return a copy of the state set.
     355             :     Possible states are:
     356             :         ENABLED
     357             :         SHOWING
     358             :         VISIBLE
     359             : */
     360             : uno::Reference<XAccessibleStateSet> SAL_CALL
     361           0 :     AccessibleContextBase::getAccessibleStateSet (void)
     362             :     throw (::com::sun::star::uno::RuntimeException)
     363             : {
     364           0 :     ::utl::AccessibleStateSetHelper* pStateSet = NULL;
     365             : 
     366           0 :     if (rBHelper.bDisposed)
     367             :     {
     368             :         // We are already disposed!
     369             :         // Create a new state set that has only set the DEFUNC state.
     370           0 :         pStateSet = new ::utl::AccessibleStateSetHelper ();
     371           0 :         if (pStateSet != NULL)
     372           0 :             pStateSet->AddState (AccessibleStateType::DEFUNC);
     373             :     }
     374             :     else
     375             :     {
     376             :         // Create a copy of the state set and return it.
     377           0 :         pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
     378             : 
     379             :         // Merge current focused state from edit engine.
     380             : #if 0
     381             :         if (aState == AccessibleStateType::FOCUSED
     382             :             && pStateSet != NULL
     383             :             && mpText != NULL)
     384             :         {
     385             :             if (mpText->GetFocusedState ())
     386             :                 pStateSet->AddState (aState);
     387             :             else
     388             :                 pStateSet->RemoveState (aState);
     389             :         }
     390             : #endif
     391           0 :         if (pStateSet != NULL)
     392           0 :             pStateSet = new ::utl::AccessibleStateSetHelper (*pStateSet);
     393             :     }
     394             : 
     395           0 :     return uno::Reference<XAccessibleStateSet>(pStateSet);
     396             : }
     397             : 
     398             : 
     399             : 
     400             : 
     401             : lang::Locale SAL_CALL
     402           0 :        AccessibleContextBase::getLocale (void)
     403             :     throw (IllegalAccessibleComponentStateException,
     404             :         ::com::sun::star::uno::RuntimeException)
     405             : {
     406           0 :     ThrowIfDisposed ();
     407             :     // Delegate request to parent.
     408           0 :     if (mxParent.is())
     409             :     {
     410             :         uno::Reference<XAccessibleContext> xParentContext (
     411           0 :             mxParent->getAccessibleContext());
     412           0 :         if (xParentContext.is())
     413           0 :             return xParentContext->getLocale ();
     414             :     }
     415             : 
     416             :     //  No locale and no parent.  Therefore throw exception to indicate this
     417             :     //  cluelessness.
     418           0 :     throw IllegalAccessibleComponentStateException ();
     419             : }
     420             : 
     421             : 
     422             : 
     423             : 
     424             : //=====  XAccessibleEventListener  ============================================
     425             : 
     426             : void SAL_CALL
     427           0 :     AccessibleContextBase::addAccessibleEventListener (
     428             :         const uno::Reference<XAccessibleEventListener >& rxListener)
     429             :     throw (uno::RuntimeException)
     430             : {
     431           0 :     if (rxListener.is())
     432             :     {
     433           0 :         if (rBHelper.bDisposed || rBHelper.bInDispose)
     434             :         {
     435           0 :             uno::Reference<uno::XInterface> x ((lang::XComponent *)this, uno::UNO_QUERY);
     436           0 :             rxListener->disposing (lang::EventObject (x));
     437             :         }
     438             :         else
     439             :         {
     440           0 :             if (!mnClientId)
     441           0 :                 mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
     442           0 :             comphelper::AccessibleEventNotifier::addEventListener( mnClientId, rxListener );
     443             :         }
     444             :     }
     445           0 : }
     446             : 
     447             : 
     448             : 
     449             : 
     450             : void SAL_CALL
     451           0 :     AccessibleContextBase::removeAccessibleEventListener (
     452             :         const uno::Reference<XAccessibleEventListener >& rxListener )
     453             :     throw (uno::RuntimeException)
     454             : {
     455           0 :     ThrowIfDisposed ();
     456           0 :     if (rxListener.is())
     457             :     {
     458           0 :         sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, rxListener );
     459           0 :         if ( !nListenerCount )
     460             :         {
     461             :             // no listeners anymore
     462             :             // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
     463             :             // and at least to us not firing any events anymore, in case somebody calls
     464             :             // NotifyAccessibleEvent, again
     465           0 :             comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
     466           0 :             mnClientId = 0;
     467             :         }
     468             :     }
     469           0 : }
     470             : 
     471             : 
     472             : 
     473             : 
     474             : //=====  XServiceInfo  ========================================================
     475             : 
     476             : ::rtl::OUString SAL_CALL
     477           0 :        AccessibleContextBase::getImplementationName (void)
     478             :     throw (::com::sun::star::uno::RuntimeException)
     479             : {
     480           0 :     ThrowIfDisposed ();
     481           0 :     return OUString("AccessibleContextBase");
     482             : }
     483             : 
     484             : 
     485             : 
     486             : 
     487             : sal_Bool SAL_CALL
     488           0 :      AccessibleContextBase::supportsService (const OUString& sServiceName)
     489             :     throw (::com::sun::star::uno::RuntimeException)
     490             : {
     491           0 :     ThrowIfDisposed ();
     492             :     //  Iterate over all supported service names and return true if on of them
     493             :     //  matches the given name.
     494             :     uno::Sequence< ::rtl::OUString> aSupportedServices (
     495           0 :         getSupportedServiceNames ());
     496           0 :     for (int i=0; i<aSupportedServices.getLength(); i++)
     497           0 :         if (sServiceName == aSupportedServices[i])
     498           0 :             return sal_True;
     499           0 :     return sal_False;
     500             : }
     501             : 
     502             : 
     503             : 
     504             : 
     505             : uno::Sequence< ::rtl::OUString> SAL_CALL
     506           0 :        AccessibleContextBase::getSupportedServiceNames (void)
     507             :     throw (::com::sun::star::uno::RuntimeException)
     508             : {
     509           0 :     ThrowIfDisposed ();
     510             :     static const OUString sServiceNames[2] = {
     511             :         OUString(
     512             :             "com.sun.star.accessibility.Accessible"),
     513             :         OUString(
     514             :             "com.sun.star.accessibility.AccessibleContext")
     515           0 :     };
     516           0 :     return uno::Sequence<OUString> (sServiceNames, 2);
     517             : }
     518             : 
     519             : 
     520             : 
     521             : 
     522             : //=====  XTypeProvider  =======================================================
     523             : 
     524             : uno::Sequence< ::com::sun::star::uno::Type>
     525           0 :     AccessibleContextBase::getTypes (void)
     526             :     throw (::com::sun::star::uno::RuntimeException)
     527             : {
     528           0 :     ThrowIfDisposed ();
     529             : 
     530             :     // This class supports no interfaces on its own.  Just return those
     531             :     // supported by the base class.
     532           0 :     return BaseClass::getTypes();
     533             : }
     534             : 
     535             : namespace
     536             : {
     537             :     class theAccessibleContextBaseImplementationId : public rtl::Static< UnoTunnelIdInit, theAccessibleContextBaseImplementationId > {};
     538             : }
     539             : 
     540             : uno::Sequence<sal_Int8> SAL_CALL
     541           0 :     AccessibleContextBase::getImplementationId (void)
     542             :     throw (::com::sun::star::uno::RuntimeException)
     543             : {
     544           0 :     return theAccessibleContextBaseImplementationId::get().getSeq();
     545             : }
     546             : 
     547             : //=====  internal  ============================================================
     548             : 
     549           0 : void SAL_CALL AccessibleContextBase::disposing (void)
     550             : {
     551           0 :     SetState (AccessibleStateType::DEFUNC);
     552             : 
     553           0 :     ::osl::MutexGuard aGuard (maMutex);
     554             : 
     555             :     // Send a disposing to all listeners.
     556           0 :     if ( mnClientId )
     557             :     {
     558           0 :         comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
     559           0 :         mnClientId =  0;
     560           0 :     }
     561           0 : }
     562             : 
     563             : 
     564             : 
     565             : 
     566           0 : void AccessibleContextBase::SetAccessibleDescription (
     567             :     const ::rtl::OUString& rDescription,
     568             :     StringOrigin eDescriptionOrigin)
     569             :     throw (uno::RuntimeException)
     570             : {
     571           0 :     if (eDescriptionOrigin < meDescriptionOrigin
     572           0 :         || (eDescriptionOrigin == meDescriptionOrigin && msDescription != rDescription))
     573             :     {
     574           0 :         uno::Any aOldValue, aNewValue;
     575           0 :         aOldValue <<= msDescription;
     576           0 :         aNewValue <<= rDescription;
     577             : 
     578           0 :         msDescription = rDescription;
     579           0 :         meDescriptionOrigin = eDescriptionOrigin;
     580             : 
     581             :         CommitChange(
     582             :             AccessibleEventId::DESCRIPTION_CHANGED,
     583             :             aNewValue,
     584           0 :             aOldValue);
     585             :     }
     586           0 : }
     587             : 
     588             : 
     589             : 
     590             : 
     591           0 : void AccessibleContextBase::SetAccessibleName (
     592             :     const ::rtl::OUString& rName,
     593             :     StringOrigin eNameOrigin)
     594             :     throw (uno::RuntimeException)
     595             : {
     596           0 :     if (eNameOrigin < meNameOrigin
     597           0 :         || (eNameOrigin == meNameOrigin && msName != rName))
     598             :     {
     599           0 :         uno::Any aOldValue, aNewValue;
     600           0 :         aOldValue <<= msName;
     601           0 :         aNewValue <<= rName;
     602             : 
     603           0 :         msName = rName;
     604           0 :         meNameOrigin = eNameOrigin;
     605             : 
     606             :         CommitChange(
     607             :             AccessibleEventId::NAME_CHANGED,
     608             :             aNewValue,
     609           0 :             aOldValue);
     610             :     }
     611           0 : }
     612             : 
     613             : 
     614             : 
     615             : 
     616           0 : ::rtl::OUString AccessibleContextBase::CreateAccessibleDescription (void)
     617             :     throw (::com::sun::star::uno::RuntimeException)
     618             : {
     619           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("Empty Description"));
     620             : }
     621             : 
     622             : 
     623             : 
     624             : 
     625           0 : ::rtl::OUString AccessibleContextBase::CreateAccessibleName (void)
     626             :     throw (::com::sun::star::uno::RuntimeException)
     627             : {
     628           0 :     return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("Empty Name"));
     629             : }
     630             : 
     631             : 
     632             : 
     633             : 
     634           0 : void AccessibleContextBase::CommitChange (
     635             :     sal_Int16 nEventId,
     636             :     const uno::Any& rNewValue,
     637             :     const uno::Any& rOldValue)
     638             : {
     639             :     // Do not call FireEvent and do not even create the event object when no
     640             :     // listener has been registered yet.  Creating the event object can
     641             :     // otherwise lead to a crash.  See issue 93419 for details.
     642           0 :     if (mnClientId != 0)
     643             :     {
     644             :         AccessibleEventObject aEvent (
     645             :             static_cast<XAccessibleContext*>(this),
     646             :             nEventId,
     647             :             rNewValue,
     648           0 :             rOldValue);
     649             : 
     650           0 :         FireEvent (aEvent);
     651             :     }
     652           0 : }
     653             : 
     654             : 
     655             : 
     656             : 
     657           0 : void AccessibleContextBase::FireEvent (const AccessibleEventObject& aEvent)
     658             : {
     659           0 :     if (mnClientId)
     660           0 :         comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
     661           0 : }
     662             : 
     663             : 
     664             : 
     665             : 
     666           0 : void AccessibleContextBase::ThrowIfDisposed (void)
     667             :     throw (::com::sun::star::lang::DisposedException)
     668             : {
     669           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     670             :     {
     671             :         OSL_TRACE ("Calling disposed object. Throwing exception:");
     672             :         throw lang::DisposedException (
     673             :             OUString("object has been already disposed"),
     674           0 :             static_cast<uno::XWeak*>(this));
     675             :     }
     676           0 : }
     677             : 
     678             : 
     679             : 
     680           0 : sal_Bool AccessibleContextBase::IsDisposed (void)
     681             : {
     682           0 :     return (rBHelper.bDisposed || rBHelper.bInDispose);
     683             : }
     684             : 
     685             : 
     686             : 
     687           0 : void AccessibleContextBase::SetAccessibleRole( sal_Int16 _nRole )
     688             : {
     689           0 :     maRole = _nRole;
     690           0 : }
     691             : 
     692             : 
     693             : } // end of namespace accessibility
     694             : 
     695             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10