LibreOffice Module chart2 (master) 1
Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
chart::AccessibleBase Class Reference

Base class for all Chart Accessibility objects. More...

#include <AccessibleBase.hxx>

Inheritance diagram for chart::AccessibleBase:
[legend]
Collaboration diagram for chart::AccessibleBase:
[legend]

Public Types

enum class  EventType {
  GOT_SELECTION ,
  LOST_SELECTION
}
 

Public Member Functions

 AccessibleBase (AccessibleElementInfo aAccInfo, bool bMayHaveChildren, bool bAlwaysTransparent)
 
virtual ~AccessibleBase () override
 

Protected Member Functions

bool CheckDisposeState (bool bThrowException=true) const
 
bool NotifyEvent (EventType eType, const AccessibleUniqueId &rId)
 Events coming from the core have to be processed in this methods. More...
 
void AddState (sal_Int64 aState)
 Adds a state to the set. More...
 
void RemoveState (sal_Int64 aState)
 Removes a state from the set if the set contains the state, otherwise nothing is done. More...
 
bool UpdateChildren ()
 has to be overridden by derived classes that support child elements. More...
 
virtual bool ImplUpdateChildren ()
 Is called by UpdateChildren. More...
 
void AddChild (AccessibleBase *pChild)
 adds a child to the end of the internal vector of children. More...
 
void RemoveChildByOId (const ObjectIdentifier &rOId)
 removes a child from the internal vector. More...
 
virtual css::awt::Point GetUpperLeftOnScreen () const
 Retrieve the pixel coordinates of logical coordinates (0,0) of the current logic coordinate system. More...
 
void BroadcastAccEvent (sal_Int16 nId, const css::uno::Any &rNew, const css::uno::Any &rOld) const
 This method creates an AccessibleEventObject and sends it to all listeners that are currently listening to this object. More...
 
void KillAllChildren ()
 Removes all children from the internal lists and broadcasts child remove events. More...
 
virtual css::uno::Reference< css::accessibility::XAccessible > ImplGetAccessibleChildById (sal_Int64 i) const
 Is called from getAccessibleChild(). More...
 
virtual sal_Int64 ImplGetAccessibleChildCount () const
 Is called from getAccessibleChildCount(). More...
 
const AccessibleElementInfoGetInfo () const
 
void SetInfo (const AccessibleElementInfo &rNewInfo)
 
const AccessibleUniqueIdGetId () const
 
virtual void SAL_CALL disposing () override
 
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext () override
 
virtual sal_Int64 SAL_CALL getAccessibleChildCount () override
 
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild (sal_Int64 i) override
 
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent () override
 
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent () override
 
virtual sal_Int16 SAL_CALL getAccessibleRole () override
 
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet () override
 
virtual sal_Int64 SAL_CALL getAccessibleStateSet () override
 
virtual css::lang::Locale SAL_CALL getLocale () override
 
virtual sal_Bool SAL_CALL containsPoint (const css::awt::Point &aPoint) override
 
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint (const css::awt::Point &aPoint) override
 
virtual css::awt::Rectangle SAL_CALL getBounds () override
 
virtual css::awt::Point SAL_CALL getLocation () override
 
virtual css::awt::Point SAL_CALL getLocationOnScreen () override
 
virtual css::awt::Size SAL_CALL getSize () override
 
virtual void SAL_CALL grabFocus () override
 
virtual sal_Int32 SAL_CALL getForeground () override
 
virtual sal_Int32 SAL_CALL getBackground () override
 
virtual OUString SAL_CALL getImplementationName () override
 
virtual sal_Bool SAL_CALL supportsService (const OUString &ServiceName) override
 
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override
 
virtual void SAL_CALL disposing (const css::lang::EventObject &Source) override
 
virtual void SAL_CALL addAccessibleEventListener (const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
 
virtual void SAL_CALL removeAccessibleEventListener (const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
 

Private Types

enum  eColorType {
  ACC_BASE_FOREGROUND ,
  ACC_BASE_BACKGROUND
}
 
typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > ChildListVectorType
 type of the vector containing the accessible children More...
 
typedef std::map< ObjectIdentifier, css::uno::Reference< css::accessibility::XAccessible > > ChildOIDMap
 type of the hash containing a vector index for every AccessibleUniqueId of the object in the child list More...
 

Private Member Functions

Color getColor (eColorType eColType)
 

Private Attributes

bool m_bIsDisposed
 
const bool m_bMayHaveChildren
 
bool m_bChildrenInitialized
 
ChildListVectorType m_aChildList
 
ChildOIDMap m_aChildOIDMap
 
::comphelper::AccessibleEventNotifier::TClientId m_nEventNotifierId
 
sal_Int64 m_nStateSet
 for getAccessibleStateSet() More...
 
AccessibleElementInfo m_aAccInfo
 
const bool m_bAlwaysTransparent
 
volatile bool m_bStateSetInitialized
 denotes if the state-set is initialized. More...
 

Additional Inherited Members

- Protected Attributes inherited from cppu::BaseMutex
mutable::osl::Mutex m_aMutex
 

Detailed Description

Base class for all Chart Accessibility objects.

Definition at line 91 of file AccessibleBase.hxx.

Member Typedef Documentation

◆ ChildListVectorType

typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > chart::AccessibleBase::ChildListVectorType
private

type of the vector containing the accessible children

Definition at line 288 of file AccessibleBase.hxx.

◆ ChildOIDMap

typedef std::map< ObjectIdentifier, css::uno::Reference< css::accessibility::XAccessible > > chart::AccessibleBase::ChildOIDMap
private

type of the hash containing a vector index for every AccessibleUniqueId of the object in the child list

Definition at line 292 of file AccessibleBase.hxx.

Member Enumeration Documentation

◆ eColorType

Enumerator
ACC_BASE_FOREGROUND 
ACC_BASE_BACKGROUND 

Definition at line 278 of file AccessibleBase.hxx.

◆ EventType

Enumerator
GOT_SELECTION 
LOST_SELECTION 

Definition at line 96 of file AccessibleBase.hxx.

Constructor & Destructor Documentation

◆ AccessibleBase()

chart::AccessibleBase::AccessibleBase ( AccessibleElementInfo  aAccInfo,
bool  bMayHaveChildren,
bool  bAlwaysTransparent 
)
Parameters
bMayHaveChildrenis false per default

Definition at line 67 of file AccessibleBase.cxx.

References m_aMutex, and m_nStateSet.

◆ ~AccessibleBase()

chart::AccessibleBase::~AccessibleBase ( )
overridevirtual

Definition at line 89 of file AccessibleBase.cxx.

References m_bIsDisposed.

Member Function Documentation

◆ addAccessibleEventListener()

void SAL_CALL chart::AccessibleBase::addAccessibleEventListener ( const css::uno::Reference< css::accessibility::XAccessibleEventListener > &  xListener)
overrideprotectedvirtual

◆ AddChild()

void chart::AccessibleBase::AddChild ( AccessibleBase pChild)
protected

adds a child to the end of the internal vector of children.

As a result, the child-count increases by one, but all existing children keep their indices.

Important: as the implementation is needed, this should remain the only method for adding children (i.e. there mustn't be an AddChild( Reference< XAccessible > ) or the like).

Definition at line 249 of file AccessibleBase.cxx.

References Any, BroadcastAccEvent(), GetId(), m_aChildList, m_aChildOIDMap, cppu::BaseMutex::m_aMutex, and m_bChildrenInitialized.

◆ AddState()

void chart::AccessibleBase::AddState ( sal_Int64  aState)
protected

Adds a state to the set.

Exceptions
css::uno::RuntimeException

Definition at line 167 of file AccessibleBase.cxx.

References CheckDisposeState(), and m_nStateSet.

Referenced by getAccessibleStateSet(), and NotifyEvent().

◆ BroadcastAccEvent()

void chart::AccessibleBase::BroadcastAccEvent ( sal_Int16  nId,
const css::uno::Any &  rNew,
const css::uno::Any &  rOld 
) const
protected

This method creates an AccessibleEventObject and sends it to all listeners that are currently listening to this object.

Definition at line 338 of file AccessibleBase.cxx.

References comphelper::AccessibleEventNotifier::addEvent(), aEvent, cppu::BaseMutex::m_aMutex, m_nEventNotifierId, and nId.

Referenced by AddChild(), KillAllChildren(), NotifyEvent(), RemoveChildByOId(), and SetInfo().

◆ CheckDisposeState()

bool chart::AccessibleBase::CheckDisposeState ( bool  bThrowException = true) const
protected
Parameters
bThrowExceptionif true, a DisposedException is thrown if the object is already disposed
Returns
true, if the component is already disposed and bThrowException is false, false otherwise
Exceptions
css::lang::DisposedException

Definition at line 94 of file AccessibleBase.cxx.

References m_bIsDisposed.

Referenced by AddState(), getAccessibleAtPoint(), getAccessibleChild(), getAccessibleIndexInParent(), getAccessibleParent(), getLocale(), getLocation(), getLocationOnScreen(), getSize(), grabFocus(), and RemoveState().

◆ containsPoint()

sal_Bool SAL_CALL chart::AccessibleBase::containsPoint ( const css::awt::Point &  aPoint)
overrideprotectedvirtual

Definition at line 562 of file AccessibleBase.cxx.

References getBounds().

Referenced by chart::AccessibleChartElement::containsPoint().

◆ disposing() [1/2]

void SAL_CALL chart::AccessibleBase::disposing ( )
overrideprotectedvirtual

◆ disposing() [2/2]

virtual void SAL_CALL chart::AccessibleBase::disposing ( const css::lang::EventObject &  Source)
overrideprotectedvirtual

◆ getAccessibleAtPoint()

Reference< XAccessible > SAL_CALL chart::AccessibleBase::getAccessibleAtPoint ( const css::awt::Point &  aPoint)
overrideprotectedvirtual

◆ getAccessibleChild()

Reference< XAccessible > SAL_CALL chart::AccessibleBase::getAccessibleChild ( sal_Int64  i)
overrideprotectedvirtual

◆ getAccessibleChildCount()

sal_Int64 SAL_CALL chart::AccessibleBase::getAccessibleChildCount ( )
overrideprotectedvirtual

◆ getAccessibleContext()

Reference< XAccessibleContext > SAL_CALL chart::AccessibleBase::getAccessibleContext ( )
overrideprotectedvirtual

Definition at line 432 of file AccessibleBase.cxx.

◆ getAccessibleIndexInParent()

sal_Int64 SAL_CALL chart::AccessibleBase::getAccessibleIndexInParent ( )
overrideprotectedvirtual

◆ getAccessibleParent()

Reference< XAccessible > SAL_CALL chart::AccessibleBase::getAccessibleParent ( )
overrideprotectedvirtual

Definition at line 504 of file AccessibleBase.cxx.

References CheckDisposeState(), m_aAccInfo, and chart::AccessibleElementInfo::m_pParent.

Referenced by getBounds().

◆ getAccessibleRelationSet()

Reference< XAccessibleRelationSet > SAL_CALL chart::AccessibleBase::getAccessibleRelationSet ( )
overrideprotectedvirtual

Definition at line 528 of file AccessibleBase.cxx.

◆ getAccessibleRole()

sal_Int16 SAL_CALL chart::AccessibleBase::getAccessibleRole ( )
overrideprotectedvirtual
Returns
AccessibleRole.SHAPE

Definition at line 523 of file AccessibleBase.cxx.

◆ getAccessibleStateSet()

sal_Int64 SAL_CALL chart::AccessibleBase::getAccessibleStateSet ( )
overrideprotectedvirtual

◆ getBackground()

sal_Int32 SAL_CALL chart::AccessibleBase::getBackground ( )
overrideprotectedvirtual

Definition at line 694 of file AccessibleBase.cxx.

References ACC_BASE_BACKGROUND, and getColor().

Referenced by chart::AccessibleChartElement::getBackground().

◆ getBounds()

awt::Rectangle SAL_CALL chart::AccessibleBase::getBounds ( )
overrideprotectedvirtual

◆ getColor()

Color chart::AccessibleBase::getColor ( eColorType  eColType)
private

◆ getForeground()

sal_Int32 SAL_CALL chart::AccessibleBase::getForeground ( )
overrideprotectedvirtual

Definition at line 689 of file AccessibleBase.cxx.

References ACC_BASE_FOREGROUND, and getColor().

Referenced by chart::AccessibleChartElement::getForeground().

◆ GetId()

const AccessibleUniqueId & chart::AccessibleBase::GetId ( ) const
inlineprotected

◆ getImplementationName()

OUString SAL_CALL chart::AccessibleBase::getImplementationName ( )
overrideprotectedvirtual

Definition at line 792 of file AccessibleBase.cxx.

◆ GetInfo()

const AccessibleElementInfo & chart::AccessibleBase::GetInfo ( ) const
inlineprotected

Definition at line 217 of file AccessibleBase.hxx.

References m_aAccInfo.

Referenced by getAccessibleStateSet(), and grabFocus().

◆ getLocale()

lang::Locale SAL_CALL chart::AccessibleBase::getLocale ( )
overrideprotectedvirtual

◆ getLocation()

awt::Point SAL_CALL chart::AccessibleBase::getLocation ( )
overrideprotectedvirtual

◆ getLocationOnScreen()

awt::Point SAL_CALL chart::AccessibleBase::getLocationOnScreen ( )
overrideprotectedvirtual

◆ getSize()

awt::Size SAL_CALL chart::AccessibleBase::getSize ( )
overrideprotectedvirtual

Definition at line 671 of file AccessibleBase.cxx.

References CheckDisposeState(), and getBounds().

Referenced by chart::AccessibleChartElement::getSize().

◆ getSupportedServiceNames()

uno::Sequence< OUString > SAL_CALL chart::AccessibleBase::getSupportedServiceNames ( )
overrideprotectedvirtual

Definition at line 802 of file AccessibleBase.cxx.

◆ GetUpperLeftOnScreen()

awt::Point chart::AccessibleBase::GetUpperLeftOnScreen ( ) const
protectedvirtual

Retrieve the pixel coordinates of logical coordinates (0,0) of the current logic coordinate system.

This can be used for getLocationOnScreen, if the coordinates of an object are not relative to its direct parent, but a parent higher up in hierarchy.

Returns
the (x,y) pixel coordinates of the upper left corner

Definition at line 318 of file AccessibleBase.cxx.

References GetUpperLeftOnScreen(), m_aAccInfo, cppu::BaseMutex::m_aMutex, and chart::AccessibleElementInfo::m_pParent.

Referenced by getBounds(), and GetUpperLeftOnScreen().

◆ grabFocus()

void SAL_CALL chart::AccessibleBase::grabFocus ( )
overrideprotectedvirtual

◆ ImplGetAccessibleChildById()

Reference< XAccessible > chart::AccessibleBase::ImplGetAccessibleChildById ( sal_Int64  i) const
protectedvirtual

Is called from getAccessibleChild().

Before this method is called, an update of children is done if necessary.

Exceptions
css::lang::IndexOutOfBoundsException
css::uno::RuntimeException

Definition at line 481 of file AccessibleBase.cxx.

References aBuf, i, m_aChildList, cppu::BaseMutex::m_aMutex, m_bMayHaveChildren, and o3tl::make_unsigned().

Referenced by getAccessibleChild(), and chart::AccessibleChartElement::ImplGetAccessibleChildById().

◆ ImplGetAccessibleChildCount()

sal_Int64 chart::AccessibleBase::ImplGetAccessibleChildCount ( ) const
protectedvirtual

Is called from getAccessibleChildCount().

Before this method is called, an update of children is done if necessary.

Exceptions
css::uno::RuntimeException

Definition at line 457 of file AccessibleBase.cxx.

References m_aChildList.

Referenced by getAccessibleChildCount(), and chart::AccessibleChartElement::ImplGetAccessibleChildCount().

◆ ImplUpdateChildren()

bool chart::AccessibleBase::ImplUpdateChildren ( )
protectedvirtual

Is called by UpdateChildren.

This method is only called if an update is really necessary.

Definition at line 199 of file AccessibleBase.cxx.

References GetId(), m_aAccInfo, m_aChildOIDMap, and chart::AccessibleElementInfo::m_spObjectHierarchy.

Referenced by chart::AccessibleChartElement::ImplUpdateChildren(), and UpdateChildren().

◆ KillAllChildren()

void chart::AccessibleBase::KillAllChildren ( )
protected

Removes all children from the internal lists and broadcasts child remove events.

This method cares about mutex locking, and thus should be called without the mutex locked.

Definition at line 361 of file AccessibleBase.cxx.

References Any, BroadcastAccEvent(), m_aChildList, m_aChildOIDMap, cppu::BaseMutex::m_aMutex, and m_bChildrenInitialized.

Referenced by disposing(), and SetInfo().

◆ NotifyEvent()

bool chart::AccessibleBase::NotifyEvent ( EventType  eType,
const AccessibleUniqueId rId 
)
protected

Events coming from the core have to be processed in this methods.

The default implementation returns false, which indicates that the object is not interested in the event. To react on events you have to implement this method in derived classes.

The default implementation iterates over all children and forwards the event until the first child returns true.

Parameters
nObjIdcontains the object id of chart objects. If the object is no chart object, the event is not broadcast.
Returns
If an object is the addressee of the event it should return true, false otherwise.

Definition at line 105 of file AccessibleBase.cxx.

References AddState(), BroadcastAccEvent(), GetId(), GOT_SELECTION, LOST_SELECTION, m_aChildList, cppu::BaseMutex::m_aMutex, m_bMayHaveChildren, RemoveState(), and SAL_INFO.

◆ removeAccessibleEventListener()

void SAL_CALL chart::AccessibleBase::removeAccessibleEventListener ( const css::uno::Reference< css::accessibility::XAccessibleEventListener > &  xListener)
overrideprotectedvirtual

◆ RemoveChildByOId()

void chart::AccessibleBase::RemoveChildByOId ( const ObjectIdentifier rOId)
protected

removes a child from the internal vector.

in this method we imply that the Reference< XAccessible > elements in the vector are AccessibleBase objects !

All children with index greater than the index of the removed element get an index one less than before.

Definition at line 276 of file AccessibleBase.cxx.

References Any, BroadcastAccEvent(), m_aChildList, m_aChildOIDMap, cppu::BaseMutex::m_aMutex, and m_bChildrenInitialized.

Referenced by chart::AccessibleChartView::disposing().

◆ RemoveState()

void chart::AccessibleBase::RemoveState ( sal_Int64  aState)
protected

Removes a state from the set if the set contains the state, otherwise nothing is done.

Exceptions
css::uno::RuntimeException

Definition at line 173 of file AccessibleBase.cxx.

References CheckDisposeState(), and m_nStateSet.

Referenced by NotifyEvent().

◆ SetInfo()

void chart::AccessibleBase::SetInfo ( const AccessibleElementInfo rNewInfo)
protected

◆ supportsService()

sal_Bool SAL_CALL chart::AccessibleBase::supportsService ( const OUString &  ServiceName)
overrideprotectedvirtual

Definition at line 797 of file AccessibleBase.cxx.

References ServiceName, and cppu::supportsService().

◆ UpdateChildren()

bool chart::AccessibleBase::UpdateChildren ( )
protected

has to be overridden by derived classes that support child elements.

With this method a rescan is initiated that should result in a correct list of children.

This method is called when access to any methods concerning children is invoked for the first time.

Definition at line 179 of file AccessibleBase.cxx.

References ImplUpdateChildren(), cppu::BaseMutex::m_aMutex, m_bChildrenInitialized, m_bIsDisposed, and m_bMayHaveChildren.

Referenced by getAccessibleChild(), and getAccessibleChildCount().

Member Data Documentation

◆ m_aAccInfo

AccessibleElementInfo chart::AccessibleBase::m_aAccInfo
private

◆ m_aChildList

ChildListVectorType chart::AccessibleBase::m_aChildList
private

◆ m_aChildOIDMap

ChildOIDMap chart::AccessibleBase::m_aChildOIDMap
private

◆ m_bAlwaysTransparent

const bool chart::AccessibleBase::m_bAlwaysTransparent
private

Definition at line 308 of file AccessibleBase.hxx.

Referenced by getColor().

◆ m_bChildrenInitialized

bool chart::AccessibleBase::m_bChildrenInitialized
private

◆ m_bIsDisposed

bool chart::AccessibleBase::m_bIsDisposed
private

◆ m_bMayHaveChildren

const bool chart::AccessibleBase::m_bMayHaveChildren
private

◆ m_bStateSetInitialized

volatile bool chart::AccessibleBase::m_bStateSetInitialized
private

denotes if the state-set is initialized.

On initialization the selected state is checked.

This variable is monitored by the solar mutex!

Note: declared volatile to enable double-check-locking

Definition at line 316 of file AccessibleBase.hxx.

Referenced by getAccessibleStateSet().

◆ m_nEventNotifierId

::comphelper::AccessibleEventNotifier::TClientId chart::AccessibleBase::m_nEventNotifierId
private

◆ m_nStateSet

sal_Int64 chart::AccessibleBase::m_nStateSet
private

The documentation for this class was generated from the following files: