21#include <com/sun/star/accessibility/AccessibleRole.hpp>
22#include <com/sun/star/accessibility/AccessibleEventId.hpp>
23#include <com/sun/star/accessibility/AccessibleStateType.hpp>
24#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
28#include <osl/mutex.hxx>
33#include <svx/strings.hrc>
36#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
39using namespace ::
cppu;
47#define MAX_NUM_OF_CHILDREN 9
48#define NOCHILDSELECTED -1
53 struct ChildIndexToPointData
64 DBG_ASSERT( nIndex < 9 && nIndex >= 0,
"-IndexToPoint(): invalid child index! You have been warned..." );
67 static const ChildIndexToPointData pCornerData[] =
69 { RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RID_SVXSTR_RECTCTL_ACC_CHLD_LT,
RectPoint::LT },
70 { RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RID_SVXSTR_RECTCTL_ACC_CHLD_MT,
RectPoint::MT },
71 { RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RID_SVXSTR_RECTCTL_ACC_CHLD_RT,
RectPoint::RT },
72 { RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RID_SVXSTR_RECTCTL_ACC_CHLD_LM,
RectPoint::LM },
73 { RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RID_SVXSTR_RECTCTL_ACC_CHLD_MM,
RectPoint::MM },
74 { RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RID_SVXSTR_RECTCTL_ACC_CHLD_RM,
RectPoint::RM },
75 { RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RID_SVXSTR_RECTCTL_ACC_CHLD_LB,
RectPoint::LB },
76 { RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RID_SVXSTR_RECTCTL_ACC_CHLD_MB,
RectPoint::MB },
77 { RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RID_SVXSTR_RECTCTL_ACC_CHLD_RB,
RectPoint::RB }
80 return pCornerData +
nIndex;
117 ::osl::MutexGuard aGuard(
m_aMutex );
119 Reference< XAccessible > xRet;
144 ::osl::MutexGuard aGuard(
m_aMutex );
148 if (!xChild.is() &&
mpRepr)
152 OUString aDescr(
SvxResId(
p->pResIdDescr));
157 aDescr, aFocusRect,
nIndex );
163 pChild->setStateChecked(
true );
172 ::osl::MutexGuard aGuard(
m_aMutex );
175 return uno::Reference<css::accessibility::XAccessible>();
180 return AccessibleRole::PANEL;
185 ::osl::MutexGuard aGuard(
m_aMutex );
186 return msDescription +
" Please use arrow key to selection.";
191 ::osl::MutexGuard aGuard(
m_aMutex );
200 ::osl::MutexGuard aGuard(
m_aMutex );
203 return uno::Reference<css::accessibility::XAccessibleRelationSet>();
208 ::osl::MutexGuard aGuard(
m_aMutex );
209 sal_Int64 nStateSet = 0;
213 nStateSet |= AccessibleStateType::ENABLED;
214 nStateSet |= AccessibleStateType::FOCUSABLE;
216 nStateSet |= AccessibleStateType::FOCUSED;
217 nStateSet |= AccessibleStateType::OPAQUE;
219 nStateSet |= AccessibleStateType::SHOWING;
222 nStateSet |= AccessibleStateType::VISIBLE;
225 nStateSet |= AccessibleStateType::DEFUNC;
233 ::osl::MutexGuard aGuard(
m_aMutex );
242 ::osl::MutexGuard aGuard(
m_aMutex );
252 ::osl::MutexGuard aGuard(
m_aMutex );
264 ::osl::MutexGuard aGuard(
m_aMutex );
270 DBG_ASSERT(
pData,
"SvxRectCtlAccessibleContext::selectAccessibleChild(): this is an impossible state! Or at least should be...");
281 SAL_WARN(
"svx",
"SvxRectCtlAccessibleContext::clearAccessibleSelection() is not possible!" );
288 ::osl::MutexGuard aGuard(
m_aMutex );
299 throw lang::IndexOutOfBoundsException();
304 ::osl::MutexGuard aGuard(
m_aMutex );
307 if( nNew < nNumOfChildren )
320 aNew <<= AccessibleStateType::FOCUSED;
321 NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
330 ::osl::MutexGuard aGuard(
m_aMutex );
335 if( nNew < nNumOfChildren )
366 OAccessibleSelectionHelper::disposing();
379 ::osl::MutexGuard aGuard(
m_aMutex );
388 aRet.X = aOutPos.
X();
389 aRet.Y = aOutPos.
Y();
390 aRet.Width = aOutSize.
Width();
391 aRet.Height = aOutSize.
Height();
398 const Reference<XAccessible>& rxParent,
400 OUString aDescription,
403 : msDescription(
std::move( aDescription ))
406 , maBoundingBox( rBoundingBox )
407 , mnIndexInParent( nIndexInParent )
408 , mbIsChecked( false )
419 return Reference< XAccessible >();
429 ::osl::MutexGuard aGuard(
m_aMutex );
439 ::osl::MutexGuard aGuard(
m_aMutex );
454 throw lang::IndexOutOfBoundsException();
464 return AccessibleRole::RADIO_BUTTON;
469 ::osl::MutexGuard aGuard(
m_aMutex );
475 ::osl::MutexGuard aGuard(
m_aMutex );
487 uno::Sequence< uno::Reference< uno::XInterface > > aSequence {
mxParent };
488 pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
491 return pRelationSetHelper;
496 ::osl::MutexGuard aGuard(
m_aMutex );
497 sal_Int64 nStateSet = 0;
499 if (!rBHelper.bDisposed)
503 nStateSet |= AccessibleStateType::CHECKED;
506 nStateSet |= AccessibleStateType::ENABLED;
507 nStateSet |= AccessibleStateType::SENSITIVE;
508 nStateSet |= AccessibleStateType::OPAQUE;
509 nStateSet |= AccessibleStateType::SELECTABLE;
510 nStateSet |= AccessibleStateType::SHOWING;
511 nStateSet |= AccessibleStateType::VISIBLE;
514 nStateSet |= AccessibleStateType::DEFUNC;
565 ::osl::MutexGuard aGuard(
m_aMutex );
568 throw IndexOutOfBoundsException();
570 Reference<XAccessibleSelection> xSelection(
mxParent, UNO_QUERY);
580 ::osl::MutexGuard aGuard(
m_aMutex );
583 throw IndexOutOfBoundsException();
591 ::osl::MutexGuard aGuard(
m_aMutex );
594 throw IndexOutOfBoundsException();
596 return Reference< XAccessibleKeyBinding >();
601 OAccessibleComponentHelper::disposing();
620 Any& rMod = bChecked? aNew : aOld;
623 rMod <<= AccessibleStateType::FOCUSED;
624 NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
626 rMod <<= AccessibleStateType::CHECKED;
628 NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
635 aNew <<= AccessibleStateType::FOCUSED;
636 NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
unotools::WeakReference< AnimationNode > mxParent
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetLabelTextColor() const
const Color & GetDialogColor() const
virtual css::awt::Rectangle implGetBounds() override
virtual OUString SAL_CALL getAccessibleDescription() override
virtual bool implIsSelected(sal_Int64 nAccessibleChildIndex) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual sal_Int32 SAL_CALL getForeground() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return empty reference to indicate that the relation set is not supported.
virtual void SAL_CALL disposing() override
void checkChildIndex(sal_Int64 nIndex)
void selectChild(RectPoint ePoint)
Selects a new child by point.
virtual void SAL_CALL grabFocus() override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
SvxRectCtlAccessibleContext(SvxRectCtl *pRepresentation)
std::vector< rtl::Reference< SvxRectCtlChildAccessibleContext > > mvChildren
array for all possible children
virtual sal_Int32 SAL_CALL getBackground() override
void FireChildFocus(RectPoint eButton)
SvxRectCtl * mpRepr
pointer to internal representation
OUString msDescription
Description of this object.
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
tools::Long mnSelectedChild
actual selected child
virtual void implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect) override
virtual ~SvxRectCtlAccessibleContext() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
OUString msName
Name of this object.
virtual OUString SAL_CALL getAccessibleName() override
bool mbIsChecked
Indicates, if object is checked.
virtual css::uno::Any SAL_CALL getMaximumValue() override
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding(sal_Int32 nIndex) override
virtual sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) override
virtual void SAL_CALL grabFocus() override
virtual void SAL_CALL disposing() override
virtual css::uno::Any SAL_CALL getMinimumIncrement() override
tools::Long mnIndexInParent
index of child in parent
virtual OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) override
virtual ~SvxRectCtlChildAccessibleContext() override
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return empty reference to indicate that the relation set is not supported.
OUString msName
Name of this object.
virtual OUString SAL_CALL getAccessibleName() override
css::uno::Reference< css::accessibility::XAccessible > mxParent
Reference to the parent object.
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual OUString SAL_CALL getAccessibleDescription() override
SvxRectCtlChildAccessibleContext(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, OUString aName, OUString aDescription, const tools::Rectangle &rBoundingBox, tools::Long nIndexInParent)
virtual sal_Bool SAL_CALL setCurrentValue(const css::uno::Any &aNumber) override
virtual sal_Int32 SAL_CALL getForeground() override
virtual sal_Int32 SAL_CALL getBackground() override
tools::Rectangle maBoundingBox
Bounding box.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
OUString msDescription
Description of this object.
void setStateChecked(bool bChecked)
Sets the checked status.
virtual sal_Int32 SAL_CALL getAccessibleActionCount() override
virtual css::uno::Any SAL_CALL getCurrentValue() override
virtual css::awt::Rectangle implGetBounds() override
implements the calculation of the bounding rectangle
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 nIndex) override
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual sal_Int64 SAL_CALL getAccessibleStateSet() override
virtual css::uno::Any SAL_CALL getMinimumValue() override
a11yrelationset get_accessible_relation_set() const
tools::Rectangle CalculateFocusRectangle() const
css::uno::Reference< css::accessibility::XAccessible > getAccessibleParent() const
RectPoint GetApproxRPFromPixPt(const css::awt::Point &rPixelPoint) const
static const sal_uInt8 NO_CHILDREN
void SetActualRP(RectPoint eNewRP)
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
static const ChildIndexToPointData * IndexToPoint(tools::Long nIndex)
static tools::Long PointToIndex(RectPoint ePoint)
#define MAX_NUM_OF_CHILDREN