22#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
23#include <com/sun/star/accessibility/AccessibleStateType.hpp>
24#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
25#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26#include <com/sun/star/accessibility/AccessibleEventId.hpp>
27#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
32#include <osl/mutex.hxx>
45 uno::Reference<XAccessible> xParent,
46 const sal_Int16 aRole)
49 meDescriptionOrigin(
NotSet),
76 ::osl::ClearableMutexGuard aGuard (
m_aMutex);
85 if (aState != AccessibleStateType::DEFUNC)
90 AccessibleEventId::STATE_CHANGED,
103 ::osl::ClearableMutexGuard aGuard (
m_aMutex);
111 aOldValue <<= aState;
113 AccessibleEventId::STATE_CHANGED,
125 ::osl::MutexGuard aGuard (
m_aMutex);
131 const uno::Reference<XAccessibleRelationSet>& rxNewRelationSet)
135 typedef std::pair<short int,short int> RD;
136 const RD aRelationDescriptors[] = {
137 RD(AccessibleRelationType::CONTROLLED_BY, AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED),
138 RD(AccessibleRelationType::CONTROLLER_FOR, AccessibleEventId::CONTROLLER_FOR_RELATION_CHANGED),
139 RD(AccessibleRelationType::LABELED_BY, AccessibleEventId::LABELED_BY_RELATION_CHANGED),
140 RD(AccessibleRelationType::LABEL_FOR, AccessibleEventId::LABEL_FOR_RELATION_CHANGED),
141 RD(AccessibleRelationType::MEMBER_OF, AccessibleEventId::MEMBER_OF_RELATION_CHANGED),
142 RD(AccessibleRelationType::INVALID, -1),
144 for (
int i=0; aRelationDescriptors[
i].first!=AccessibleRelationType::INVALID;
i++)
145 if (
mxRelationSet->containsRelation(aRelationDescriptors[
i].first)
146 != rxNewRelationSet->containsRelation(aRelationDescriptors[
i].first))
155uno::Reference< XAccessibleContext> SAL_CALL
176uno::Reference<XAccessible> SAL_CALL
180 throw lang::IndexOutOfBoundsException (
181 "no child with index " + OUString::number(
nIndex),
186uno::Reference<XAccessible> SAL_CALL
206 uno::Reference<XAccessibleContext> xParentContext (
208 if (xParentContext.is())
210 sal_Int64 nChildCount = xParentContext->getAccessibleChildCount();
211 for (sal_Int64
i=0;
i<nChildCount;
i++)
213 uno::Reference<XAccessible> xChild (xParentContext->getAccessibleChild (
i));
216 uno::Reference<XAccessibleContext> xChildContext = xChild->getAccessibleContext();
217 if (xChildContext ==
static_cast<XAccessibleContext*
>(
this))
265uno::Reference<XAccessibleRelationSet> SAL_CALL
273 if (pRelationSet !=
nullptr)
275 return uno::Reference<XAccessibleRelationSet> (
276 new ::utl::AccessibleRelationSetHelper (*pRelationSet));
279 return uno::Reference<XAccessibleRelationSet>(
nullptr);
292 if (rBHelper.bDisposed)
296 return AccessibleStateType::DEFUNC;
312 uno::Reference<XAccessibleContext> xParentContext (
314 if (xParentContext.is())
315 return xParentContext->getLocale ();
320 throw IllegalAccessibleComponentStateException ();
327 const uno::Reference<XAccessibleEventListener >& rxListener)
329 if (!rxListener.is())
332 if (rBHelper.bDisposed || rBHelper.bInDispose)
334 uno::Reference<uno::XInterface>
x (
static_cast<lang::XComponent *
>(
this), uno::UNO_QUERY);
335 rxListener->disposing (lang::EventObject (
x));
347 const uno::Reference<XAccessibleEventListener >& rxListener )
354 if ( !nListenerCount )
368 return "AccessibleContextBase";
376uno::Sequence< OUString > SAL_CALL
380 "com.sun.star.accessibility.Accessible",
381 "com.sun.star.accessibility.AccessibleContext"};
387uno::Sequence<sal_Int8> SAL_CALL
390 return css::uno::Sequence<sal_Int8>();
397 SetState (AccessibleStateType::DEFUNC);
399 ::osl::MutexGuard aGuard (
m_aMutex);
413 const OUString& rDescription,
422 aNewValue <<= rDescription;
428 AccessibleEventId::DESCRIPTION_CHANGED,
435 const OUString& rName,
450 AccessibleEventId::NAME_CHANGED,
466 sal_Int32 nValueIndex)
473 AccessibleEventObject
aEvent (
474 static_cast<XAccessibleContext*
>(
this),
494 if (rBHelper.bDisposed || rBHelper.bInDispose)
496 throw lang::DisposedException (
"object has been already disposed",
504 return (rBHelper.bDisposed || rBHelper.bInDispose);
constexpr OUStringLiteral sServiceName
unotools::WeakReference< AnimationNode > mxParent
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Returns an implementation id.
StringOrigin
The origin of the accessible name or description.
sal_Int64 mnStateSet
The state set.
virtual OUString SAL_CALL getAccessibleDescription() override
Return this object's description.
virtual bool SetState(sal_Int64 aState)
Set the specified state (turn it on) and send events to all listeners to inform them of the change.
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
Return the XAccessibleContext.
void ThrowIfDisposed()
Check whether or not the object has been disposed (or is in the state of being disposed).
sal_Int16 maRole
This is the role of this object.
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
Return the set of current states.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
virtual bool ResetState(sal_Int64 aState)
Reset the specified state (turn it off) and send events to all listeners to inform them of the change...
StringOrigin meNameOrigin
The origin of the name is used to determine whether new name given to the SetAccessibleName is ignore...
css::uno::Reference< css::accessibility::XAccessible > mxParent
Reference to the parent object.
void FireEvent(const css::accessibility::AccessibleEventObject &aEvent)
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
css::uno::Reference< css::accessibility::XAccessibleRelationSet > mxRelationSet
The relation set.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
Return the specified child or throw exception.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Return a reference to the parent.
void CommitChange(sal_Int16 aEventId, const css::uno::Any &rNewValue, const css::uno::Any &rOldValue, sal_Int32 nValueIndex)
Call all accessibility event listeners to inform them about the specified event.
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
AccessibleContextBase(css::uno::Reference< css::accessibility::XAccessible > xParent, const sal_Int16 aRole)
bool IsDisposed() const
Check whether or not the object has been disposed (or is in the state of being disposed).
virtual css::lang::Locale SAL_CALL getLocale() override
Return the parents locale or throw exception if this object has no parent yet/anymore.
virtual ~AccessibleContextBase() override
virtual OUString CreateAccessibleName()
Create the accessible object's name.
OUString msDescription
Description of this object.
sal_uInt32 mnClientId
client id in the AccessibleEventNotifier queue
void SetAccessibleRole(sal_Int16 _nRole)
sets the role as returned by XaccessibleContext::getAccessibleRole
bool GetState(sal_Int64 aState)
Return the state of the specified state.
virtual void SAL_CALL disposing() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
Return the number of currently visible children.
OUString msName
Name of this object.
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
Return this objects index among the parents children.
void SetAccessibleDescription(const OUString &rsDescription, StringOrigin eDescriptionOrigin)
Set a new description and, provided that the new name differs from the old one, broadcast an accessib...
void SetAccessibleName(const OUString &rsName, StringOrigin eNameOrigin)
Set a new description and, provided that the new name differs from the old one, broadcast an accessib...
virtual OUString SAL_CALL getAccessibleName() override
Return the object's current name.
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Return this object's role.
void SetRelationSet(const css::uno::Reference< css::accessibility::XAccessibleRelationSet > &rxRelationSet)
Replace the current relation set with the specified one.
StringOrigin meDescriptionOrigin
The origin of the description is used to determine whether new descriptions given to the SetAccessibl...
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return NULL to indicate that an empty relation set.
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
static sal_Int32 addEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static void addEvent(const TClientId _nClient, const css::accessibility::AccessibleEventObject &_rEvent)
static sal_Int32 removeEventListener(const TClientId _nClient, const css::uno::Reference< css::accessibility::XAccessibleEventListener > &_rxListener)
static TClientId registerClient()
static void revokeClient(const TClientId _nClient)
static void revokeClientNotifyDisposing(const TClientId _nClient, const css::uno::Reference< css::uno::XInterface > &_rxEventSource)
mutable::osl::Mutex m_aMutex
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)