27#include <com/sun/star/accessibility/AccessibleEventId.hpp>
28#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
29#include <com/sun/star/accessibility/AccessibleStateType.hpp>
30#include <com/sun/star/accessibility/AccessibleRole.hpp>
31#include <com/sun/star/drawing/LineStyle.hpp>
32#include <com/sun/star/drawing/FillStyle.hpp>
33#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
34#include <com/sun/star/view/XSelectionSupplier.hpp>
56using ::com::sun::star::uno::UNO_QUERY;
57using ::com::sun::star::uno::Reference;
58using ::osl::MutexGuard;
59using ::osl::ClearableMutexGuard;
60using ::com::sun::star::uno::Any;
69 bool bMayHaveChildren,
70 bool bAlwaysTransparent ) :
72 m_bIsDisposed( false ),
73 m_bMayHaveChildren( bMayHaveChildren ),
74 m_bChildrenInitialized( false ),
75 m_nEventNotifierId(0),
77 m_aAccInfo(
std::move( aAccInfo )),
78 m_bAlwaysTransparent( bAlwaysTransparent ),
79 m_bStateSetInitialized( false )
96 if( bThrowException &&
99 throw lang::DisposedException(
"component has state DEFUNC",
100 static_cast< uno::XWeak *
>(
const_cast< AccessibleBase *
>(
this )));
111 css::uno::Any aEmpty;
112 css::uno::Any aSelected;
113 aSelected <<= AccessibleStateType::SELECTED;
118 AddState( AccessibleStateType::SELECTED );
121 AddState( AccessibleStateType::FOCUSED );
122 aSelected <<= AccessibleStateType::FOCUSED;
125 SAL_INFO(
"chart2.accessibility",
"Selection acquired by: " << getAccessibleName());
134 AddState( AccessibleStateType::FOCUSED );
135 aSelected <<= AccessibleStateType::FOCUSED;
137 SAL_INFO(
"chart2.accessibility",
"Selection lost by: " << getAccessibleName());
147 ClearableMutexGuard aGuard(
m_aMutex );
152 for (
auto const& localChild : aLocalChildList)
157 ( localChild.get() )).NotifyEvent( eEventType, rId );
181 bool bMustUpdateChildren =
false;
193 if( bMustUpdateChildren )
201 bool bResult =
false;
207 std::vector< ChildOIDMap::key_type > aAccChildren;
208 aAccChildren.reserve( aModelChildren.size());
210 std::back_inserter( aAccChildren ),
213 std::sort( aModelChildren.begin(), aModelChildren.end());
215 std::vector< ObjectIdentifier > aChildrenToRemove, aChildrenToAdd;
216 std::set_difference( aModelChildren.begin(), aModelChildren.end(),
217 aAccChildren.begin(), aAccChildren.end(),
218 std::back_inserter( aChildrenToAdd ));
219 std::set_difference( aAccChildren.begin(), aAccChildren.end(),
220 aModelChildren.begin(), aModelChildren.end(),
221 std::back_inserter( aChildrenToRemove ));
223 for (
auto const& childToRemove : aChildrenToRemove)
229 aAccInfo.m_pParent =
this;
231 for (
auto const& childToAdd : aChildrenToAdd)
233 aAccInfo.m_aOID = childToAdd;
234 if ( childToAdd.isAutoGeneratedObject() )
238 else if ( childToAdd.isAdditionalShape() )
240 AddChild(
new AccessibleChartShape( aAccInfo ) );
251 OSL_ENSURE( pChild !=
nullptr,
"Invalid Child" );
255 ClearableMutexGuard aGuard(
m_aMutex );
278 ClearableMutexGuard aGuard(
m_aMutex );
290 ChildListVectorType::iterator aVecIter =
294 "Inconsistent ChildMap" );
323 ClearableMutexGuard aGuard(
m_aMutex );
332 OSL_FAIL(
"Default position used is probably incorrect." );
341 const Any & rOld )
const
343 ClearableMutexGuard aGuard(
m_aMutex );
351 const AccessibleEventObject
aEvent(
352 const_cast< uno::XWeak *
>(
static_cast< const uno::XWeak *
>(
this )),
353 nId, rNew, rOld, -1 );
363 ClearableMutexGuard aGuard(
m_aMutex );
376 for (
auto const& localChild : aLocalChildList)
381 xComp.set(localChild, UNO_QUERY);
428 OSL_ENSURE(
m_aChildList.empty(),
"Child list should be empty" );
440 ClearableMutexGuard aGuard(
m_aMutex );
451 if( bMustUpdateChildren )
467 ClearableMutexGuard aGuard(
m_aMutex );
473 if( bMustUpdateChildren )
490 OUString
aBuf =
"Index " + OUString::number(
i ) +
" is invalid for range [ 0, " +
493 lang::IndexOutOfBoundsException aEx(
aBuf,
525 return AccessibleRole::SHAPE;
544 AddState( AccessibleStateType::SELECTED );
545 AddState( AccessibleStateType::FOCUSED );
570 return ( aPoint.X >= aRect.X &&
571 aPoint.Y >= aRect.Y &&
572 aPoint.X < (aRect.X + aRect.Width) &&
573 aPoint.Y < (aRect.Y + aRect.Height) );
587 if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) &&
588 ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height)))
590 ClearableMutexGuard aGuard(
m_aMutex );
595 for (
auto const& localChild : aLocalChildList)
597 aComp.set(localChild, UNO_QUERY);
600 aRect = aComp->getBounds();
601 if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) &&
602 ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height)))
604 aResult = localChild;
624 aLogicRect.X + aLogicRect.Width,
625 aLogicRect.Y + aLogicRect.Height );
627 aRect = pWindow->LogicToPixel( aRect );
631 awt::Point aParentLocOnScreen;
634 aParentLocOnScreen = xParent->getLocationOnScreen();
637 awt::Point aOffset( aParentLocOnScreen.X - aULOnScreen.X,
638 aParentLocOnScreen.Y - aULOnScreen.Y );
640 return awt::Rectangle( aRect.
Left() - aOffset.X, aRect.
Top() - aOffset.Y,
645 return awt::Rectangle();
652 return awt::Point( aBBox.X, aBBox.Y );
662 awt::Point aUpperLeft(pParent->getLocationOnScreen());
664 return awt::Point( aUpperLeft.X + aLocThisRel.X,
665 aUpperLeft.Y + aLocThisRel.Y );
675 return awt::Size( aBBox.Width, aBBox.Height );
685 xSelSupp->select(
GetId().getAny() );
724 OUString aStylePropName;
734 aStylePropName =
"BorderTransparency";
739 aStylePropName =
"Transparency";
746 aStylePropName =
"LineTransparence";
751 aStylePropName =
"FillTransparence";
759 xInfo->hasPropertyByName( aStylePropName ))
763 drawing::LineStyle aLStyle;
764 if( xObjProp->getPropertyValue( aStylePropName ) >>= aLStyle )
765 bTransparent = (aLStyle == drawing::LineStyle_NONE);
769 drawing::FillStyle aFStyle;
770 if( xObjProp->getPropertyValue( aStylePropName ) >>= aFStyle )
771 bTransparent = (aFStyle == drawing::FillStyle_NONE);
779 xObjProp->getPropertyValue(
aPropName ) >>= nResult;
782 catch(
const uno::Exception & )
794 return "AccessibleBase";
805 "com.sun.star.accessibility.Accessible",
806 "com.sun.star.accessibility.AccessibleContext"
820 if ( xListener.is() )
836 if ( !nListenerCount )
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
Base class for all Chart Accessibility objects.
void KillAllChildren()
Removes all children from the internal lists and broadcasts child remove events.
virtual css::uno::Reference< css::accessibility::XAccessible > ImplGetAccessibleChildById(sal_Int64 i) const
Is called from getAccessibleChild().
virtual sal_Int64 ImplGetAccessibleChildCount() const
Is called from getAccessibleChildCount().
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
AccessibleBase(AccessibleElementInfo aAccInfo, bool bMayHaveChildren, bool bAlwaysTransparent)
void SetInfo(const AccessibleElementInfo &rNewInfo)
std::vector< css::uno::Reference< css::accessibility::XAccessible > > ChildListVectorType
type of the vector containing the accessible children
const AccessibleUniqueId & GetId() const
virtual css::awt::Point GetUpperLeftOnScreen() const
Retrieve the pixel coordinates of logical coordinates (0,0) of the current logic coordinate system.
Color getColor(eColorType eColType)
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::awt::Rectangle SAL_CALL getBounds() override
virtual css::awt::Size SAL_CALL getSize() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
virtual css::awt::Point SAL_CALL getLocation() override
void AddState(sal_Int64 aState)
Adds a state to the set.
sal_Int64 m_nStateSet
for getAccessibleStateSet()
volatile bool m_bStateSetInitialized
denotes if the state-set is initialized.
ChildListVectorType m_aChildList
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
ChildOIDMap m_aChildOIDMap
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
bool UpdateChildren()
has to be overridden by derived classes that support child elements.
::comphelper::AccessibleEventNotifier::TClientId m_nEventNotifierId
bool NotifyEvent(EventType eType, const AccessibleUniqueId &rId)
Events coming from the core have to be processed in this methods.
virtual void SAL_CALL grabFocus() override
AccessibleElementInfo m_aAccInfo
virtual ~AccessibleBase() override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
void RemoveChildByOId(const ObjectIdentifier &rOId)
removes a child from the internal vector.
const bool m_bMayHaveChildren
bool m_bChildrenInitialized
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
virtual void SAL_CALL disposing() override
virtual css::lang::Locale SAL_CALL getLocale() override
bool CheckDisposeState(bool bThrowException=true) const
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 listeni...
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
const bool m_bAlwaysTransparent
void RemoveState(sal_Int64 aState)
Removes a state from the set if the set contains the state, otherwise nothing is done.
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
void AddChild(AccessibleBase *pChild)
adds a child to the end of the internal vector of children.
const AccessibleElementInfo & GetInfo() const
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
virtual sal_Int32 SAL_CALL getForeground() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual bool ImplUpdateChildren()
Is called by UpdateChildren.
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
static rtl::Reference< AccessibleBase > CreateChartElement(const AccessibleElementInfo &rAccInfo)
std::vector< ObjectIdentifier > tChildContainer
static OUString createClassifiedIdentifierForParticle(std::u16string_view rParticle)
const OUString & getObjectCID() const
static ObjectType getObjectType(std::u16string_view rCID)
static css::uno::Reference< css::beans::XPropertySet > getObjectPropertySet(std::u16string_view rObjectCID, const rtl::Reference< ::chart::ChartModel > &xChartDocument)
static std::u16string_view getFullParentParticle(std::u16string_view rCID)
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
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_INFO(area, stream)
::cppu::WeakComponentImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleEventBroadcaster, css::lang::XServiceInfo, css::lang::XEventListener > AccessibleBase_Base
@ OBJECTTYPE_LEGEND_ENTRY
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
css::uno::WeakReference< css::awt::XWindow > m_xWindow
std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy
AccessibleUniqueId m_aOID
AccessibleBase * m_pParent
unotools::WeakReference< ::chart::ChartModel > m_xChartDocument
unotools::WeakReference< ::chart::ChartView > m_xView