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();
88 const size_t nCount
= rPage
.GetObjCount();
90 for ( size_t i
= 0; i
< nCount
; ++i
)
92 if (DlgEdObj
* pDlgEdObj
= dynamic_cast<DlgEdObj
*>(rPage
.GetObj(i
)))
94 ChildDescriptor
aDesc( pDlgEdObj
);
95 if ( IsChildVisible( aDesc
) )
96 m_aAccessibleChildren
.push_back( aDesc
);
100 m_pDialogWindow
->AddEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
102 StartListening(m_pDialogWindow
->GetEditor());
104 m_pDlgEdModel
= &m_pDialogWindow
->GetModel();
105 StartListening(*m_pDlgEdModel
);
109 AccessibleDialogWindow::~AccessibleDialogWindow()
111 if ( m_pDialogWindow
)
112 m_pDialogWindow
->RemoveEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
115 EndListening( *m_pDlgEdModel
);
119 void AccessibleDialogWindow::UpdateFocused()
121 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
123 Reference
< XAccessible
> xChild( i
.rxAccessible
);
126 AccessibleDialogControlShape
* pShape
= static_cast< AccessibleDialogControlShape
* >( xChild
.get() );
128 pShape
->SetFocused( pShape
->IsFocused() );
134 void AccessibleDialogWindow::UpdateSelected()
136 NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED
, Any(), Any() );
138 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
140 Reference
< XAccessible
> xChild( i
.rxAccessible
);
143 AccessibleDialogControlShape
* pShape
= static_cast< AccessibleDialogControlShape
* >( xChild
.get() );
145 pShape
->SetSelected( pShape
->IsSelected() );
151 void AccessibleDialogWindow::UpdateBounds()
153 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
155 Reference
< XAccessible
> xChild( i
.rxAccessible
);
158 AccessibleDialogControlShape
* pShape
= static_cast< AccessibleDialogControlShape
* >( xChild
.get() );
160 pShape
->SetBounds( pShape
->GetBounds() );
166 bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor
& rDesc
)
168 bool bVisible
= false;
170 if ( m_pDialogWindow
)
172 // first check, if the shape is in a visible layer
173 SdrLayerAdmin
& rLayerAdmin
= m_pDialogWindow
->GetModel().GetLayerAdmin();
174 DlgEdObj
* pDlgEdObj
= rDesc
.pDlgEdObj
;
177 SdrLayerID nLayerId
= pDlgEdObj
->GetLayer();
178 const SdrLayer
* pSdrLayer
= rLayerAdmin
.GetLayerPerID( nLayerId
);
181 const OUString
& aLayerName
= pSdrLayer
->GetName();
182 SdrView
& rView
= m_pDialogWindow
->GetView();
183 if (rView
.IsLayerVisible(aLayerName
))
185 // get the bounding box of the shape in logic units
186 tools::Rectangle aRect
= pDlgEdObj
->GetSnapRect();
188 // transform coordinates relative to the parent
189 MapMode aMap
= m_pDialogWindow
->GetMapMode();
190 Point aOrg
= aMap
.GetOrigin();
191 aRect
.Move( aOrg
.X(), aOrg
.Y() );
193 // convert logic units to pixel
194 aRect
= m_pDialogWindow
->LogicToPixel( aRect
, MapMode(MapUnit::Map100thMM
) );
196 // check, if the shape's bounding box intersects with the bounding box of its parent
197 tools::Rectangle
aParentRect( Point( 0, 0 ), m_pDialogWindow
->GetSizePixel() );
198 if ( aParentRect
.Overlaps( aRect
) )
209 void AccessibleDialogWindow::InsertChild( const ChildDescriptor
& rDesc
)
211 // check, if object is already in child list
212 AccessibleChildren::iterator aIter
= std::find( m_aAccessibleChildren
.begin(), m_aAccessibleChildren
.end(), rDesc
);
214 // if not found, insert in child list
215 if ( aIter
!= m_aAccessibleChildren
.end() )
218 // insert entry in child list
219 m_aAccessibleChildren
.push_back( rDesc
);
221 // get the accessible of the inserted child
222 Reference
< XAccessible
> xChild( getAccessibleChild( m_aAccessibleChildren
.size() - 1 ) );
227 // send accessible child event
230 Any aOldValue
, aNewValue
;
231 aNewValue
<<= xChild
;
232 NotifyAccessibleEvent( AccessibleEventId::CHILD
, aOldValue
, aNewValue
);
237 void AccessibleDialogWindow::RemoveChild( const ChildDescriptor
& rDesc
)
239 // find object in child list
240 AccessibleChildren::iterator aIter
= std::find( m_aAccessibleChildren
.begin(), m_aAccessibleChildren
.end(), rDesc
);
242 // if found, remove from child list
243 if ( aIter
== m_aAccessibleChildren
.end() )
246 // get the accessible of the removed child
247 Reference
< XAccessible
> xChild( aIter
->rxAccessible
);
249 // remove entry from child list
250 m_aAccessibleChildren
.erase( aIter
);
252 // send accessible child event
255 Any aOldValue
, aNewValue
;
256 aOldValue
<<= xChild
;
257 NotifyAccessibleEvent( AccessibleEventId::CHILD
, aOldValue
, aNewValue
);
259 Reference
< XComponent
> xComponent( xChild
, UNO_QUERY
);
260 if ( xComponent
.is() )
261 xComponent
->dispose();
266 void AccessibleDialogWindow::UpdateChild( const ChildDescriptor
& rDesc
)
268 if ( IsChildVisible( rDesc
) )
270 // if the object is not in the child list, insert child
271 InsertChild( rDesc
);
275 // if the object is in the child list, remove child
276 RemoveChild( rDesc
);
281 void AccessibleDialogWindow::UpdateChildren()
283 if ( m_pDialogWindow
)
285 SdrPage
& rPage
= m_pDialogWindow
->GetPage();
286 for ( size_t i
= 0, nCount
= rPage
.GetObjCount(); i
< nCount
; ++i
)
287 if (DlgEdObj
* pDlgEdObj
= dynamic_cast<DlgEdObj
*>(rPage
.GetObj(i
)))
288 UpdateChild( ChildDescriptor( pDlgEdObj
) );
293 void AccessibleDialogWindow::SortChildren()
296 std::sort( m_aAccessibleChildren
.begin(), m_aAccessibleChildren
.end() );
300 IMPL_LINK( AccessibleDialogWindow
, WindowEventListener
, VclWindowEvent
&, rEvent
, void )
302 DBG_ASSERT(rEvent
.GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!");
303 if (!rEvent
.GetWindow()->IsAccessibilityEventsSuppressed() || rEvent
.GetId() == VclEventId::ObjectDying
)
304 ProcessWindowEvent(rEvent
);
308 void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
310 Any aOldValue
, aNewValue
;
312 switch ( rVclWindowEvent
.GetId() )
314 case VclEventId::WindowEnabled
:
316 aNewValue
<<= AccessibleStateType::ENABLED
;
317 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
320 case VclEventId::WindowDisabled
:
322 aOldValue
<<= AccessibleStateType::ENABLED
;
323 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
326 case VclEventId::WindowActivate
:
328 aNewValue
<<= AccessibleStateType::ACTIVE
;
329 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
332 case VclEventId::WindowDeactivate
:
334 aOldValue
<<= AccessibleStateType::ACTIVE
;
335 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
338 case VclEventId::WindowGetFocus
:
340 aNewValue
<<= AccessibleStateType::FOCUSED
;
341 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
344 case VclEventId::WindowLoseFocus
:
346 aOldValue
<<= AccessibleStateType::FOCUSED
;
347 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
350 case VclEventId::WindowShow
:
352 aNewValue
<<= AccessibleStateType::SHOWING
;
353 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
356 case VclEventId::WindowHide
:
358 aOldValue
<<= AccessibleStateType::SHOWING
;
359 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED
, aOldValue
, aNewValue
);
362 case VclEventId::WindowResize
:
364 NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED
, aOldValue
, aNewValue
);
369 case VclEventId::ObjectDying
:
371 if ( m_pDialogWindow
)
373 m_pDialogWindow
->RemoveEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
374 m_pDialogWindow
= nullptr;
377 EndListening( *m_pDlgEdModel
);
378 m_pDlgEdModel
= nullptr;
380 // dispose all children
381 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
383 Reference
< XComponent
> xComponent( i
.rxAccessible
, UNO_QUERY
);
384 if ( xComponent
.is() )
385 xComponent
->dispose();
387 m_aAccessibleChildren
.clear();
399 void AccessibleDialogWindow::FillAccessibleStateSet( sal_Int64
& rStateSet
)
401 if ( !m_pDialogWindow
)
404 if ( m_pDialogWindow
->IsEnabled() )
405 rStateSet
|= AccessibleStateType::ENABLED
;
407 rStateSet
|= AccessibleStateType::FOCUSABLE
;
409 if ( m_pDialogWindow
->HasFocus() )
410 rStateSet
|= AccessibleStateType::FOCUSED
;
412 rStateSet
|= AccessibleStateType::VISIBLE
;
414 if ( m_pDialogWindow
->IsVisible() )
415 rStateSet
|= AccessibleStateType::SHOWING
;
417 rStateSet
|= AccessibleStateType::OPAQUE
;
419 rStateSet
|= AccessibleStateType::RESIZABLE
;
423 // OCommonAccessibleComponent
426 awt::Rectangle
AccessibleDialogWindow::implGetBounds()
428 awt::Rectangle aBounds
;
429 if ( m_pDialogWindow
)
430 aBounds
= AWTRectangle( tools::Rectangle( m_pDialogWindow
->GetPosPixel(), m_pDialogWindow
->GetSizePixel() ) );
439 void AccessibleDialogWindow::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
441 if (SdrHint
const* pSdrHint
= dynamic_cast<SdrHint
const*>(&rHint
))
443 switch ( pSdrHint
->GetKind() )
445 case SdrHintKind::ObjectInserted
:
447 if (DlgEdObj
const* pDlgEdObj
= dynamic_cast<DlgEdObj
const*>(pSdrHint
->GetObject()))
449 ChildDescriptor
aDesc(const_cast<DlgEdObj
*>(pDlgEdObj
));
450 if ( IsChildVisible( aDesc
) )
451 InsertChild( aDesc
);
455 case SdrHintKind::ObjectRemoved
:
457 if (DlgEdObj
const* pDlgEdObj
= dynamic_cast<DlgEdObj
const*>(pSdrHint
->GetObject()))
458 RemoveChild( ChildDescriptor(const_cast<DlgEdObj
*>(pDlgEdObj
)) );
464 else if (DlgEdHint
const* pDlgEdHint
= dynamic_cast<DlgEdHint
const*>(&rHint
))
466 switch (pDlgEdHint
->GetKind())
468 case DlgEdHint::WINDOWSCROLLED
:
474 case DlgEdHint::LAYERCHANGED
:
476 if (DlgEdObj
* pDlgEdObj
= pDlgEdHint
->GetObject())
477 UpdateChild( ChildDescriptor( pDlgEdObj
) );
480 case DlgEdHint::OBJORDERCHANGED
:
485 case DlgEdHint::SELECTIONCHANGED
:
500 void AccessibleDialogWindow::disposing()
502 OAccessibleExtendedComponentHelper::disposing();
504 if ( !m_pDialogWindow
)
507 m_pDialogWindow
->RemoveEventListener( LINK( this, AccessibleDialogWindow
, WindowEventListener
) );
508 m_pDialogWindow
= nullptr;
511 EndListening( *m_pDlgEdModel
);
512 m_pDlgEdModel
= nullptr;
514 // dispose all children
515 for (const ChildDescriptor
& i
: m_aAccessibleChildren
)
517 Reference
< XComponent
> xComponent( i
.rxAccessible
, UNO_QUERY
);
518 if ( xComponent
.is() )
519 xComponent
->dispose();
521 m_aAccessibleChildren
.clear();
525 OUString
AccessibleDialogWindow::getImplementationName()
527 return "com.sun.star.comp.basctl.AccessibleWindow";
530 sal_Bool
AccessibleDialogWindow::supportsService( const OUString
& rServiceName
)
532 return cppu::supportsService(this, rServiceName
);
535 Sequence
< OUString
> AccessibleDialogWindow::getSupportedServiceNames()
537 return { "com.sun.star.awt.AccessibleWindow" };
541 Reference
< XAccessibleContext
> AccessibleDialogWindow::getAccessibleContext( )
546 // XAccessibleContext
547 sal_Int64
AccessibleDialogWindow::getAccessibleChildCount()
549 OExternalLockGuard
aGuard( this );
551 return m_aAccessibleChildren
.size();
555 Reference
< XAccessible
> AccessibleDialogWindow::getAccessibleChild( sal_Int64 i
)
557 OExternalLockGuard
aGuard( this );
559 if ( i
< 0 || i
>= getAccessibleChildCount() )
560 throw IndexOutOfBoundsException();
562 Reference
< XAccessible
> xChild
= m_aAccessibleChildren
[i
].rxAccessible
;
565 if ( m_pDialogWindow
)
567 DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[i
].pDlgEdObj
;
570 xChild
= new AccessibleDialogControlShape( m_pDialogWindow
, pDlgEdObj
);
572 // insert into child list
573 m_aAccessibleChildren
[i
].rxAccessible
= xChild
;
582 Reference
< XAccessible
> AccessibleDialogWindow::getAccessibleParent( )
584 OExternalLockGuard
aGuard( this );
586 Reference
< XAccessible
> xParent
;
587 if ( m_pDialogWindow
)
589 vcl::Window
* pParent
= m_pDialogWindow
->GetAccessibleParentWindow();
591 xParent
= pParent
->GetAccessible();
598 sal_Int64
AccessibleDialogWindow::getAccessibleIndexInParent( )
600 OExternalLockGuard
aGuard( this );
602 sal_Int64 nIndexInParent
= -1;
603 if ( m_pDialogWindow
)
605 vcl::Window
* pParent
= m_pDialogWindow
->GetAccessibleParentWindow();
608 for ( sal_uInt16 i
= 0, nCount
= pParent
->GetAccessibleChildWindowCount(); i
< nCount
; ++i
)
610 vcl::Window
* pChild
= pParent
->GetAccessibleChildWindow( i
);
611 if ( pChild
== static_cast< vcl::Window
* >( m_pDialogWindow
) )
620 return nIndexInParent
;
624 sal_Int16
AccessibleDialogWindow::getAccessibleRole( )
626 OExternalLockGuard
aGuard( this );
628 return AccessibleRole::PANEL
;
632 OUString
AccessibleDialogWindow::getAccessibleDescription( )
634 OExternalLockGuard
aGuard( this );
636 OUString sDescription
;
637 if ( m_pDialogWindow
)
638 sDescription
= m_pDialogWindow
->GetAccessibleDescription();
644 OUString
AccessibleDialogWindow::getAccessibleName( )
646 OExternalLockGuard
aGuard( this );
649 if ( m_pDialogWindow
)
650 sName
= m_pDialogWindow
->GetAccessibleName();
656 Reference
< XAccessibleRelationSet
> AccessibleDialogWindow::getAccessibleRelationSet( )
658 OExternalLockGuard
aGuard( this );
660 return new utl::AccessibleRelationSetHelper
;
664 sal_Int64
AccessibleDialogWindow::getAccessibleStateSet( )
666 OExternalLockGuard
aGuard( this );
668 sal_Int64 nStateSet
= 0;
670 if ( !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
)
672 FillAccessibleStateSet( nStateSet
);
676 nStateSet
|= AccessibleStateType::DEFUNC
;
683 Locale
AccessibleDialogWindow::getLocale( )
685 OExternalLockGuard
aGuard( this );
687 return Application::GetSettings().GetLanguageTag().getLocale();
691 // XAccessibleComponent
694 Reference
< XAccessible
> AccessibleDialogWindow::getAccessibleAtPoint( const awt::Point
& rPoint
)
696 OExternalLockGuard
aGuard( this );
698 Reference
< XAccessible
> xChild
;
699 for ( size_t i
= 0; i
< m_aAccessibleChildren
.size(); ++i
)
701 Reference
< XAccessible
> xAcc
= getAccessibleChild( i
);
704 Reference
< XAccessibleComponent
> xComp( xAcc
->getAccessibleContext(), UNO_QUERY
);
707 tools::Rectangle aRect
= VCLRectangle( xComp
->getBounds() );
708 Point aPos
= VCLPoint( rPoint
);
709 if ( aRect
.Contains( aPos
) )
722 void AccessibleDialogWindow::grabFocus( )
724 OExternalLockGuard
aGuard( this );
726 if ( m_pDialogWindow
)
727 m_pDialogWindow
->GrabFocus();
731 sal_Int32
AccessibleDialogWindow::getForeground( )
733 OExternalLockGuard
aGuard( this );
736 if ( m_pDialogWindow
)
738 if ( m_pDialogWindow
->IsControlForeground() )
739 nColor
= m_pDialogWindow
->GetControlForeground();
743 if ( m_pDialogWindow
->IsControlFont() )
744 aFont
= m_pDialogWindow
->GetControlFont();
746 aFont
= m_pDialogWindow
->GetFont();
747 nColor
= aFont
.GetColor();
751 return sal_Int32(nColor
);
755 sal_Int32
AccessibleDialogWindow::getBackground( )
757 OExternalLockGuard
aGuard( this );
760 if ( m_pDialogWindow
)
762 if ( m_pDialogWindow
->IsControlBackground() )
763 nColor
= m_pDialogWindow
->GetControlBackground();
765 nColor
= m_pDialogWindow
->GetBackground().GetColor();
768 return sal_Int32(nColor
);
772 // XAccessibleExtendedComponent
775 Reference
< awt::XFont
> AccessibleDialogWindow::getFont( )
777 OExternalLockGuard
aGuard( this );
779 Reference
< awt::XFont
> xFont
;
780 if ( m_pDialogWindow
)
782 Reference
< awt::XDevice
> xDev( m_pDialogWindow
->GetComponentInterface(), UNO_QUERY
);
786 if ( m_pDialogWindow
->IsControlFont() )
787 aFont
= m_pDialogWindow
->GetControlFont();
789 aFont
= m_pDialogWindow
->GetFont();
790 rtl::Reference
<VCLXFont
> pVCLXFont
= new VCLXFont
;
791 pVCLXFont
->Init( *xDev
, aFont
);
800 OUString
AccessibleDialogWindow::getTitledBorderText( )
802 OExternalLockGuard
aGuard( this );
808 OUString
AccessibleDialogWindow::getToolTipText( )
810 OExternalLockGuard
aGuard( this );
813 if ( m_pDialogWindow
)
814 sText
= m_pDialogWindow
->GetQuickHelpText();
820 // XAccessibleSelection
823 void AccessibleDialogWindow::selectAccessibleChild( sal_Int64 nChildIndex
)
825 OExternalLockGuard
aGuard( this );
827 if ( nChildIndex
< 0 || nChildIndex
>= getAccessibleChildCount() )
828 throw IndexOutOfBoundsException();
830 if ( m_pDialogWindow
)
832 if (DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[nChildIndex
].pDlgEdObj
)
834 SdrView
& rView
= m_pDialogWindow
->GetView();
835 if (SdrPageView
* pPgView
= rView
.GetSdrPageView())
836 rView
.MarkObj(pDlgEdObj
, pPgView
);
842 sal_Bool
AccessibleDialogWindow::isAccessibleChildSelected( sal_Int64 nChildIndex
)
844 OExternalLockGuard
aGuard( this );
846 if ( nChildIndex
< 0 || nChildIndex
>= getAccessibleChildCount() )
847 throw IndexOutOfBoundsException();
850 if (DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[nChildIndex
].pDlgEdObj
)
851 return m_pDialogWindow
->GetView().IsObjMarked(pDlgEdObj
);
856 void AccessibleDialogWindow::clearAccessibleSelection()
858 OExternalLockGuard
aGuard( this );
860 if ( m_pDialogWindow
)
861 m_pDialogWindow
->GetView().UnmarkAll();
865 void AccessibleDialogWindow::selectAllAccessibleChildren( )
867 OExternalLockGuard
aGuard( this );
869 if ( m_pDialogWindow
)
870 m_pDialogWindow
->GetView().MarkAll();
874 sal_Int64
AccessibleDialogWindow::getSelectedAccessibleChildCount( )
876 OExternalLockGuard
aGuard( this );
880 for ( sal_Int64 i
= 0, nCount
= getAccessibleChildCount(); i
< nCount
; ++i
)
882 if ( isAccessibleChildSelected( i
) )
890 Reference
< XAccessible
> AccessibleDialogWindow::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex
)
892 OExternalLockGuard
aGuard( this );
894 if ( nSelectedChildIndex
< 0 || nSelectedChildIndex
>= getSelectedAccessibleChildCount() )
895 throw IndexOutOfBoundsException();
897 Reference
< XAccessible
> xChild
;
899 for ( sal_Int64 i
= 0, j
= 0, nCount
= getAccessibleChildCount(); i
< nCount
; ++i
)
901 if ( isAccessibleChildSelected( i
) && ( j
++ == nSelectedChildIndex
) )
903 xChild
= getAccessibleChild( i
);
912 void AccessibleDialogWindow::deselectAccessibleChild( sal_Int64 nChildIndex
)
914 OExternalLockGuard
aGuard( this );
916 if ( nChildIndex
< 0 || nChildIndex
>= getAccessibleChildCount() )
917 throw IndexOutOfBoundsException();
919 if ( m_pDialogWindow
)
921 if (DlgEdObj
* pDlgEdObj
= m_aAccessibleChildren
[nChildIndex
].pDlgEdObj
)
923 SdrView
& rView
= m_pDialogWindow
->GetView();
924 SdrPageView
* pPgView
= rView
.GetSdrPageView();
926 rView
.MarkObj( pDlgEdObj
, pPgView
, true );
932 } // namespace basctl
934 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */