Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/accessibility/svxrectctaccessiblecontext.cxx
Line
Count
Source
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 <svxrectctaccessiblecontext.hxx>
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>
25
#include <utility>
26
#include <vcl/svapp.hxx>
27
#include <osl/mutex.hxx>
28
#include <tools/debug.hxx>
29
#include <tools/gen.hxx>
30
#include <sal/log.hxx>
31
#include <vcl/settings.hxx>
32
#include <vcl/unohelp.hxx>
33
#include <svx/strings.hrc>
34
#include <svx/dlgctrl.hxx>
35
#include <svx/dialmgr.hxx>
36
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
37
#include <unotools/accessiblerelationsethelper.hxx>
38
39
using namespace ::cppu;
40
using namespace ::osl;
41
using namespace ::com::sun::star;
42
using namespace ::com::sun::star::uno;
43
using namespace ::com::sun::star::accessibility;
44
45
using namespace ::com::sun::star::lang;
46
47
0
#define MAX_NUM_OF_CHILDREN   9
48
0
#define NOCHILDSELECTED     -1
49
50
// internal
51
namespace
52
{
53
    struct ChildIndexToPointData
54
    {
55
        TranslateId pResIdName;
56
        TranslateId pResIdDescr;
57
        RectPoint  ePoint;
58
    };
59
}
60
61
62
static const ChildIndexToPointData* IndexToPoint( tools::Long nIndex )
63
0
{
64
0
    DBG_ASSERT( nIndex < 9 && nIndex >= 0, "-IndexToPoint(): invalid child index! You have been warned..." );
65
66
    // corners are counted from left to right and top to bottom
67
0
    static const ChildIndexToPointData  pCornerData[] =
68
0
    {                                                                   // index
69
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RID_SVXSTR_RECTCTL_ACC_CHLD_LT, RectPoint::LT },    //  0
70
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RID_SVXSTR_RECTCTL_ACC_CHLD_MT, RectPoint::MT },    //  1
71
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RID_SVXSTR_RECTCTL_ACC_CHLD_RT, RectPoint::RT },    //  2
72
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RID_SVXSTR_RECTCTL_ACC_CHLD_LM, RectPoint::LM },    //  3
73
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RID_SVXSTR_RECTCTL_ACC_CHLD_MM, RectPoint::MM },    //  4
74
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RID_SVXSTR_RECTCTL_ACC_CHLD_RM, RectPoint::RM },    //  5
75
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RID_SVXSTR_RECTCTL_ACC_CHLD_LB, RectPoint::LB },    //  6
76
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RID_SVXSTR_RECTCTL_ACC_CHLD_MB, RectPoint::MB },    //  7
77
0
        {   RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RID_SVXSTR_RECTCTL_ACC_CHLD_RB, RectPoint::RB }     //  8
78
0
    };
79
80
0
    return pCornerData + nIndex;
81
0
}
82
83
84
static tools::Long PointToIndex( RectPoint ePoint )
85
0
{
86
0
    tools::Long    nRet( static_cast<tools::Long>(ePoint) );
87
    // corner control
88
    // corners are counted from left to right and top to bottom
89
0
    DBG_ASSERT( int(RectPoint::LT) == 0 && int(RectPoint::MT) == 1 && int(RectPoint::RT) == 2 && int(RectPoint::LM) == 3 && int(RectPoint::MM) == 4 && int(RectPoint::RM) == 5 &&
90
0
                int(RectPoint::LB) == 6 && int(RectPoint::MB) == 7 && int(RectPoint::RB) == 8, "*PointToIndex(): unexpected enum value!" );
91
92
0
    nRet = static_cast<tools::Long>(ePoint);
93
94
0
    return nRet;
95
0
}
96
97
SvxRectCtlAccessibleContext::SvxRectCtlAccessibleContext(SvxRectCtl* pRepr)
98
0
    : mpRepr(pRepr)
99
0
    , mnSelectedChild(NOCHILDSELECTED)
100
0
{
101
0
    {
102
0
        ::SolarMutexGuard aSolarGuard;
103
0
        msName = SvxResId( RID_SVXSTR_RECTCTL_ACC_CORN_NAME );
104
0
        msDescription = SvxResId( RID_SVXSTR_RECTCTL_ACC_CORN_DESCR );
105
0
    }
106
107
0
    mvChildren.resize(MAX_NUM_OF_CHILDREN);
108
0
}
109
110
SvxRectCtlAccessibleContext::~SvxRectCtlAccessibleContext()
111
0
{
112
0
    ensureDisposed();
113
0
}
114
115
Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint )
116
0
{
117
0
    ::osl::MutexGuard           aGuard( m_aMutex );
118
119
0
    Reference< XAccessible >    xRet;
120
121
0
    tools::Long nChild = mpRepr ? PointToIndex(mpRepr->GetApproxRPFromPixPt(rPoint)) : NOCHILDSELECTED;
122
123
0
    if (nChild != NOCHILDSELECTED)
124
0
        xRet = getAccessibleChild( nChild );
125
126
0
    return xRet;
127
0
}
128
129
// XAccessibleContext
130
sal_Int64 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChildCount()
131
0
{
132
0
    return SvxRectCtl::NO_CHILDREN;
133
0
}
134
135
Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChild( sal_Int64 nIndex )
136
0
{
137
0
    checkChildIndex( nIndex );
138
139
0
    rtl::Reference< SvxRectCtlChildAccessibleContext > xChild(mvChildren[ nIndex ]);
140
0
    if( !xChild.is() )
141
0
    {
142
0
        ::SolarMutexGuard aSolarGuard;
143
144
0
        ::osl::MutexGuard   aGuard( m_aMutex );
145
146
0
        xChild = mvChildren[ nIndex ];
147
148
0
        if (!xChild.is() && mpRepr)
149
0
        {
150
0
            const ChildIndexToPointData*    p = IndexToPoint( nIndex );
151
152
0
            tools::Rectangle       aFocusRect( mpRepr->CalculateFocusRectangle( p->ePoint ) );
153
154
0
            rtl::Reference<SvxRectCtlChildAccessibleContext> pChild = new SvxRectCtlChildAccessibleContext(this,
155
0
                    SvxResId(p->pResIdName), SvxResId(p->pResIdDescr), aFocusRect, nIndex );
156
0
            mvChildren[ nIndex ] = pChild;
157
0
            xChild = pChild;
158
159
            // set actual state
160
0
            if( mnSelectedChild == nIndex )
161
0
                pChild->setStateChecked( true );
162
0
        }
163
0
    }
164
165
0
    return xChild;
166
0
}
167
168
Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleParent()
169
0
{
170
0
    ::osl::MutexGuard aGuard( m_aMutex );
171
0
    if (mpRepr)
172
0
        return mpRepr->getAccessibleParent();
173
0
    return uno::Reference<css::accessibility::XAccessible>();
174
0
}
175
176
sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole()
177
0
{
178
0
    return AccessibleRole::PANEL;
179
0
}
180
181
OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleDescription()
182
0
{
183
0
    ::osl::MutexGuard   aGuard( m_aMutex );
184
0
    return msDescription + " Please use arrow key to selection.";
185
0
}
186
187
OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName()
188
0
{
189
0
    ::osl::MutexGuard   aGuard( m_aMutex );
190
0
    return msName;
191
0
}
192
193
Reference< XAccessibleRelationSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRelationSet()
194
0
{
195
0
    ::osl::MutexGuard   aGuard( m_aMutex );
196
0
    if (mpRepr)
197
0
        return mpRepr->get_accessible_relation_set();
198
0
    return uno::Reference<css::accessibility::XAccessibleRelationSet>();
199
0
}
200
201
sal_Int64 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleStateSet()
202
0
{
203
0
    ::osl::MutexGuard                       aGuard( m_aMutex );
204
0
    sal_Int64 nStateSet = 0;
205
206
0
    if (mpRepr)
207
0
    {
208
0
        nStateSet |= AccessibleStateType::ENABLED;
209
0
        nStateSet |= AccessibleStateType::FOCUSABLE;
210
0
        if( mpRepr->HasFocus() )
211
0
            nStateSet |= AccessibleStateType::FOCUSED;
212
0
        nStateSet |= AccessibleStateType::OPAQUE;
213
214
0
        nStateSet |= AccessibleStateType::SHOWING;
215
216
0
        if( mpRepr->IsVisible() )
217
0
            nStateSet |= AccessibleStateType::VISIBLE;
218
0
    }
219
0
    else
220
0
        nStateSet |= AccessibleStateType::DEFUNC;
221
222
0
    return nStateSet;
223
0
}
224
225
void SAL_CALL SvxRectCtlAccessibleContext::grabFocus()
226
0
{
227
0
    ::SolarMutexGuard aSolarGuard;
228
0
    ::osl::MutexGuard   aGuard( m_aMutex );
229
230
0
    if (mpRepr)
231
0
        mpRepr->GrabFocus();
232
0
}
233
234
sal_Int32 SvxRectCtlAccessibleContext::getForeground()
235
0
{
236
0
    ::SolarMutexGuard aSolarGuard;
237
0
    ::osl::MutexGuard   aGuard( m_aMutex );
238
239
    //see SvxRectCtl::Paint
240
0
    const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
241
0
    return sal_Int32(rStyles.GetLabelTextColor());
242
0
}
243
244
sal_Int32 SvxRectCtlAccessibleContext::getBackground(  )
245
0
{
246
0
    ::SolarMutexGuard aSolarGuard;
247
0
    ::osl::MutexGuard   aGuard( m_aMutex );
248
249
    //see SvxRectCtl::Paint
250
0
    const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
251
0
    return sal_Int32(rStyles.GetDialogColor());
252
0
}
253
254
// XAccessibleSelection
255
void SvxRectCtlAccessibleContext::implSelect(sal_Int64 nIndex, bool bSelect)
256
0
{
257
0
    ::SolarMutexGuard aSolarGuard;
258
259
0
    ::osl::MutexGuard   aGuard( m_aMutex );
260
261
0
    checkChildIndex( nIndex );
262
263
0
    if (mpRepr)
264
0
    {
265
0
        const ChildIndexToPointData* pData = IndexToPoint(nIndex);
266
267
0
        assert(pData && "SvxRectCtlAccessibleContext::selectAccessibleChild(): this is an impossible state! Or at least should be...");
268
269
0
        if (bSelect)
270
0
        {
271
            // this does all what is needed, including the change of the child's state!
272
0
            mpRepr->SetActualRP( pData->ePoint );
273
0
        }
274
0
        else
275
0
        {
276
0
            SAL_WARN( "svx", "SvxRectCtlAccessibleContext::clearAccessibleSelection() is not possible!" );
277
0
        }
278
0
    }
279
0
}
280
281
bool SvxRectCtlAccessibleContext::implIsSelected( sal_Int64 nIndex )
282
0
{
283
0
    ::osl::MutexGuard   aGuard( m_aMutex );
284
285
0
    checkChildIndex( nIndex );
286
287
0
    return nIndex == mnSelectedChild;
288
0
}
289
290
// internals
291
void SvxRectCtlAccessibleContext::checkChildIndex( sal_Int64 nIndex )
292
0
{
293
0
    if( nIndex < 0 || nIndex >= getAccessibleChildCount() )
294
0
        throw lang::IndexOutOfBoundsException();
295
0
}
296
297
void SvxRectCtlAccessibleContext::FireChildFocus( RectPoint eButton )
298
0
{
299
0
    ::osl::MutexGuard   aGuard( m_aMutex );
300
0
    tools::Long nNew = PointToIndex( eButton );
301
0
    tools::Long nNumOfChildren = getAccessibleChildCount();
302
0
    if( nNew < nNumOfChildren )
303
0
    {
304
        // select new child
305
0
        mnSelectedChild = nNew;
306
0
        if( nNew != NOCHILDSELECTED )
307
0
        {
308
0
            if( mvChildren[ nNew ].is() )
309
0
                mvChildren[ nNew ]->FireFocusEvent();
310
0
        }
311
0
        else
312
0
        {
313
0
            Any                             aOld;
314
0
            Any                             aNew;
315
0
            aNew <<= AccessibleStateType::FOCUSED;
316
0
            NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
317
0
        }
318
0
    }
319
0
    else
320
0
        mnSelectedChild = NOCHILDSELECTED;
321
0
}
322
323
void SvxRectCtlAccessibleContext::selectChild( tools::Long nNew )
324
0
{
325
0
    ::osl::MutexGuard   aGuard( m_aMutex );
326
0
    if( nNew == mnSelectedChild )
327
0
        return;
328
329
0
    tools::Long    nNumOfChildren = getAccessibleChildCount();
330
0
    if( nNew < nNumOfChildren )
331
0
    {   // valid index
332
0
        if( mnSelectedChild != NOCHILDSELECTED )
333
0
        {   // deselect old selected child if one is selected
334
0
            SvxRectCtlChildAccessibleContext* pChild = mvChildren[ mnSelectedChild ].get();
335
0
            if( pChild )
336
0
                pChild->setStateChecked( false );
337
0
        }
338
339
        // select new child
340
0
        mnSelectedChild = nNew;
341
342
0
        if( nNew != NOCHILDSELECTED )
343
0
        {
344
0
            if( mvChildren[ nNew ].is() )
345
0
                mvChildren[ nNew ]->setStateChecked( true );
346
0
        }
347
0
    }
348
0
    else
349
0
        mnSelectedChild = NOCHILDSELECTED;
350
0
}
351
352
void SvxRectCtlAccessibleContext::selectChild(RectPoint eButton )
353
0
{
354
    // no guard -> is done in next selectChild
355
0
    selectChild(PointToIndex( eButton ));
356
0
}
357
358
void SAL_CALL SvxRectCtlAccessibleContext::disposing()
359
0
{
360
0
    ::osl::MutexGuard aGuard(m_aMutex);
361
0
    OAccessibleSelectionHelper::disposing();
362
0
    for (auto & rxChild : mvChildren)
363
0
    {
364
0
        if( rxChild.is() )
365
0
            rxChild->dispose();
366
0
    }
367
0
    mvChildren.clear();
368
0
    mpRepr = nullptr;
369
0
}
370
371
awt::Rectangle SvxRectCtlAccessibleContext::implGetBounds()
372
0
{
373
0
    ::SolarMutexGuard aSolarGuard;
374
0
    ::osl::MutexGuard   aGuard( m_aMutex );
375
376
0
    awt::Rectangle aRet;
377
378
0
    if (mpRepr)
379
0
    {
380
0
        const Point   aOutPos;
381
0
        Size          aOutSize(mpRepr->GetOutputSizePixel());
382
383
0
        aRet.X = aOutPos.X();
384
0
        aRet.Y = aOutPos.Y();
385
0
        aRet.Width = aOutSize.Width();
386
0
        aRet.Height = aOutSize.Height();
387
0
    }
388
389
0
    return aRet;
390
0
}
391
392
SvxRectCtlChildAccessibleContext::SvxRectCtlChildAccessibleContext(
393
    const Reference<XAccessible>&   rxParent,
394
    OUString               aName,
395
    OUString               aDescription,
396
    const tools::Rectangle& rBoundingBox,
397
    tools::Long nIndexInParent )
398
0
    : msDescription(std::move( aDescription ))
399
0
    , msName(std::move( aName ))
400
0
    , mxParent(rxParent)
401
0
    , maBoundingBox( rBoundingBox )
402
0
    , mnIndexInParent( nIndexInParent )
403
0
    , mbIsChecked( false )
404
0
{
405
0
}
406
407
SvxRectCtlChildAccessibleContext::~SvxRectCtlChildAccessibleContext()
408
0
{
409
0
    ensureDisposed();
410
0
}
411
412
Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleAtPoint( const awt::Point& /*rPoint*/ )
413
0
{
414
0
    return Reference< XAccessible >();
415
0
}
416
417
void SAL_CALL SvxRectCtlChildAccessibleContext::grabFocus()
418
0
{
419
0
}
420
421
sal_Int32 SvxRectCtlChildAccessibleContext::getForeground(  )
422
0
{
423
0
    ::SolarMutexGuard aSolarGuard;
424
0
    ::osl::MutexGuard   aGuard( m_aMutex );
425
426
    //see SvxRectCtl::Paint
427
0
    const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
428
0
    return sal_Int32(rStyles.GetLabelTextColor());
429
0
}
430
431
sal_Int32 SvxRectCtlChildAccessibleContext::getBackground(  )
432
0
{
433
0
    ::SolarMutexGuard aSolarGuard;
434
0
    ::osl::MutexGuard   aGuard( m_aMutex );
435
436
    //see SvxRectCtl::Paint
437
0
    const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
438
0
    return sal_Int32(rStyles.GetDialogColor());
439
0
}
440
441
// XAccessibleContext
442
sal_Int64 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleChildCount()
443
0
{
444
0
    return 0;
445
0
}
446
447
Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleChild( sal_Int64 /*nIndex*/ )
448
0
{
449
0
    throw lang::IndexOutOfBoundsException();
450
0
}
451
452
Reference< XAccessible > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleParent()
453
0
{
454
0
    return mxParent;
455
0
}
456
457
sal_Int16 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRole()
458
0
{
459
0
    return AccessibleRole::RADIO_BUTTON;
460
0
}
461
462
OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleDescription()
463
0
{
464
0
    return msDescription;
465
0
}
466
467
OUString SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleName()
468
0
{
469
0
    return msName;
470
0
}
471
472
Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRelationSet()
473
0
{
474
0
    rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper;
475
0
    if( mxParent.is() )
476
0
    {
477
0
        uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { mxParent };
478
0
        pRelationSetHelper->AddRelation(css::accessibility::AccessibleRelation(css::accessibility::AccessibleRelationType_MEMBER_OF, aSequence));
479
0
    }
480
481
0
    return pRelationSetHelper;
482
0
}
483
484
sal_Int64 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleStateSet()
485
0
{
486
0
    ::osl::MutexGuard                       aGuard( m_aMutex );
487
0
    sal_Int64 nStateSet = 0;
488
489
0
    if (!rBHelper.bDisposed)
490
0
    {
491
0
        if( mbIsChecked )
492
0
        {
493
0
            nStateSet |= AccessibleStateType::CHECKED;
494
0
        }
495
496
0
        nStateSet |= AccessibleStateType::ENABLED;
497
0
        nStateSet |= AccessibleStateType::SENSITIVE;
498
0
        nStateSet |= AccessibleStateType::OPAQUE;
499
0
        nStateSet |= AccessibleStateType::SELECTABLE;
500
0
        nStateSet |= AccessibleStateType::SHOWING;
501
0
        nStateSet |= AccessibleStateType::VISIBLE;
502
0
    }
503
0
    else
504
0
        nStateSet |= AccessibleStateType::DEFUNC;
505
506
0
    return nStateSet;
507
0
}
508
509
// XAccessibleValue
510
Any SAL_CALL SvxRectCtlChildAccessibleContext::getCurrentValue()
511
0
{
512
0
    Any aRet;
513
0
    aRet <<= ( mbIsChecked? 1.0 : 0.0 );
514
0
    return aRet;
515
0
}
516
517
sal_Bool SAL_CALL SvxRectCtlChildAccessibleContext::setCurrentValue( const Any& /*aNumber*/ )
518
0
{
519
0
    return false;
520
0
}
521
522
Any SAL_CALL SvxRectCtlChildAccessibleContext::getMaximumValue()
523
0
{
524
0
    Any aRet;
525
0
    aRet <<= 1.0;
526
0
    return aRet;
527
0
}
528
529
Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue()
530
0
{
531
0
    Any aRet;
532
0
    aRet <<= 0.0;
533
0
    return aRet;
534
0
}
535
536
Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumIncrement()
537
0
{
538
0
    Any aRet;
539
0
    aRet <<= 1.0;
540
0
    return aRet;
541
0
}
542
543
544
// XAccessibleAction
545
546
547
sal_Int32 SvxRectCtlChildAccessibleContext::getAccessibleActionCount( )
548
0
{
549
0
    return 1;
550
0
}
551
552
553
sal_Bool SvxRectCtlChildAccessibleContext::doAccessibleAction ( sal_Int32 nIndex )
554
0
{
555
0
    ::osl::MutexGuard   aGuard( m_aMutex );
556
557
0
    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
558
0
        throw IndexOutOfBoundsException();
559
560
0
    Reference<XAccessibleSelection> xSelection( mxParent, UNO_QUERY);
561
562
0
    xSelection->selectAccessibleChild(mnIndexInParent);
563
564
0
    return true;
565
0
}
566
567
568
OUString SvxRectCtlChildAccessibleContext::getAccessibleActionDescription ( sal_Int32 nIndex )
569
0
{
570
0
    ::osl::MutexGuard   aGuard( m_aMutex );
571
572
0
    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
573
0
        throw IndexOutOfBoundsException();
574
575
0
    return u"select"_ustr;
576
0
}
577
578
579
Reference< XAccessibleKeyBinding > SvxRectCtlChildAccessibleContext::getAccessibleActionKeyBinding( sal_Int32 nIndex )
580
0
{
581
0
    ::osl::MutexGuard   aGuard( m_aMutex );
582
583
0
    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
584
0
        throw IndexOutOfBoundsException();
585
586
0
    return Reference< XAccessibleKeyBinding >();
587
0
}
588
589
void SAL_CALL SvxRectCtlChildAccessibleContext::disposing()
590
0
{
591
0
    OAccessible::disposing();
592
0
    mxParent.clear();
593
0
}
594
595
awt::Rectangle SvxRectCtlChildAccessibleContext::implGetBounds(  )
596
0
{
597
    // no guard necessary, because no one changes maBoundingBox after creating it
598
0
    return vcl::unohelper::ConvertToAWTRect(maBoundingBox);
599
0
}
600
601
void SvxRectCtlChildAccessibleContext::setStateChecked( bool bChecked )
602
0
{
603
0
    if( mbIsChecked == bChecked )
604
0
        return;
605
606
0
    mbIsChecked = bChecked;
607
608
0
    Any                             aOld;
609
0
    Any                             aNew;
610
0
    Any&                            rMod = bChecked? aNew : aOld;
611
612
    //Send the STATE_CHANGED(Focused) event to accessible
613
0
    rMod <<= AccessibleStateType::FOCUSED;
614
0
    NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
615
616
0
    rMod <<= AccessibleStateType::CHECKED;
617
618
0
    NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
619
0
}
620
621
void SvxRectCtlChildAccessibleContext::FireFocusEvent()
622
0
{
623
0
    Any                             aOld;
624
0
    Any                             aNew;
625
0
    aNew <<= AccessibleStateType::FOCUSED;
626
0
    NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOld, aNew);
627
0
}
628
629
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */