1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <accessibledialogwindow.hxx>
22 #include <accessibledialogcontrolshape.hxx>
23 #include <baside3.hxx>
25 #include <dlgedmod.hxx>
26 #include <dlgedpage.hxx>
27 #include <dlgedview.hxx>
28 #include <dlgedobj.hxx>
29 #include <com/sun/star/awt/XVclWindowPeer.hpp>
30 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
31 #include <com/sun/star/accessibility/AccessibleRole.hpp>
32 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
33 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
34 #include <comphelper/accessiblecontexthelper.hxx>
35 #include <cppuhelper/supportsservice.hxx>
36 #include <tools/debug.hxx>
37 #include <unotools/accessiblerelationsethelper.hxx>
38 #include <toolkit/awt/vclxfont.hxx>
39 #include <toolkit/helper/convert.hxx>
40 #include <vcl/svapp.hxx>
41 #include <vcl/settings.hxx>
42 #include <i18nlangtag/languagetag.hxx>
47 using namespace ::com::sun::star
;
48 using namespace ::com::sun::star::uno
;
49 using namespace ::com::sun::star::lang
;
50 using namespace ::com::sun::star::accessibility
;
51 using namespace ::comphelper
;
53 AccessibleDialogWindow::ChildDescriptor::ChildDescriptor( DlgEdObj
* _pDlgEdObj
)
54 :pDlgEdObj( _pDlgEdObj
)
58 bool AccessibleDialogWindow::ChildDescriptor::operator==( const ChildDescriptor
& rDesc
)
61 if ( pDlgEdObj
== rDesc
.pDlgEdObj
)
68 bool AccessibleDialogWindow::ChildDescriptor::operator<( const ChildDescriptor
& rDesc
) const
71 if ( pDlgEdObj
&& rDesc
.pDlgEdObj
&& pDlgEdObj
->GetOrdNum() < rDesc
.pDlgEdObj
->GetOrdNum() )
80 AccessibleDialogWindow::AccessibleDialogWindow (basctl::DialogWindow
* pDialogWindow
)
81 : m_pDialogWindow(pDialogWindow
)
82 , m_pDlgEdModel(nullptr)
84 if ( !m_pDialogWindow
)
87 SdrPage
& rPage
= m_pDialogWindow
->GetPage();
89 for (const rtl::Reference
<SdrObject
>& pObj
: rPage
)
91 if (DlgEdObj
* pDlgEdObj
= dynamic_cast<DlgEdObj
*>(pObj
.get()))
93 ChildDescriptor
aDesc( pDlgEdObj
);
94 if ( IsChildVisible( aDesc
) )
95 m_aAccessibleChildren
.push_back( aDesc
);
99 m_pDialogWindow
->AddEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
101 StartListening(m_pDialogWindow
->GetEditor());
103 m_pDlgEdModel
= &m_pDialogWindow
->GetModel();
104 StartListening(*m_pDlgEdModel
);
108 AccessibleDialogWindow::~AccessibleDialogWindow()
110 if ( m_pDialogWindow
)
111 m_pDialogWindow
->RemoveEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
114 EndListening( *m_pDlgEdModel
);
118 void AccessibleDialogWindow::UpdateFocused()
120 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
122 if ( i
.mxAccessible
)
123 i
.mxAccessible
->SetFocused( i
.mxAccessible
->IsFocused() );
128 void AccessibleDialogWindow::UpdateSelected()
130 NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED
, Any(), Any() );
132 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
134 if ( i
.mxAccessible
)
135 i
.mxAccessible
->SetSelected( i
.mxAccessible
->IsSelected() );
140 void AccessibleDialogWindow::UpdateBounds()
142 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
144 if ( i
.mxAccessible
)
145 i
.mxAccessible
->SetBounds( i
.mxAccessible
->GetBounds() );
150 bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor
& rDesc
)
152 bool bVisible
= false;
154 if ( m_pDialogWindow
)
156 // first check, if the shape is in a visible layer
157 SdrLayerAdmin
& rLayerAdmin
= m_pDialogWindow
->GetModel().GetLayerAdmin();
158 DlgEdObj
* pDlgEdObj
= rDesc
.pDlgEdObj
;
161 SdrLayerID nLayerId
= pDlgEdObj
->GetLayer();
162 const SdrLayer
* pSdrLayer
= rLayerAdmin
.GetLayerPerID( nLayerId
);
165 const OUString
& aLayerName
= pSdrLayer
->GetName();
166 SdrView
& rView
= m_pDialogWindow
->GetView();
167 if (rView
.IsLayerVisible(aLayerName
))
169 // get the bounding box of the shape in logic units
170 tools::Rectangle aRect
= pDlgEdObj
->GetSnapRect();
172 // transform coordinates relative to the parent
173 MapMode aMap
= m_pDialogWindow
->GetMapMode();
174 Point aOrg
= aMap
.GetOrigin();
175 aRect
.Move( aOrg
.X(), aOrg
.Y() );
177 // convert logic units to pixel
178 aRect
= m_pDialogWindow
->LogicToPixel( aRect
, MapMode(MapUnit::Map100thMM
) );
180 // check, if the shape's bounding box intersects with the bounding box of its parent
181 tools::Rectangle
aParentRect( Point( 0, 0 ), m_pDialogWindow
->GetSizePixel() );
182 if ( aParentRect
.Overlaps( aRect
) )
193 void AccessibleDialogWindow::InsertChild( const ChildDescriptor
& rDesc
)
195 // check, if object is already in child list
196 AccessibleChildren::iterator aIter
= std::find( m_aAccessibleChildren
.begin(), m_aAccessibleChildren
.end(), rDesc
);
198 // if not found, insert in child list
199 if ( aIter
!= m_aAccessibleChildren
.end() )
202 // insert entry in child list
203 m_aAccessibleChildren
.push_back( rDesc
);
205 // get the accessible of the inserted child
206 Reference
< XAccessible
> xChild( getAccessibleChild( m_aAccessibleChildren
.size() - 1 ) );
211 // send accessible child event
214 Any aOldValue
, aNewValue
;
215 aNewValue
<<= xChild
;
216 NotifyAccessibleEvent( AccessibleEventId::CHILD
, aOldValue
, aNewValue
);
221 void AccessibleDialogWindow::RemoveChild( const ChildDescriptor
& rDesc
)
223 // find object in child list
224 AccessibleChildren::iterator aIter
= std::find( m_aAccessibleChildren
.begin(), m_aAccessibleChildren
.end(), rDesc
);
226 // if found, remove from child list
227 if ( aIter
== m_aAccessibleChildren
.end() )
230 // get the accessible of the removed child
231 rtl::Reference
< AccessibleDialogControlShape
> xChild( aIter
->mxAccessible
);
233 // remove entry from child list
234 m_aAccessibleChildren
.erase( aIter
);
236 // send accessible child event
239 Any aOldValue
, aNewValue
;
240 aOldValue
<<= uno::Reference
<XAccessible
>(xChild
);
241 NotifyAccessibleEvent( AccessibleEventId::CHILD
, aOldValue
, aNewValue
);
249 void AccessibleDialogWindow::UpdateChild( const ChildDescriptor
& rDesc
)
251 if ( IsChildVisible( rDesc
) )
253 // if the object is not in the child list, insert child
254 InsertChild( rDesc
);
258 // if the object is in the child list, remove child
259 RemoveChild( rDesc
);
264 void AccessibleDialogWindow::UpdateChildren()
266 if ( m_pDialogWindow
)
268 SdrPage
& rPage
= m_pDialogWindow
->GetPage();
269 for (const rtl::Reference
<SdrObject
>& pObj
: rPage
)
270 if (DlgEdObj
* pDlgEdObj
= dynamic_cast<DlgEdObj
*>(pObj
.get()))
271 UpdateChild( ChildDescriptor( pDlgEdObj
) );
276 void AccessibleDialogWindow::SortChildren()
279 std::sort( m_aAccessibleChildren
.begin(), m_aAccessibleChildren
.end() );
283 IMPL_LINK( AccessibleDialogWindow
, WindowEventListener
, VclWindowEvent
&, rEvent
, void )
285 DBG_ASSERT(rEvent
.GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!");
286 if (!rEvent
.GetWindow()->IsAccessibilityEventsSuppressed() || rEvent
.GetId() == VclEventId::ObjectDying
)
287 ProcessWindowEvent(rEvent
);
291 void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
293 Any aOldValue
, aNewValue
;
295 switch ( rVclWindowEvent
.GetId() )
297 case VclEventId::WindowEnabled
:
299 aNewValue
<<= AccessibleStateType::ENABLED
;
300 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
303 case VclEventId::WindowDisabled
:
305 aOldValue
<<= AccessibleStateType::ENABLED
;
306 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
309 case VclEventId::WindowActivate
:
311 aNewValue
<<= AccessibleStateType::ACTIVE
;
312 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
315 case VclEventId::WindowDeactivate
:
317 aOldValue
<<= AccessibleStateType::ACTIVE
;
318 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
321 case VclEventId::WindowGetFocus
:
323 aNewValue
<<= AccessibleStateType::FOCUSED
;
324 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
327 case VclEventId::WindowLoseFocus
:
329 aOldValue
<<= AccessibleStateType::FOCUSED
;
330 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
333 case VclEventId::WindowShow
:
335 aNewValue
<<= AccessibleStateType::SHOWING
;
336 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
339 case VclEventId::WindowHide
:
341 aOldValue
<<= AccessibleStateType::SHOWING
;
342 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
345 case VclEventId::WindowResize
:
347 NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED
, aOldValue
, aNewValue
);
352 case VclEventId::ObjectDying
:
354 if ( m_pDialogWindow
)
356 m_pDialogWindow
->RemoveEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
357 m_pDialogWindow
= nullptr;
360 EndListening( *m_pDlgEdModel
);
361 m_pDlgEdModel
= nullptr;
363 // dispose all children
364 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
366 if ( i
.mxAccessible
)
367 i
.mxAccessible
->dispose();
369 m_aAccessibleChildren
.clear();
381 void AccessibleDialogWindow::FillAccessibleStateSet( sal_Int64
& rStateSet
)
383 if ( !m_pDialogWindow
)
386 if ( m_pDialogWindow
->IsEnabled() )
387 rStateSet
|= AccessibleStateType::ENABLED
;
389 rStateSet
|= AccessibleStateType::FOCUSABLE
;
391 if ( m_pDialogWindow
->HasFocus() )
392 rStateSet
|= AccessibleStateType::FOCUSED
;
394 rStateSet
|= AccessibleStateType::VISIBLE
;
396 if ( m_pDialogWindow
->IsVisible() )
397 rStateSet
|= AccessibleStateType::SHOWING
;
399 rStateSet
|= AccessibleStateType::OPAQUE
;
401 rStateSet
|= AccessibleStateType::RESIZABLE
;
405 // OCommonAccessibleComponent
408 awt::Rectangle
AccessibleDialogWindow::implGetBounds()
410 awt::Rectangle aBounds
;
411 if ( m_pDialogWindow
)
412 aBounds
= AWTRectangle( tools::Rectangle( m_pDialogWindow
->GetPosPixel(), m_pDialogWindow
->GetSizePixel() ) );
421 void AccessibleDialogWindow::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
423 if (SdrHint
const* pSdrHint
= dynamic_cast<SdrHint
const*>(&rHint
))
425 switch ( pSdrHint
->GetKind() )
427 case SdrHintKind::ObjectInserted
:
429 if (DlgEdObj
const* pDlgEdObj
= dynamic_cast<DlgEdObj
const*>(pSdrHint
->GetObject()))
431 ChildDescriptor
aDesc(const_cast<DlgEdObj
*>(pDlgEdObj
));
432 if ( IsChildVisible( aDesc
) )
433 InsertChild( aDesc
);
437 case SdrHintKind::ObjectRemoved
:
439 if (DlgEdObj
const* pDlgEdObj
= dynamic_cast<DlgEdObj
const*>(pSdrHint
->GetObject()))
440 RemoveChild( ChildDescriptor(const_cast<DlgEdObj
*>(pDlgEdObj
)) );
446 else if (DlgEdHint
const* pDlgEdHint
= dynamic_cast<DlgEdHint
const*>(&rHint
))
448 switch (pDlgEdHint
->GetKind())
450 case DlgEdHint::WINDOWSCROLLED
:
456 case DlgEdHint::LAYERCHANGED
:
458 if (DlgEdObj
* pDlgEdObj
= pDlgEdHint
->GetObject())
459 UpdateChild( ChildDescriptor( pDlgEdObj
) );
462 case DlgEdHint::OBJORDERCHANGED
:
467 case DlgEdHint::SELECTIONCHANGED
:
482 void AccessibleDialogWindow::disposing()
484 OAccessibleExtendedComponentHelper::disposing();
486 if ( !m_pDialogWindow
)
489 m_pDialogWindow
->RemoveEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
490 m_pDialogWindow
= nullptr;
493 EndListening( *m_pDlgEdModel
);
494 m_pDlgEdModel
= nullptr;
496 // dispose all children
497 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
499 if ( i
.mxAccessible
)
500 i
.mxAccessible
->dispose();
502 m_aAccessibleChildren
.clear();
506 OUString
AccessibleDialogWindow::getImplementationName()
508 return "com.sun.star.comp.basctl.AccessibleWindow";
511 sal_Bool
AccessibleDialogWindow::supportsService( const OUString
& rServiceName
)
513 return cppu::supportsService(this, rServiceName
);
516 Sequence
< OUString
> AccessibleDialogWindow::getSupportedServiceNames()
518 return { "com.sun.star.awt.AccessibleWindow" };
522 Reference
< XAccessibleContext
> AccessibleDialogWindow::getAccessibleContext( )
527 // XAccessibleContext
528 sal_Int64
AccessibleDialogWindow::getAccessibleChildCount()
530 OExternalLockGuard
aGuard( this );
532 return m_aAccessibleChildren
.size();
536 Reference
< XAccessible
> AccessibleDialogWindow::getAccessibleChild( sal_Int64 i
)
538 OExternalLockGuard
aGuard( this );
540 if ( i
< 0 || i
>= getAccessibleChildCount() )
541 throw IndexOutOfBoundsException();
543 rtl::Reference
< AccessibleDialogControlShape
> xChild
= m_aAccessibleChildren
[i
].mxAccessible
;
546 if ( m_pDialogWindow
)
548 DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[i
].pDlgEdObj
;
551 xChild
= new AccessibleDialogControlShape( m_pDialogWindow
, pDlgEdObj
);
553 // insert into child list
554 m_aAccessibleChildren
[i
].mxAccessible
= xChild
;
563 Reference
< XAccessible
> AccessibleDialogWindow::getAccessibleParent( )
565 OExternalLockGuard
aGuard( this );
567 Reference
< XAccessible
> xParent
;
568 if ( m_pDialogWindow
)
570 vcl::Window
* pParent
= m_pDialogWindow
->GetAccessibleParentWindow();
572 xParent
= pParent
->GetAccessible();
579 sal_Int64
AccessibleDialogWindow::getAccessibleIndexInParent( )
581 OExternalLockGuard
aGuard( this );
583 sal_Int64 nIndexInParent
= -1;
584 if ( m_pDialogWindow
)
586 vcl::Window
* pParent
= m_pDialogWindow
->GetAccessibleParentWindow();
589 for ( sal_uInt16 i
= 0, nCount
= pParent
->GetAccessibleChildWindowCount(); i
< nCount
; ++i
)
591 vcl::Window
* pChild
= pParent
->GetAccessibleChildWindow( i
);
592 if ( pChild
== static_cast< vcl::Window
* >( m_pDialogWindow
) )
601 return nIndexInParent
;
605 sal_Int16
AccessibleDialogWindow::getAccessibleRole( )
607 OExternalLockGuard
aGuard( this );
609 return AccessibleRole::PANEL
;
613 OUString
AccessibleDialogWindow::getAccessibleDescription( )
615 OExternalLockGuard
aGuard( this );
617 OUString sDescription
;
618 if ( m_pDialogWindow
)
619 sDescription
= m_pDialogWindow
->GetAccessibleDescription();
625 OUString
AccessibleDialogWindow::getAccessibleName( )
627 OExternalLockGuard
aGuard( this );
630 if ( m_pDialogWindow
)
631 sName
= m_pDialogWindow
->GetAccessibleName();
637 Reference
< XAccessibleRelationSet
> AccessibleDialogWindow::getAccessibleRelationSet( )
639 OExternalLockGuard
aGuard( this );
641 return new utl::AccessibleRelationSetHelper
;
645 sal_Int64
AccessibleDialogWindow::getAccessibleStateSet( )
647 OExternalLockGuard
aGuard( this );
649 sal_Int64 nStateSet
= 0;
651 if ( !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
)
653 FillAccessibleStateSet( nStateSet
);
657 nStateSet
|= AccessibleStateType::DEFUNC
;
664 Locale
AccessibleDialogWindow::getLocale( )
666 OExternalLockGuard
aGuard( this );
668 return Application::GetSettings().GetLanguageTag().getLocale();
672 // XAccessibleComponent
675 Reference
< XAccessible
> AccessibleDialogWindow::getAccessibleAtPoint( const awt::Point
& rPoint
)
677 OExternalLockGuard
aGuard( this );
679 Reference
< XAccessible
> xChild
;
680 for ( size_t i
= 0; i
< m_aAccessibleChildren
.size(); ++i
)
682 Reference
< XAccessible
> xAcc
= getAccessibleChild( i
);
685 Reference
< XAccessibleComponent
> xComp( xAcc
->getAccessibleContext(), UNO_QUERY
);
688 tools::Rectangle aRect
= VCLRectangle( xComp
->getBounds() );
689 Point aPos
= VCLPoint( rPoint
);
690 if ( aRect
.Contains( aPos
) )
703 void AccessibleDialogWindow::grabFocus( )
705 OExternalLockGuard
aGuard( this );
707 if ( m_pDialogWindow
)
708 m_pDialogWindow
->GrabFocus();
712 sal_Int32
AccessibleDialogWindow::getForeground( )
714 OExternalLockGuard
aGuard( this );
717 if ( m_pDialogWindow
)
719 if ( m_pDialogWindow
->IsControlForeground() )
720 nColor
= m_pDialogWindow
->GetControlForeground();
724 if ( m_pDialogWindow
->IsControlFont() )
725 aFont
= m_pDialogWindow
->GetControlFont();
727 aFont
= m_pDialogWindow
->GetFont();
728 nColor
= aFont
.GetColor();
732 return sal_Int32(nColor
);
736 sal_Int32
AccessibleDialogWindow::getBackground( )
738 OExternalLockGuard
aGuard( this );
741 if ( m_pDialogWindow
)
743 if ( m_pDialogWindow
->IsControlBackground() )
744 nColor
= m_pDialogWindow
->GetControlBackground();
746 nColor
= m_pDialogWindow
->GetBackground().GetColor();
749 return sal_Int32(nColor
);
753 // XAccessibleExtendedComponent
756 Reference
< awt::XFont
> AccessibleDialogWindow::getFont( )
758 OExternalLockGuard
aGuard( this );
760 Reference
< awt::XFont
> xFont
;
761 if ( m_pDialogWindow
)
763 Reference
< awt::XDevice
> xDev( m_pDialogWindow
->GetComponentInterface(), UNO_QUERY
);
767 if ( m_pDialogWindow
->IsControlFont() )
768 aFont
= m_pDialogWindow
->GetControlFont();
770 aFont
= m_pDialogWindow
->GetFont();
771 rtl::Reference
<VCLXFont
> pVCLXFont
= new VCLXFont
;
772 pVCLXFont
->Init( *xDev
, aFont
);
781 OUString
AccessibleDialogWindow::getTitledBorderText( )
783 OExternalLockGuard
aGuard( this );
789 OUString
AccessibleDialogWindow::getToolTipText( )
791 OExternalLockGuard
aGuard( this );
794 if ( m_pDialogWindow
)
795 sText
= m_pDialogWindow
->GetQuickHelpText();
801 // XAccessibleSelection
804 void AccessibleDialogWindow::selectAccessibleChild( sal_Int64 nChildIndex
)
806 OExternalLockGuard
aGuard( this );
808 if ( nChildIndex
< 0 || nChildIndex
>= getAccessibleChildCount() )
809 throw IndexOutOfBoundsException();
811 if ( m_pDialogWindow
)
813 if (DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[nChildIndex
].pDlgEdObj
)
815 SdrView
& rView
= m_pDialogWindow
->GetView();
816 if (SdrPageView
* pPgView
= rView
.GetSdrPageView())
817 rView
.MarkObj(pDlgEdObj
, pPgView
);
823 sal_Bool
AccessibleDialogWindow::isAccessibleChildSelected( sal_Int64 nChildIndex
)
825 OExternalLockGuard
aGuard( this );
827 if ( nChildIndex
< 0 || nChildIndex
>= getAccessibleChildCount() )
828 throw IndexOutOfBoundsException();
831 if (DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[nChildIndex
].pDlgEdObj
)
832 return m_pDialogWindow
->GetView().IsObjMarked(pDlgEdObj
);
837 void AccessibleDialogWindow::clearAccessibleSelection()
839 OExternalLockGuard
aGuard( this );
841 if ( m_pDialogWindow
)
842 m_pDialogWindow
->GetView().UnmarkAll();
846 void AccessibleDialogWindow::selectAllAccessibleChildren( )
848 OExternalLockGuard
aGuard( this );
850 if ( m_pDialogWindow
)
851 m_pDialogWindow
->GetView().MarkAll();
855 sal_Int64
AccessibleDialogWindow::getSelectedAccessibleChildCount( )
857 OExternalLockGuard
aGuard( this );
861 for ( sal_Int64 i
= 0, nCount
= getAccessibleChildCount(); i
< nCount
; ++i
)
863 if ( isAccessibleChildSelected( i
) )
871 Reference
< XAccessible
> AccessibleDialogWindow::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex
)
873 OExternalLockGuard
aGuard( this );
875 if ( nSelectedChildIndex
< 0 || nSelectedChildIndex
>= getSelectedAccessibleChildCount() )
876 throw IndexOutOfBoundsException();
878 Reference
< XAccessible
> xChild
;
880 for ( sal_Int64 i
= 0, j
= 0, nCount
= getAccessibleChildCount(); i
< nCount
; ++i
)
882 if ( isAccessibleChildSelected( i
) && ( j
++ == nSelectedChildIndex
) )
884 xChild
= getAccessibleChild( i
);
893 void AccessibleDialogWindow::deselectAccessibleChild( sal_Int64 nChildIndex
)
895 OExternalLockGuard
aGuard( this );
897 if ( nChildIndex
< 0 || nChildIndex
>= getAccessibleChildCount() )
898 throw IndexOutOfBoundsException();
900 if ( m_pDialogWindow
)
902 if (DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[nChildIndex
].pDlgEdObj
)
904 SdrView
& rView
= m_pDialogWindow
->GetView();
905 SdrPageView
* pPgView
= rView
.GetSdrPageView();
907 rView
.MarkObj( pDlgEdObj
, pPgView
, true );
913 } // namespace basctl
915 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */