1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "AccessibleDrawDocumentView.hxx"
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <rtl/ustring.h>
#include<sfx2/viewfrm.hxx>
#include <svx/AccessibleShape.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdmodel.hxx>
#include <svx/unoapi.hxx>
#include <svx/unoshcol.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include "Window.hxx"
#include <vcl/svapp.hxx>
#include "ViewShell.hxx"
#include "View.hxx"
#include <memory>
#include "accessibility.hrc"
#include "sdresid.hxx"
#include <osl/mutex.hxx>
using ::rtl::OUString;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::accessibility;
class SfxViewFrame;
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
namespace accessibility {
//===== internal ============================================================
AccessibleDrawDocumentView::AccessibleDrawDocumentView (
::sd::Window* pSdWindow,
::sd::ViewShell* pViewShell,
const uno::Reference<frame::XController>& rxController,
const uno::Reference<XAccessible>& rxParent)
: AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent),
mpChildrenManager (NULL)
{
OSL_TRACE ("AccessibleDrawDocumentView");
UpdateAccessibleName();
}
AccessibleDrawDocumentView::~AccessibleDrawDocumentView (void)
{
OSL_TRACE ("~AccessibleDrawDocumentView");
DBG_ASSERT (rBHelper.bDisposed || rBHelper.bInDispose,
"~AccessibleDrawDocumentView: object has not been disposed");
}
void AccessibleDrawDocumentView::Init (void)
{
AccessibleDocumentViewBase::Init ();
// Determine the list of shapes on the current page.
uno::Reference<drawing::XShapes> xShapeList;
uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
if (xView.is())
xShapeList = uno::Reference<drawing::XShapes> (
xView->getCurrentPage(), uno::UNO_QUERY);
// Create the children manager.
mpChildrenManager = new ChildrenManager(this, xShapeList, maShapeTreeInfo, *this);
if (mpChildrenManager != NULL)
{
// Create the page shape and initialize it. The shape is acquired
// before initialization and released after transferring ownership
// to the children manager to prevent premature disposing of the
// shape.
AccessiblePageShape* pPage = CreateDrawPageShape();
if (pPage != NULL)
{
pPage->acquire();
pPage->Init();
mpChildrenManager->AddAccessibleShape (
std::auto_ptr<AccessibleShape>(pPage));
pPage->release();
mpChildrenManager->Update ();
}
mpChildrenManager->UpdateSelection ();
}
}
void AccessibleDrawDocumentView::ViewForwarderChanged (ChangeType aChangeType,
const IAccessibleViewForwarder* pViewForwarder)
{
AccessibleDocumentViewBase::ViewForwarderChanged (aChangeType, pViewForwarder);
if (mpChildrenManager != NULL)
mpChildrenManager->ViewForwarderChanged (aChangeType, pViewForwarder);
}
/** The page shape is created on every call at the moment (provided that
every thing goes well).
*/
AccessiblePageShape* AccessibleDrawDocumentView::CreateDrawPageShape (void)
{
AccessiblePageShape* pShape = NULL;
// Create a shape that represents the actual draw page.
uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
if (xView.is())
{
uno::Reference<beans::XPropertySet> xSet (
uno::Reference<beans::XPropertySet> (xView->getCurrentPage(), uno::UNO_QUERY));
if (xSet.is())
{
// Create a rectangle shape that will represent the draw page.
uno::Reference<lang::XMultiServiceFactory> xFactory (mxModel, uno::UNO_QUERY);
uno::Reference<drawing::XShape> xRectangle;
if (xFactory.is())
xRectangle = uno::Reference<drawing::XShape>(xFactory->createInstance (
OUString (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape"))),
uno::UNO_QUERY);
// Set the shape's size and position.
if (xRectangle.is())
{
uno::Any aValue;
awt::Point aPosition;
awt::Size aSize;
// Set size and position of the shape to those of the draw
// page.
aValue = xSet->getPropertyValue (
OUString (RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
aValue >>= aPosition.X;
aValue = xSet->getPropertyValue (
OUString (RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
aValue >>= aPosition.Y;
xRectangle->setPosition (aPosition);
aValue = xSet->getPropertyValue (
OUString (RTL_CONSTASCII_USTRINGPARAM("Width")));
aValue >>= aSize.Width;
aValue = xSet->getPropertyValue (
OUString (RTL_CONSTASCII_USTRINGPARAM("Height")));
aValue >>= aSize.Height;
xRectangle->setSize (aSize);
// Create the accessible object for the shape and
// initialize it.
pShape = new AccessiblePageShape (
xView->getCurrentPage(), this, maShapeTreeInfo);
}
}
}
return pShape;
}
//===== XAccessibleContext ==================================================
sal_Int32 SAL_CALL
AccessibleDrawDocumentView::getAccessibleChildCount (void)
throw (uno::RuntimeException)
{
ThrowIfDisposed ();
long mpChildCount = AccessibleDocumentViewBase::getAccessibleChildCount();
// Forward request to children manager.
if (mpChildrenManager != NULL)
mpChildCount += mpChildrenManager->GetChildCount ();
return mpChildCount;
}
uno::Reference<XAccessible> SAL_CALL
AccessibleDrawDocumentView::getAccessibleChild (sal_Int32 nIndex)
throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
{
ThrowIfDisposed ();
::osl::ClearableMutexGuard aGuard (maMutex);
// Take care of children of the base class.
sal_Int32 nCount = AccessibleDocumentViewBase::getAccessibleChildCount();
if (nCount > 0)
{
if (nIndex < nCount)
return AccessibleDocumentViewBase::getAccessibleChild(nIndex);
else
nIndex -= nCount;
}
// Create a copy of the pointer to the children manager and release the
// mutex before calling any of its methods.
ChildrenManager* pChildrenManager = mpChildrenManager;
aGuard.clear();
// Forward request to children manager.
if (pChildrenManager != NULL)
{
return pChildrenManager->GetChild (nIndex);
}
else
throw lang::IndexOutOfBoundsException (
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no accessible child with index "))
+ rtl::OUString::valueOf(nIndex),
static_cast<uno::XWeak*>(this));
}
//===== XEventListener ======================================================
void SAL_CALL
AccessibleDrawDocumentView::disposing (const lang::EventObject& rEventObject)
throw (::com::sun::star::uno::RuntimeException)
{
ThrowIfDisposed ();
AccessibleDocumentViewBase::disposing (rEventObject);
if (rEventObject.Source == mxModel)
{
::osl::Guard< ::osl::Mutex> aGuard (::osl::Mutex::getGlobalMutex());
// maShapeTreeInfo has been modified in base class.
if (mpChildrenManager != NULL)
mpChildrenManager->SetInfo (maShapeTreeInfo);
}
}
//===== XPropertyChangeListener =============================================
void SAL_CALL
AccessibleDrawDocumentView::propertyChange (const beans::PropertyChangeEvent& rEventObject)
throw (::com::sun::star::uno::RuntimeException)
{
ThrowIfDisposed ();
AccessibleDocumentViewBase::propertyChange (rEventObject);
OSL_TRACE ("AccessibleDrawDocumentView::propertyChange");
if (rEventObject.PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CurrentPage")))
{
OSL_TRACE (" current page changed");
// Update the accessible name to reflect the current slide.
UpdateAccessibleName();
// The current page changed. Update the children manager accordingly.
uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
if (xView.is() && mpChildrenManager!=NULL)
{
// Inform the children manager to forget all children and give
// him the new ones.
mpChildrenManager->ClearAccessibleShapeList ();
mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> (
xView->getCurrentPage(), uno::UNO_QUERY));
// Create the page shape and initialize it. The shape is
// acquired before initialization and released after
// transferring ownership to the children manager to prevent
// premature disposing of the shape.
AccessiblePageShape* pPage = CreateDrawPageShape ();
if (pPage != NULL)
{
pPage->acquire();
pPage->Init();
mpChildrenManager->AddAccessibleShape (
std::auto_ptr<AccessibleShape>(pPage));
mpChildrenManager->Update (false);
pPage->release();
}
}
else
OSL_TRACE ("View invalid");
}
else if (rEventObject.PropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("VisibleArea")))
{
OSL_TRACE (" visible area changed");
if (mpChildrenManager != NULL)
mpChildrenManager->ViewForwarderChanged (
IAccessibleViewForwarderListener::VISIBLE_AREA,
&maViewForwarder);
}
else
{
OSL_TRACE (" unhandled");
}
OSL_TRACE (" done");
}
//===== XServiceInfo ========================================================
::rtl::OUString SAL_CALL
AccessibleDrawDocumentView::getImplementationName (void)
throw (::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"AccessibleDrawDocumentView"));
}
::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
AccessibleDrawDocumentView::getSupportedServiceNames (void)
throw (::com::sun::star::uno::RuntimeException)
{
ThrowIfDisposed();
// Get list of supported service names from base class...
uno::Sequence<OUString> aServiceNames =
AccessibleDocumentViewBase::getSupportedServiceNames();
sal_Int32 nCount (aServiceNames.getLength());
// ...and add additional names.
aServiceNames.realloc (nCount + 1);
static const OUString sAdditionalServiceName (RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.drawing.AccessibleDrawDocumentView"));
aServiceNames[nCount] = sAdditionalServiceName;
return aServiceNames;
}
/// Create a name for this view.
::rtl::OUString
AccessibleDrawDocumentView::CreateAccessibleName (void)
throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sName;
uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY);
if (xInfo.is())
{
uno::Sequence< ::rtl::OUString > aServices( xInfo->getSupportedServiceNames() );
OUString sFirstService = aServices[0];
if (sFirstService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView")))
{
if( aServices.getLength() >= 2 &&
aServices[1].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.PresentationView")))
{
SolarMutexGuard aGuard;
sName = String( SdResId(SID_SD_A11Y_I_DRAWVIEW_N) );
}
else
{
SolarMutexGuard aGuard;
sName = String( SdResId(SID_SD_A11Y_D_DRAWVIEW_N) );
}
}
else if (sFirstService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.NotesView")))
{
SolarMutexGuard aGuard;
sName = String( SdResId(SID_SD_A11Y_I_NOTESVIEW_N) );
}
else if (sFirstService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.HandoutView")))
{
SolarMutexGuard aGuard;
sName = String( SdResId(SID_SD_A11Y_I_HANDOUTVIEW_N) );
}
else
{
sName = sFirstService;
}
}
else
{
sName = OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleDrawDocumentView"));
}
return sName;
}
/** Create a description for this view. Use the model's description or URL
if a description is not available.
*/
::rtl::OUString
AccessibleDrawDocumentView::CreateAccessibleDescription (void)
throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sDescription;
uno::Reference<lang::XServiceInfo> xInfo (mxController, uno::UNO_QUERY);
if (xInfo.is())
{
uno::Sequence< ::rtl::OUString > aServices( xInfo->getSupportedServiceNames() );
OUString sFirstService = aServices[0];
if (sFirstService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DrawingDocumentDrawView")))
{
if( aServices.getLength() >= 2 &&
aServices[1].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.PresentationView")))
{
SolarMutexGuard aGuard;
sDescription = String( SdResId(SID_SD_A11Y_I_DRAWVIEW_D) );
}
else
{
SolarMutexGuard aGuard;
sDescription = String( SdResId(SID_SD_A11Y_D_DRAWVIEW_D) );
}
}
else if (sFirstService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.NotesView")))
{
SolarMutexGuard aGuard;
sDescription = String( SdResId(SID_SD_A11Y_I_NOTESVIEW_D) );
}
else if (sFirstService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.HandoutView")))
{
SolarMutexGuard aGuard;
sDescription = String( SdResId(SID_SD_A11Y_I_HANDOUTVIEW_D) );
}
else
{
sDescription = sFirstService;
}
}
else
{
sDescription = OUString(RTL_CONSTASCII_USTRINGPARAM("Accessible Draw Document"));
}
return sDescription;
}
/** Return selection state of specified child
*/
sal_Bool
AccessibleDrawDocumentView::implIsSelected( sal_Int32 nAccessibleChildIndex )
throw (uno::RuntimeException)
{
const SolarMutexGuard aSolarGuard;
uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY );
sal_Bool bRet = sal_False;
OSL_ENSURE( 0 <= nAccessibleChildIndex, "AccessibleDrawDocumentView::implIsSelected: invalid index!" );
if( xSel.is() && ( 0 <= nAccessibleChildIndex ) )
{
uno::Any aAny( xSel->getSelection() );
uno::Reference< drawing::XShapes > xShapes;
aAny >>= xShapes;
if( xShapes.is() )
{
AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( nAccessibleChildIndex ) );
if( pAcc )
{
uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() );
if( xShape.is() )
{
for( sal_Int32 i = 0, nCount = xShapes->getCount(); ( i < nCount ) && !bRet; ++i )
if( xShapes->getByIndex( i ) == xShape )
bRet = sal_True;
}
}
}
}
return( bRet );
}
/** Select or delselect the specified shapes. The corresponding accessible
shapes are notified over the selection change listeners registered with
the XSelectionSupplier of the controller.
*/
void
AccessibleDrawDocumentView::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
{
const SolarMutexGuard aSolarGuard;
uno::Reference< view::XSelectionSupplier > xSel( mxController, uno::UNO_QUERY );
if( xSel.is() )
{
uno::Any aAny;
if( ACCESSIBLE_SELECTION_CHILD_ALL == nAccessibleChildIndex )
{
// Select or deselect all children.
if( !bSelect )
xSel->select( aAny );
else
{
uno::Reference< drawing::XShapes > xShapes( new SvxShapeCollection() );
for(sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
{
AccessibleShape* pAcc = AccessibleShape::getImplementation( getAccessibleChild( i ) );
if( pAcc && pAcc->GetXShape().is() )
xShapes->add( pAcc->GetXShape() );
}
if( xShapes->getCount() )
{
aAny <<= xShapes;
xSel->select( aAny );
}
}
}
else if( nAccessibleChildIndex >= 0 )
{
// Select or deselect only the child with index
// nAccessibleChildIndex.
AccessibleShape* pAcc = AccessibleShape::getImplementation(
getAccessibleChild( nAccessibleChildIndex ));
// Add or remove the shape that is made accessible from the
// selection of the controller.
if( pAcc )
{
uno::Reference< drawing::XShape > xShape( pAcc->GetXShape() );
if( xShape.is() )
{
uno::Reference< drawing::XShapes > xShapes;
sal_Bool bFound = sal_False;
aAny = xSel->getSelection();
aAny >>= xShapes;
// Search shape to be selected in current selection.
if (xShapes.is())
{
sal_Int32 nCount = xShapes->getCount();
for (sal_Int32 i=0; ( i < nCount ) && !bFound; ++i )
if( xShapes->getByIndex( i ) == xShape )
bFound = sal_True;
}
else
// Create an empty selection to add the shape to.
xShapes = new SvxShapeCollection();
// Update the selection.
if( !bFound && bSelect )
xShapes->add( xShape );
else if( bFound && !bSelect )
xShapes->remove( xShape );
aAny <<= xShapes;
xSel->select( aAny );
}
}
}
}
}
void AccessibleDrawDocumentView::Activated (void)
{
if (mpChildrenManager != NULL)
{
mpChildrenManager->UpdateSelection();
// When none of the children has the focus then claim it for the
// view.
if ( ! mpChildrenManager->HasFocus())
SetState (AccessibleStateType::FOCUSED);
else
ResetState (AccessibleStateType::FOCUSED);
}
}
void AccessibleDrawDocumentView::Deactivated (void)
{
if (mpChildrenManager != NULL)
mpChildrenManager->RemoveFocus();
ResetState (AccessibleStateType::FOCUSED);
}
void AccessibleDrawDocumentView::impl_dispose (void)
{
if (mpChildrenManager != NULL)
{
delete mpChildrenManager;
mpChildrenManager = NULL;
}
AccessibleDocumentViewBase::impl_dispose();
}
/** This method is called from the component helper base class while
disposing.
*/
void SAL_CALL AccessibleDrawDocumentView::disposing (void)
{
// Release resources.
if (mpChildrenManager != NULL)
{
delete mpChildrenManager;
mpChildrenManager = NULL;
}
// Forward call to base classes.
AccessibleDocumentViewBase::disposing ();
}
void AccessibleDrawDocumentView::UpdateAccessibleName (void)
{
OUString sNewName (CreateAccessibleName());
sNewName += A2S(": ");
// Add the number of the current slide.
uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
if (xView.is())
{
uno::Reference<beans::XPropertySet> xProperties (xView->getCurrentPage(), UNO_QUERY);
if (xProperties.is())
try
{
sal_Int16 nPageNumber (0);
if (xProperties->getPropertyValue(A2S("Number")) >>= nPageNumber)
{
sNewName += OUString::valueOf(sal_Int32(nPageNumber));
}
}
catch (beans::UnknownPropertyException&)
{
}
}
// Add the number of pages/slides.
Reference<drawing::XDrawPagesSupplier> xPagesSupplier (mxModel, UNO_QUERY);
if (xPagesSupplier.is())
{
Reference<container::XIndexAccess> xPages (xPagesSupplier->getDrawPages(), UNO_QUERY);
if (xPages.is())
{
sNewName += A2S(" / ");
sNewName += OUString::valueOf(xPages->getCount());
}
}
SetAccessibleName (sNewName, AutomaticallyCreated);
}
} // end of namespace accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|