1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_basctl.hxx"
30*cdf0e10cSrcweir #include <accessibledialogwindow.hxx>
31*cdf0e10cSrcweir #include <accessibledialogcontrolshape.hxx>
32*cdf0e10cSrcweir #include <baside3.hxx>
33*cdf0e10cSrcweir #include <dlged.hxx>
34*cdf0e10cSrcweir #include <dlgedmod.hxx>
35*cdf0e10cSrcweir #include <dlgedpage.hxx>
36*cdf0e10cSrcweir #include <dlgedview.hxx>
37*cdf0e10cSrcweir #include <dlgedobj.hxx>
38*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
41*cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
42*cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx>
43*cdf0e10cSrcweir #include <toolkit/awt/vclxfont.hxx>
44*cdf0e10cSrcweir #include <toolkit/helper/externallock.hxx>
45*cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
46*cdf0e10cSrcweir #include <vcl/svapp.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <vector>
49*cdf0e10cSrcweir #include <algorithm>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir using namespace ::com::sun::star;
53*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
54*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
55*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
56*cdf0e10cSrcweir using namespace ::comphelper;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir DBG_NAME( AccessibleDialogWindow )
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir // -----------------------------------------------------------------------------
62*cdf0e10cSrcweir //	class ChildDescriptor
63*cdf0e10cSrcweir // -----------------------------------------------------------------------------
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir AccessibleDialogWindow::ChildDescriptor::ChildDescriptor( DlgEdObj* _pDlgEdObj )
66*cdf0e10cSrcweir 	:pDlgEdObj( _pDlgEdObj )
67*cdf0e10cSrcweir 	,rxAccessible( 0 )
68*cdf0e10cSrcweir {
69*cdf0e10cSrcweir }
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir // -----------------------------------------------------------------------------
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir AccessibleDialogWindow::ChildDescriptor::~ChildDescriptor()
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir }
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir // -----------------------------------------------------------------------------
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir AccessibleDialogWindow::ChildDescriptor::ChildDescriptor( const ChildDescriptor& rDesc )
80*cdf0e10cSrcweir 	:pDlgEdObj( rDesc.pDlgEdObj )
81*cdf0e10cSrcweir 	,rxAccessible( rDesc.rxAccessible )
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir // -----------------------------------------------------------------------------
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir AccessibleDialogWindow::ChildDescriptor& AccessibleDialogWindow::ChildDescriptor::operator=( const ChildDescriptor& rDesc )
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir 	pDlgEdObj = rDesc.pDlgEdObj;
90*cdf0e10cSrcweir 	rxAccessible = rDesc.rxAccessible;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 	return *this;
93*cdf0e10cSrcweir }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir // -----------------------------------------------------------------------------
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir bool AccessibleDialogWindow::ChildDescriptor::operator==( const ChildDescriptor& rDesc )
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir 	bool bRet = false;
100*cdf0e10cSrcweir 	if ( pDlgEdObj == rDesc.pDlgEdObj )
101*cdf0e10cSrcweir 		bRet = true;
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir 	return bRet;
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir // -----------------------------------------------------------------------------
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir bool AccessibleDialogWindow::ChildDescriptor::operator<( const ChildDescriptor& rDesc ) const
109*cdf0e10cSrcweir {
110*cdf0e10cSrcweir 	bool bRet = false;
111*cdf0e10cSrcweir 	if ( pDlgEdObj && rDesc.pDlgEdObj && pDlgEdObj->GetOrdNum() < rDesc.pDlgEdObj->GetOrdNum() )
112*cdf0e10cSrcweir 		bRet = true;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	return bRet;
115*cdf0e10cSrcweir }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir // -----------------------------------------------------------------------------
118*cdf0e10cSrcweir //	class AccessibleDialogWindow
119*cdf0e10cSrcweir // -----------------------------------------------------------------------------
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir AccessibleDialogWindow::AccessibleDialogWindow( DialogWindow* pDialogWindow )
122*cdf0e10cSrcweir 	:AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
123*cdf0e10cSrcweir 	,m_pDialogWindow( pDialogWindow )
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	DBG_CTOR( AccessibleDialogWindow, NULL );
126*cdf0e10cSrcweir 	m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	if ( m_pDialogWindow )
129*cdf0e10cSrcweir 	{
130*cdf0e10cSrcweir 		SdrPage* pSdrPage = m_pDialogWindow->GetPage();
131*cdf0e10cSrcweir 		if ( pSdrPage )
132*cdf0e10cSrcweir 		{
133*cdf0e10cSrcweir 			sal_uLong nCount = pSdrPage->GetObjCount();
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 			for ( sal_uLong i = 0; i < nCount; ++i )
136*cdf0e10cSrcweir 			{
137*cdf0e10cSrcweir 				SdrObject* pObj = pSdrPage->GetObj( i );
138*cdf0e10cSrcweir 				DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj );
139*cdf0e10cSrcweir 				if ( pDlgEdObj )
140*cdf0e10cSrcweir 				{
141*cdf0e10cSrcweir 					ChildDescriptor aDesc( pDlgEdObj );
142*cdf0e10cSrcweir 					if ( IsChildVisible( aDesc ) )
143*cdf0e10cSrcweir 						m_aAccessibleChildren.push_back( aDesc );
144*cdf0e10cSrcweir 				}
145*cdf0e10cSrcweir 			}
146*cdf0e10cSrcweir 		}
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 		m_pDialogWindow->AddEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 		m_pDlgEditor = m_pDialogWindow->GetEditor();
151*cdf0e10cSrcweir 		if ( m_pDlgEditor )
152*cdf0e10cSrcweir 			StartListening( *m_pDlgEditor );
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 		m_pDlgEdModel = m_pDialogWindow->GetModel();
155*cdf0e10cSrcweir 		if ( m_pDlgEdModel )
156*cdf0e10cSrcweir 			StartListening( *m_pDlgEdModel );
157*cdf0e10cSrcweir 	}
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir // -----------------------------------------------------------------------------
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir AccessibleDialogWindow::~AccessibleDialogWindow()
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir 	DBG_DTOR( AccessibleDialogWindow, NULL );
165*cdf0e10cSrcweir 	if ( m_pDialogWindow )
166*cdf0e10cSrcweir 		m_pDialogWindow->RemoveEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) );
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	if ( m_pDlgEditor )
169*cdf0e10cSrcweir 		EndListening( *m_pDlgEditor );
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	if ( m_pDlgEdModel )
172*cdf0e10cSrcweir 		EndListening( *m_pDlgEdModel );
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 	delete m_pExternalLock;
175*cdf0e10cSrcweir 	m_pExternalLock = NULL;
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir // -----------------------------------------------------------------------------
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir void AccessibleDialogWindow::UpdateFocused()
181*cdf0e10cSrcweir {
182*cdf0e10cSrcweir 	for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
183*cdf0e10cSrcweir 	{
184*cdf0e10cSrcweir 		Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
185*cdf0e10cSrcweir 		if ( xChild.is() )
186*cdf0e10cSrcweir 		{
187*cdf0e10cSrcweir 			AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
188*cdf0e10cSrcweir 			if ( pShape )
189*cdf0e10cSrcweir 				pShape->SetFocused( pShape->IsFocused() );
190*cdf0e10cSrcweir 		}
191*cdf0e10cSrcweir 	}
192*cdf0e10cSrcweir }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir // -----------------------------------------------------------------------------
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir void AccessibleDialogWindow::UpdateSelected()
197*cdf0e10cSrcweir {
198*cdf0e10cSrcweir 	NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
201*cdf0e10cSrcweir 	{
202*cdf0e10cSrcweir 		Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
203*cdf0e10cSrcweir 		if ( xChild.is() )
204*cdf0e10cSrcweir 		{
205*cdf0e10cSrcweir 			AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
206*cdf0e10cSrcweir 			if ( pShape )
207*cdf0e10cSrcweir 				pShape->SetSelected( pShape->IsSelected() );
208*cdf0e10cSrcweir 		}
209*cdf0e10cSrcweir 	}
210*cdf0e10cSrcweir }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir // -----------------------------------------------------------------------------
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir void AccessibleDialogWindow::UpdateBounds()
215*cdf0e10cSrcweir {
216*cdf0e10cSrcweir 	for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
217*cdf0e10cSrcweir 	{
218*cdf0e10cSrcweir 		Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
219*cdf0e10cSrcweir 		if ( xChild.is() )
220*cdf0e10cSrcweir 		{
221*cdf0e10cSrcweir 			AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
222*cdf0e10cSrcweir 			if ( pShape )
223*cdf0e10cSrcweir 				pShape->SetBounds( pShape->GetBounds() );
224*cdf0e10cSrcweir 		}
225*cdf0e10cSrcweir 	}
226*cdf0e10cSrcweir }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir // -----------------------------------------------------------------------------
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir sal_Bool AccessibleDialogWindow::IsChildVisible( const ChildDescriptor& rDesc )
231*cdf0e10cSrcweir {
232*cdf0e10cSrcweir 	sal_Bool bVisible = sal_False;
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 	if ( m_pDialogWindow )
235*cdf0e10cSrcweir 	{
236*cdf0e10cSrcweir 		// first check, if the shape is in a visible layer
237*cdf0e10cSrcweir 		SdrModel* pSdrModel = m_pDialogWindow->GetModel();
238*cdf0e10cSrcweir 		if ( pSdrModel )
239*cdf0e10cSrcweir 		{
240*cdf0e10cSrcweir 			SdrLayerAdmin& rLayerAdmin = pSdrModel->GetLayerAdmin();
241*cdf0e10cSrcweir 			DlgEdObj* pDlgEdObj = rDesc.pDlgEdObj;
242*cdf0e10cSrcweir 			if ( pDlgEdObj )
243*cdf0e10cSrcweir 			{
244*cdf0e10cSrcweir 				SdrLayerID nLayerId = pDlgEdObj->GetLayer();
245*cdf0e10cSrcweir 				const SdrLayer* pSdrLayer = rLayerAdmin.GetLayerPerID( nLayerId );
246*cdf0e10cSrcweir 				if ( pSdrLayer )
247*cdf0e10cSrcweir 				{
248*cdf0e10cSrcweir 					String aLayerName = pSdrLayer->GetName();
249*cdf0e10cSrcweir 					SdrView* pSdrView = m_pDialogWindow->GetView();
250*cdf0e10cSrcweir 					if ( pSdrView && pSdrView->IsLayerVisible( aLayerName ) )
251*cdf0e10cSrcweir 					{
252*cdf0e10cSrcweir 						// get the bounding box of the shape in logic units
253*cdf0e10cSrcweir 						Rectangle aRect = pDlgEdObj->GetSnapRect();
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 						// transform coordinates relative to the parent
256*cdf0e10cSrcweir 						MapMode aMap = m_pDialogWindow->GetMapMode();
257*cdf0e10cSrcweir 						Point aOrg = aMap.GetOrigin();
258*cdf0e10cSrcweir 						aRect.Move( aOrg.X(), aOrg.Y() );
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 						// convert logic units to pixel
261*cdf0e10cSrcweir 						aRect = m_pDialogWindow->LogicToPixel( aRect, MapMode(MAP_100TH_MM) );
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 						// check, if the shape's bounding box intersects with the bounding box of its parent
264*cdf0e10cSrcweir 						Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() );
265*cdf0e10cSrcweir 						if ( aParentRect.IsOver( aRect ) )
266*cdf0e10cSrcweir 							bVisible = sal_True;
267*cdf0e10cSrcweir 					}
268*cdf0e10cSrcweir 				}
269*cdf0e10cSrcweir 			}
270*cdf0e10cSrcweir 		}
271*cdf0e10cSrcweir 	}
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 	return bVisible;
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir // -----------------------------------------------------------------------------
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir void AccessibleDialogWindow::InsertChild( const ChildDescriptor& rDesc )
279*cdf0e10cSrcweir {
280*cdf0e10cSrcweir 	// check, if object is already in child list
281*cdf0e10cSrcweir 	AccessibleChildren::iterator aIter = ::std::find( m_aAccessibleChildren.begin(), m_aAccessibleChildren.end(), rDesc );
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 	// if not found, insert in child list
284*cdf0e10cSrcweir 	if ( aIter == m_aAccessibleChildren.end() )
285*cdf0e10cSrcweir 	{
286*cdf0e10cSrcweir 		// insert entry in child list
287*cdf0e10cSrcweir 		m_aAccessibleChildren.push_back( rDesc );
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir 		// get the accessible of the inserted child
290*cdf0e10cSrcweir 		Reference< XAccessible > xChild( getAccessibleChild( m_aAccessibleChildren.size() - 1 ) );
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 		// sort child list
293*cdf0e10cSrcweir 		SortChildren();
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 		// send accessible child event
296*cdf0e10cSrcweir 		if ( xChild.is() )
297*cdf0e10cSrcweir 		{
298*cdf0e10cSrcweir 			Any aOldValue, aNewValue;
299*cdf0e10cSrcweir 			aNewValue <<= xChild;
300*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
301*cdf0e10cSrcweir 		}
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir // -----------------------------------------------------------------------------
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir void AccessibleDialogWindow::RemoveChild( const ChildDescriptor& rDesc )
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir 	// find object in child list
310*cdf0e10cSrcweir 	AccessibleChildren::iterator aIter = ::std::find( m_aAccessibleChildren.begin(), m_aAccessibleChildren.end(), rDesc );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir 	// if found, remove from child list
313*cdf0e10cSrcweir 	if ( aIter != m_aAccessibleChildren.end() )
314*cdf0e10cSrcweir 	{
315*cdf0e10cSrcweir 		// get the accessible of the removed child
316*cdf0e10cSrcweir 		Reference< XAccessible > xChild( aIter->rxAccessible );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 		// remove entry from child list
319*cdf0e10cSrcweir 		m_aAccessibleChildren.erase( aIter );
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 		// send accessible child event
322*cdf0e10cSrcweir 		if ( xChild.is() )
323*cdf0e10cSrcweir 		{
324*cdf0e10cSrcweir 			Any aOldValue, aNewValue;
325*cdf0e10cSrcweir 			aOldValue <<= xChild;
326*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 			Reference< XComponent > xComponent( xChild, UNO_QUERY );
329*cdf0e10cSrcweir 			if ( xComponent.is() )
330*cdf0e10cSrcweir 				xComponent->dispose();
331*cdf0e10cSrcweir 		}
332*cdf0e10cSrcweir 	}
333*cdf0e10cSrcweir }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir // -----------------------------------------------------------------------------
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir void AccessibleDialogWindow::UpdateChild( const ChildDescriptor& rDesc )
338*cdf0e10cSrcweir {
339*cdf0e10cSrcweir 	if ( IsChildVisible( rDesc ) )
340*cdf0e10cSrcweir 	{
341*cdf0e10cSrcweir 		// if the object is not in the child list, insert child
342*cdf0e10cSrcweir 		InsertChild( rDesc );
343*cdf0e10cSrcweir 	}
344*cdf0e10cSrcweir 	else
345*cdf0e10cSrcweir 	{
346*cdf0e10cSrcweir 		// if the object is in the child list, remove child
347*cdf0e10cSrcweir 		RemoveChild( rDesc );
348*cdf0e10cSrcweir 	}
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir // -----------------------------------------------------------------------------
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir void AccessibleDialogWindow::UpdateChildren()
354*cdf0e10cSrcweir {
355*cdf0e10cSrcweir 	if ( m_pDialogWindow )
356*cdf0e10cSrcweir 	{
357*cdf0e10cSrcweir 		SdrPage* pSdrPage = m_pDialogWindow->GetPage();
358*cdf0e10cSrcweir 		if ( pSdrPage )
359*cdf0e10cSrcweir 		{
360*cdf0e10cSrcweir 			for ( sal_uLong i = 0, nCount = pSdrPage->GetObjCount(); i < nCount; ++i )
361*cdf0e10cSrcweir 			{
362*cdf0e10cSrcweir 				SdrObject* pObj = pSdrPage->GetObj( i );
363*cdf0e10cSrcweir 				DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj );
364*cdf0e10cSrcweir 				if ( pDlgEdObj )
365*cdf0e10cSrcweir 					UpdateChild( ChildDescriptor( pDlgEdObj ) );
366*cdf0e10cSrcweir 			}
367*cdf0e10cSrcweir 		}
368*cdf0e10cSrcweir 	}
369*cdf0e10cSrcweir }
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir // -----------------------------------------------------------------------------
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir void AccessibleDialogWindow::SortChildren()
374*cdf0e10cSrcweir {
375*cdf0e10cSrcweir 	// sort child list
376*cdf0e10cSrcweir 	::std::sort( m_aAccessibleChildren.begin(), m_aAccessibleChildren.end() );
377*cdf0e10cSrcweir }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir // -----------------------------------------------------------------------------
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir IMPL_LINK( AccessibleDialogWindow, WindowEventListener, VclSimpleEvent*, pEvent )
382*cdf0e10cSrcweir {
383*cdf0e10cSrcweir 	DBG_CHKTHIS( AccessibleDialogWindow, 0 );
384*cdf0e10cSrcweir 	DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "AccessibleDialogWindow::WindowEventListener: unknown window event!" );
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir 	if ( pEvent && pEvent->ISA( VclWindowEvent ) )
387*cdf0e10cSrcweir 	{
388*cdf0e10cSrcweir 		DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "AccessibleDialogWindow::WindowEventListener: no window!" );
389*cdf0e10cSrcweir 		if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
390*cdf0e10cSrcweir 		{
391*cdf0e10cSrcweir 			ProcessWindowEvent( *(VclWindowEvent*)pEvent );
392*cdf0e10cSrcweir 		}
393*cdf0e10cSrcweir 	}
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir 	return 0;
396*cdf0e10cSrcweir }
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir // -----------------------------------------------------------------------------
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
401*cdf0e10cSrcweir {
402*cdf0e10cSrcweir 	Any aOldValue, aNewValue;
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 	switch ( rVclWindowEvent.GetId() )
405*cdf0e10cSrcweir 	{
406*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_ENABLED:
407*cdf0e10cSrcweir 		{
408*cdf0e10cSrcweir 			aNewValue <<= AccessibleStateType::ENABLED;
409*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
410*cdf0e10cSrcweir 		}
411*cdf0e10cSrcweir 		break;
412*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_DISABLED:
413*cdf0e10cSrcweir 		{
414*cdf0e10cSrcweir 			aOldValue <<= AccessibleStateType::ENABLED;
415*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
416*cdf0e10cSrcweir 		}
417*cdf0e10cSrcweir 		break;
418*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_ACTIVATE:
419*cdf0e10cSrcweir 		{
420*cdf0e10cSrcweir 			aNewValue <<= AccessibleStateType::ACTIVE;
421*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
422*cdf0e10cSrcweir 		}
423*cdf0e10cSrcweir 		break;
424*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_DEACTIVATE:
425*cdf0e10cSrcweir 		{
426*cdf0e10cSrcweir 			aOldValue <<= AccessibleStateType::ACTIVE;
427*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
428*cdf0e10cSrcweir 		}
429*cdf0e10cSrcweir 		break;
430*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_GETFOCUS:
431*cdf0e10cSrcweir 		{
432*cdf0e10cSrcweir 			aNewValue <<= AccessibleStateType::FOCUSED;
433*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
434*cdf0e10cSrcweir 		}
435*cdf0e10cSrcweir 		break;
436*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_LOSEFOCUS:
437*cdf0e10cSrcweir 		{
438*cdf0e10cSrcweir 			aOldValue <<= AccessibleStateType::FOCUSED;
439*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
440*cdf0e10cSrcweir 		}
441*cdf0e10cSrcweir 		break;
442*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_SHOW:
443*cdf0e10cSrcweir 		{
444*cdf0e10cSrcweir 			aNewValue <<= AccessibleStateType::SHOWING;
445*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
446*cdf0e10cSrcweir 		}
447*cdf0e10cSrcweir 		break;
448*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_HIDE:
449*cdf0e10cSrcweir 		{
450*cdf0e10cSrcweir 			aOldValue <<= AccessibleStateType::SHOWING;
451*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
452*cdf0e10cSrcweir 		}
453*cdf0e10cSrcweir 		break;
454*cdf0e10cSrcweir 		case VCLEVENT_WINDOW_RESIZE:
455*cdf0e10cSrcweir 		{
456*cdf0e10cSrcweir 			NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, aOldValue, aNewValue );
457*cdf0e10cSrcweir 			UpdateChildren();
458*cdf0e10cSrcweir 			UpdateBounds();
459*cdf0e10cSrcweir 		}
460*cdf0e10cSrcweir 		break;
461*cdf0e10cSrcweir 		case VCLEVENT_OBJECT_DYING:
462*cdf0e10cSrcweir 		{
463*cdf0e10cSrcweir 			if ( m_pDialogWindow )
464*cdf0e10cSrcweir 			{
465*cdf0e10cSrcweir 				m_pDialogWindow->RemoveEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) );
466*cdf0e10cSrcweir 				m_pDialogWindow = NULL;
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir 				if ( m_pDlgEditor )
469*cdf0e10cSrcweir 					EndListening( *m_pDlgEditor );
470*cdf0e10cSrcweir 				m_pDlgEditor = NULL;
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 				if ( m_pDlgEdModel )
473*cdf0e10cSrcweir 					EndListening( *m_pDlgEdModel );
474*cdf0e10cSrcweir 				m_pDlgEdModel = NULL;
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 				// dispose all children
477*cdf0e10cSrcweir 				for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
478*cdf0e10cSrcweir 				{
479*cdf0e10cSrcweir 					Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY );
480*cdf0e10cSrcweir 					if ( xComponent.is() )
481*cdf0e10cSrcweir 						xComponent->dispose();
482*cdf0e10cSrcweir 				}
483*cdf0e10cSrcweir 				m_aAccessibleChildren.clear();
484*cdf0e10cSrcweir 			}
485*cdf0e10cSrcweir 		}
486*cdf0e10cSrcweir 		break;
487*cdf0e10cSrcweir 		default:
488*cdf0e10cSrcweir 		{
489*cdf0e10cSrcweir 		}
490*cdf0e10cSrcweir 		break;
491*cdf0e10cSrcweir 	}
492*cdf0e10cSrcweir }
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir // -----------------------------------------------------------------------------
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir void AccessibleDialogWindow::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
497*cdf0e10cSrcweir {
498*cdf0e10cSrcweir 	if ( m_pDialogWindow )
499*cdf0e10cSrcweir 	{
500*cdf0e10cSrcweir 		if ( m_pDialogWindow->IsEnabled() )
501*cdf0e10cSrcweir 			rStateSet.AddState( AccessibleStateType::ENABLED );
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir 		rStateSet.AddState( AccessibleStateType::FOCUSABLE );
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir 		if ( m_pDialogWindow->HasFocus() )
506*cdf0e10cSrcweir 			rStateSet.AddState( AccessibleStateType::FOCUSED );
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 		rStateSet.AddState( AccessibleStateType::VISIBLE );
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir 		if ( m_pDialogWindow->IsVisible() )
511*cdf0e10cSrcweir 			rStateSet.AddState( AccessibleStateType::SHOWING );
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 		rStateSet.AddState( AccessibleStateType::OPAQUE );
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir 		rStateSet.AddState( AccessibleStateType::RESIZABLE );
516*cdf0e10cSrcweir 	}
517*cdf0e10cSrcweir }
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir // -----------------------------------------------------------------------------
520*cdf0e10cSrcweir // OCommonAccessibleComponent
521*cdf0e10cSrcweir // -----------------------------------------------------------------------------
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir awt::Rectangle AccessibleDialogWindow::implGetBounds() throw (RuntimeException)
524*cdf0e10cSrcweir {
525*cdf0e10cSrcweir 	awt::Rectangle aBounds;
526*cdf0e10cSrcweir 	if ( m_pDialogWindow )
527*cdf0e10cSrcweir 		aBounds = AWTRectangle( Rectangle( m_pDialogWindow->GetPosPixel(), m_pDialogWindow->GetSizePixel() ) );
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir 	return aBounds;
530*cdf0e10cSrcweir }
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir // -----------------------------------------------------------------------------
533*cdf0e10cSrcweir // SfxListener
534*cdf0e10cSrcweir // -----------------------------------------------------------------------------
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint )
537*cdf0e10cSrcweir {
538*cdf0e10cSrcweir 	if ( rHint.ISA( SdrHint ) )
539*cdf0e10cSrcweir 	{
540*cdf0e10cSrcweir 		SdrHint* pSdrHint = (SdrHint*)&rHint;
541*cdf0e10cSrcweir 		switch ( pSdrHint->GetKind() )
542*cdf0e10cSrcweir 		{
543*cdf0e10cSrcweir 			case HINT_OBJINSERTED:
544*cdf0e10cSrcweir 			{
545*cdf0e10cSrcweir 				SdrObject* pObj = (SdrObject*)pSdrHint->GetObject();
546*cdf0e10cSrcweir 				DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj );
547*cdf0e10cSrcweir 				if ( pDlgEdObj )
548*cdf0e10cSrcweir 				{
549*cdf0e10cSrcweir 					ChildDescriptor aDesc( pDlgEdObj );
550*cdf0e10cSrcweir 					if ( IsChildVisible( aDesc ) )
551*cdf0e10cSrcweir 						InsertChild( aDesc );
552*cdf0e10cSrcweir 				}
553*cdf0e10cSrcweir 			}
554*cdf0e10cSrcweir 			break;
555*cdf0e10cSrcweir 			case HINT_OBJREMOVED:
556*cdf0e10cSrcweir 			{
557*cdf0e10cSrcweir 				SdrObject* pObj = (SdrObject*)pSdrHint->GetObject();
558*cdf0e10cSrcweir 				DlgEdObj* pDlgEdObj = PTR_CAST( DlgEdObj, pObj );
559*cdf0e10cSrcweir 				if ( pDlgEdObj )
560*cdf0e10cSrcweir 					RemoveChild( ChildDescriptor( pDlgEdObj ) );
561*cdf0e10cSrcweir 			}
562*cdf0e10cSrcweir 			break;
563*cdf0e10cSrcweir 			default: ;
564*cdf0e10cSrcweir 		}
565*cdf0e10cSrcweir 	}
566*cdf0e10cSrcweir 	else if ( rHint.ISA( DlgEdHint ) )
567*cdf0e10cSrcweir 	{
568*cdf0e10cSrcweir 		DlgEdHint* pDlgEdHint = (DlgEdHint*)&rHint;
569*cdf0e10cSrcweir 		switch ( pDlgEdHint->GetKind() )
570*cdf0e10cSrcweir 		{
571*cdf0e10cSrcweir 			case DLGED_HINT_WINDOWSCROLLED:
572*cdf0e10cSrcweir 			{
573*cdf0e10cSrcweir 				UpdateChildren();
574*cdf0e10cSrcweir 				UpdateBounds();
575*cdf0e10cSrcweir 			}
576*cdf0e10cSrcweir 			break;
577*cdf0e10cSrcweir 			case DLGED_HINT_LAYERCHANGED:
578*cdf0e10cSrcweir 			{
579*cdf0e10cSrcweir 				DlgEdObj* pDlgEdObj = pDlgEdHint->GetObject();
580*cdf0e10cSrcweir 				if ( pDlgEdObj )
581*cdf0e10cSrcweir 					UpdateChild( ChildDescriptor( pDlgEdObj ) );
582*cdf0e10cSrcweir 			}
583*cdf0e10cSrcweir 			break;
584*cdf0e10cSrcweir 			case DLGED_HINT_OBJORDERCHANGED:
585*cdf0e10cSrcweir 			{
586*cdf0e10cSrcweir 				SortChildren();
587*cdf0e10cSrcweir 			}
588*cdf0e10cSrcweir 			break;
589*cdf0e10cSrcweir 			case DLGED_HINT_SELECTIONCHANGED:
590*cdf0e10cSrcweir 			{
591*cdf0e10cSrcweir 				UpdateFocused();
592*cdf0e10cSrcweir 				UpdateSelected();
593*cdf0e10cSrcweir 			}
594*cdf0e10cSrcweir 			break;
595*cdf0e10cSrcweir 			default: ;
596*cdf0e10cSrcweir 		}
597*cdf0e10cSrcweir 	}
598*cdf0e10cSrcweir }
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir // -----------------------------------------------------------------------------
601*cdf0e10cSrcweir // XInterface
602*cdf0e10cSrcweir // -----------------------------------------------------------------------------
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( AccessibleDialogWindow, AccessibleExtendedComponentHelper_BASE, AccessibleDialogWindow_BASE )
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir // -----------------------------------------------------------------------------
607*cdf0e10cSrcweir // XTypeProvider
608*cdf0e10cSrcweir // -----------------------------------------------------------------------------
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleDialogWindow, AccessibleExtendedComponentHelper_BASE, AccessibleDialogWindow_BASE )
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir // -----------------------------------------------------------------------------
613*cdf0e10cSrcweir // XComponent
614*cdf0e10cSrcweir // -----------------------------------------------------------------------------
615*cdf0e10cSrcweir 
616*cdf0e10cSrcweir void AccessibleDialogWindow::disposing()
617*cdf0e10cSrcweir {
618*cdf0e10cSrcweir 	AccessibleExtendedComponentHelper_BASE::disposing();
619*cdf0e10cSrcweir 
620*cdf0e10cSrcweir 	if ( m_pDialogWindow )
621*cdf0e10cSrcweir 	{
622*cdf0e10cSrcweir 		m_pDialogWindow->RemoveEventListener( LINK( this, AccessibleDialogWindow, WindowEventListener ) );
623*cdf0e10cSrcweir 		m_pDialogWindow = NULL;
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir 		if ( m_pDlgEditor )
626*cdf0e10cSrcweir 			EndListening( *m_pDlgEditor );
627*cdf0e10cSrcweir 		m_pDlgEditor = NULL;
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir 		if ( m_pDlgEdModel )
630*cdf0e10cSrcweir 			EndListening( *m_pDlgEdModel );
631*cdf0e10cSrcweir 		m_pDlgEdModel = NULL;
632*cdf0e10cSrcweir 
633*cdf0e10cSrcweir 		// dispose all children
634*cdf0e10cSrcweir 		for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
635*cdf0e10cSrcweir 		{
636*cdf0e10cSrcweir 			Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY );
637*cdf0e10cSrcweir 			if ( xComponent.is() )
638*cdf0e10cSrcweir 				xComponent->dispose();
639*cdf0e10cSrcweir 		}
640*cdf0e10cSrcweir 		m_aAccessibleChildren.clear();
641*cdf0e10cSrcweir 	}
642*cdf0e10cSrcweir }
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir // -----------------------------------------------------------------------------
645*cdf0e10cSrcweir // XServiceInfo
646*cdf0e10cSrcweir // -----------------------------------------------------------------------------
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir ::rtl::OUString AccessibleDialogWindow::getImplementationName() throw (RuntimeException)
649*cdf0e10cSrcweir {
650*cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( "com.sun.star.comp.basctl.AccessibleWindow" );
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir // -----------------------------------------------------------------------------
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir sal_Bool AccessibleDialogWindow::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
656*cdf0e10cSrcweir {
657*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
658*cdf0e10cSrcweir 	const ::rtl::OUString* pNames = aNames.getConstArray();
659*cdf0e10cSrcweir 	const ::rtl::OUString* pEnd = pNames + aNames.getLength();
660*cdf0e10cSrcweir 	for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
661*cdf0e10cSrcweir 		;
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir 	return pNames != pEnd;
664*cdf0e10cSrcweir }
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir // -----------------------------------------------------------------------------
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir Sequence< ::rtl::OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (RuntimeException)
669*cdf0e10cSrcweir {
670*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aNames(1);
671*cdf0e10cSrcweir 	aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleWindow" );
672*cdf0e10cSrcweir 	return aNames;
673*cdf0e10cSrcweir }
674*cdf0e10cSrcweir 
675*cdf0e10cSrcweir // -----------------------------------------------------------------------------
676*cdf0e10cSrcweir // XAccessible
677*cdf0e10cSrcweir // -----------------------------------------------------------------------------
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext(  ) throw (RuntimeException)
680*cdf0e10cSrcweir {
681*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir 	return this;
684*cdf0e10cSrcweir }
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir // -----------------------------------------------------------------------------
687*cdf0e10cSrcweir // XAccessibleContext
688*cdf0e10cSrcweir // -----------------------------------------------------------------------------
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() throw (RuntimeException)
691*cdf0e10cSrcweir {
692*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir 	return m_aAccessibleChildren.size();
695*cdf0e10cSrcweir }
696*cdf0e10cSrcweir 
697*cdf0e10cSrcweir // -----------------------------------------------------------------------------
698*cdf0e10cSrcweir 
699*cdf0e10cSrcweir Reference< XAccessible > AccessibleDialogWindow::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
700*cdf0e10cSrcweir {
701*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir 	if ( i < 0 || i >= getAccessibleChildCount() )
704*cdf0e10cSrcweir 		throw IndexOutOfBoundsException();
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir 	Reference< XAccessible > xChild = m_aAccessibleChildren[i].rxAccessible;
707*cdf0e10cSrcweir 	if ( !xChild.is() )
708*cdf0e10cSrcweir 	{
709*cdf0e10cSrcweir 		if ( m_pDialogWindow )
710*cdf0e10cSrcweir 		{
711*cdf0e10cSrcweir 			DlgEdObj* pDlgEdObj = m_aAccessibleChildren[i].pDlgEdObj;
712*cdf0e10cSrcweir 			if ( pDlgEdObj )
713*cdf0e10cSrcweir 			{
714*cdf0e10cSrcweir 				xChild = new AccessibleDialogControlShape( m_pDialogWindow, pDlgEdObj );
715*cdf0e10cSrcweir 
716*cdf0e10cSrcweir 				// insert into child list
717*cdf0e10cSrcweir 				m_aAccessibleChildren[i].rxAccessible = xChild;
718*cdf0e10cSrcweir 			}
719*cdf0e10cSrcweir 		}
720*cdf0e10cSrcweir 	}
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir 	return xChild;
723*cdf0e10cSrcweir }
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir // -----------------------------------------------------------------------------
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir Reference< XAccessible > AccessibleDialogWindow::getAccessibleParent(  ) throw (RuntimeException)
728*cdf0e10cSrcweir {
729*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
730*cdf0e10cSrcweir 
731*cdf0e10cSrcweir 	Reference< XAccessible > xParent;
732*cdf0e10cSrcweir 	if ( m_pDialogWindow )
733*cdf0e10cSrcweir 	{
734*cdf0e10cSrcweir 		Window* pParent = m_pDialogWindow->GetAccessibleParentWindow();
735*cdf0e10cSrcweir 		if ( pParent )
736*cdf0e10cSrcweir 			xParent = pParent->GetAccessible();
737*cdf0e10cSrcweir 	}
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 	return xParent;
740*cdf0e10cSrcweir }
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir // -----------------------------------------------------------------------------
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir sal_Int32 AccessibleDialogWindow::getAccessibleIndexInParent(  ) throw (RuntimeException)
745*cdf0e10cSrcweir {
746*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 	sal_Int32 nIndexInParent = -1;
749*cdf0e10cSrcweir 	if ( m_pDialogWindow )
750*cdf0e10cSrcweir 	{
751*cdf0e10cSrcweir 		Window* pParent = m_pDialogWindow->GetAccessibleParentWindow();
752*cdf0e10cSrcweir 		if ( pParent )
753*cdf0e10cSrcweir 		{
754*cdf0e10cSrcweir 			for ( sal_uInt16 i = 0, nCount = pParent->GetAccessibleChildWindowCount(); i < nCount; ++i )
755*cdf0e10cSrcweir 			{
756*cdf0e10cSrcweir 				Window* pChild = pParent->GetAccessibleChildWindow( i );
757*cdf0e10cSrcweir 				if ( pChild == static_cast< Window* >( m_pDialogWindow ) )
758*cdf0e10cSrcweir 				{
759*cdf0e10cSrcweir 					nIndexInParent = i;
760*cdf0e10cSrcweir 					break;
761*cdf0e10cSrcweir 				}
762*cdf0e10cSrcweir 			}
763*cdf0e10cSrcweir 		}
764*cdf0e10cSrcweir 	}
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 	return nIndexInParent;
767*cdf0e10cSrcweir }
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir // -----------------------------------------------------------------------------
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir sal_Int16 AccessibleDialogWindow::getAccessibleRole(  ) throw (RuntimeException)
772*cdf0e10cSrcweir {
773*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
774*cdf0e10cSrcweir 
775*cdf0e10cSrcweir 	return AccessibleRole::PANEL;
776*cdf0e10cSrcweir }
777*cdf0e10cSrcweir 
778*cdf0e10cSrcweir // -----------------------------------------------------------------------------
779*cdf0e10cSrcweir 
780*cdf0e10cSrcweir ::rtl::OUString AccessibleDialogWindow::getAccessibleDescription(	) throw (RuntimeException)
781*cdf0e10cSrcweir {
782*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
783*cdf0e10cSrcweir 
784*cdf0e10cSrcweir 	::rtl::OUString sDescription;
785*cdf0e10cSrcweir 	if ( m_pDialogWindow )
786*cdf0e10cSrcweir 		sDescription = m_pDialogWindow->GetAccessibleDescription();
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir 	return sDescription;
789*cdf0e10cSrcweir }
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir // -----------------------------------------------------------------------------
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir ::rtl::OUString AccessibleDialogWindow::getAccessibleName(  ) throw (RuntimeException)
794*cdf0e10cSrcweir {
795*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir 	::rtl::OUString sName;
798*cdf0e10cSrcweir 	if ( m_pDialogWindow )
799*cdf0e10cSrcweir 		sName = m_pDialogWindow->GetAccessibleName();
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir 	return sName;
802*cdf0e10cSrcweir }
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir // -----------------------------------------------------------------------------
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir Reference< XAccessibleRelationSet > AccessibleDialogWindow::getAccessibleRelationSet(  ) throw (RuntimeException)
807*cdf0e10cSrcweir {
808*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir 	utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
811*cdf0e10cSrcweir 	Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
812*cdf0e10cSrcweir 	return xSet;
813*cdf0e10cSrcweir }
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir // -----------------------------------------------------------------------------
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir Reference< XAccessibleStateSet > AccessibleDialogWindow::getAccessibleStateSet(  ) throw (RuntimeException)
818*cdf0e10cSrcweir {
819*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
820*cdf0e10cSrcweir 
821*cdf0e10cSrcweir 	utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
822*cdf0e10cSrcweir 	Reference< XAccessibleStateSet > xSet = pStateSetHelper;
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir 	if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
825*cdf0e10cSrcweir 	{
826*cdf0e10cSrcweir 		FillAccessibleStateSet( *pStateSetHelper );
827*cdf0e10cSrcweir 	}
828*cdf0e10cSrcweir 	else
829*cdf0e10cSrcweir 	{
830*cdf0e10cSrcweir 		pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
831*cdf0e10cSrcweir 	}
832*cdf0e10cSrcweir 
833*cdf0e10cSrcweir 	return xSet;
834*cdf0e10cSrcweir }
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir // -----------------------------------------------------------------------------
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir Locale AccessibleDialogWindow::getLocale(  ) throw (IllegalAccessibleComponentStateException, RuntimeException)
839*cdf0e10cSrcweir {
840*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
841*cdf0e10cSrcweir 
842*cdf0e10cSrcweir 	return Application::GetSettings().GetLocale();
843*cdf0e10cSrcweir }
844*cdf0e10cSrcweir 
845*cdf0e10cSrcweir // -----------------------------------------------------------------------------
846*cdf0e10cSrcweir // XAccessibleComponent
847*cdf0e10cSrcweir // -----------------------------------------------------------------------------
848*cdf0e10cSrcweir 
849*cdf0e10cSrcweir Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
850*cdf0e10cSrcweir {
851*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir 	Reference< XAccessible > xChild;
854*cdf0e10cSrcweir 	for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
855*cdf0e10cSrcweir 	{
856*cdf0e10cSrcweir 		Reference< XAccessible > xAcc = getAccessibleChild( i );
857*cdf0e10cSrcweir 		if ( xAcc.is() )
858*cdf0e10cSrcweir 		{
859*cdf0e10cSrcweir 			Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
860*cdf0e10cSrcweir 			if ( xComp.is() )
861*cdf0e10cSrcweir 			{
862*cdf0e10cSrcweir 				Rectangle aRect = VCLRectangle( xComp->getBounds() );
863*cdf0e10cSrcweir 				Point aPos = VCLPoint( rPoint );
864*cdf0e10cSrcweir 				if ( aRect.IsInside( aPos ) )
865*cdf0e10cSrcweir 				{
866*cdf0e10cSrcweir 					xChild = xAcc;
867*cdf0e10cSrcweir 					break;
868*cdf0e10cSrcweir 				}
869*cdf0e10cSrcweir 			}
870*cdf0e10cSrcweir 		}
871*cdf0e10cSrcweir 	}
872*cdf0e10cSrcweir 
873*cdf0e10cSrcweir 	return xChild;
874*cdf0e10cSrcweir }
875*cdf0e10cSrcweir 
876*cdf0e10cSrcweir // -----------------------------------------------------------------------------
877*cdf0e10cSrcweir 
878*cdf0e10cSrcweir void AccessibleDialogWindow::grabFocus(  ) throw (RuntimeException)
879*cdf0e10cSrcweir {
880*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
881*cdf0e10cSrcweir 
882*cdf0e10cSrcweir 	if ( m_pDialogWindow )
883*cdf0e10cSrcweir 		m_pDialogWindow->GrabFocus();
884*cdf0e10cSrcweir }
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir // -----------------------------------------------------------------------------
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir sal_Int32 AccessibleDialogWindow::getForeground(  ) throw (RuntimeException)
889*cdf0e10cSrcweir {
890*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
891*cdf0e10cSrcweir 
892*cdf0e10cSrcweir 	sal_Int32 nColor = 0;
893*cdf0e10cSrcweir 	if ( m_pDialogWindow )
894*cdf0e10cSrcweir 	{
895*cdf0e10cSrcweir 		if ( m_pDialogWindow->IsControlForeground() )
896*cdf0e10cSrcweir 			nColor = m_pDialogWindow->GetControlForeground().GetColor();
897*cdf0e10cSrcweir 		else
898*cdf0e10cSrcweir 		{
899*cdf0e10cSrcweir 			Font aFont;
900*cdf0e10cSrcweir 			if ( m_pDialogWindow->IsControlFont() )
901*cdf0e10cSrcweir 				aFont = m_pDialogWindow->GetControlFont();
902*cdf0e10cSrcweir 			else
903*cdf0e10cSrcweir 				aFont = m_pDialogWindow->GetFont();
904*cdf0e10cSrcweir 			nColor = aFont.GetColor().GetColor();
905*cdf0e10cSrcweir 		}
906*cdf0e10cSrcweir 	}
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir 	return nColor;
909*cdf0e10cSrcweir }
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir // -----------------------------------------------------------------------------
912*cdf0e10cSrcweir 
913*cdf0e10cSrcweir sal_Int32 AccessibleDialogWindow::getBackground(  ) throw (RuntimeException)
914*cdf0e10cSrcweir {
915*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 	sal_Int32 nColor = 0;
918*cdf0e10cSrcweir 	if ( m_pDialogWindow )
919*cdf0e10cSrcweir 	{
920*cdf0e10cSrcweir 		if ( m_pDialogWindow->IsControlBackground() )
921*cdf0e10cSrcweir 			nColor = m_pDialogWindow->GetControlBackground().GetColor();
922*cdf0e10cSrcweir 		else
923*cdf0e10cSrcweir 			nColor = m_pDialogWindow->GetBackground().GetColor().GetColor();
924*cdf0e10cSrcweir 	}
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 	return nColor;
927*cdf0e10cSrcweir }
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir // -----------------------------------------------------------------------------
930*cdf0e10cSrcweir // XAccessibleExtendedComponent
931*cdf0e10cSrcweir // -----------------------------------------------------------------------------
932*cdf0e10cSrcweir 
933*cdf0e10cSrcweir Reference< awt::XFont > AccessibleDialogWindow::getFont(  ) throw (RuntimeException)
934*cdf0e10cSrcweir {
935*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir 	Reference< awt::XFont > xFont;
938*cdf0e10cSrcweir 	if ( m_pDialogWindow )
939*cdf0e10cSrcweir 	{
940*cdf0e10cSrcweir 		Reference< awt::XDevice > xDev( m_pDialogWindow->GetComponentInterface(), UNO_QUERY );
941*cdf0e10cSrcweir 		if ( xDev.is() )
942*cdf0e10cSrcweir 		{
943*cdf0e10cSrcweir 			Font aFont;
944*cdf0e10cSrcweir 			if ( m_pDialogWindow->IsControlFont() )
945*cdf0e10cSrcweir 				aFont = m_pDialogWindow->GetControlFont();
946*cdf0e10cSrcweir 			else
947*cdf0e10cSrcweir 				aFont = m_pDialogWindow->GetFont();
948*cdf0e10cSrcweir 			VCLXFont* pVCLXFont = new VCLXFont;
949*cdf0e10cSrcweir 			pVCLXFont->Init( *xDev.get(), aFont );
950*cdf0e10cSrcweir 			xFont = pVCLXFont;
951*cdf0e10cSrcweir 		}
952*cdf0e10cSrcweir 	}
953*cdf0e10cSrcweir 
954*cdf0e10cSrcweir 	return xFont;
955*cdf0e10cSrcweir }
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir // -----------------------------------------------------------------------------
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir ::rtl::OUString AccessibleDialogWindow::getTitledBorderText(  ) throw (RuntimeException)
960*cdf0e10cSrcweir {
961*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir 	return ::rtl::OUString();
964*cdf0e10cSrcweir }
965*cdf0e10cSrcweir 
966*cdf0e10cSrcweir // -----------------------------------------------------------------------------
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir ::rtl::OUString AccessibleDialogWindow::getToolTipText(  ) throw (RuntimeException)
969*cdf0e10cSrcweir {
970*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
971*cdf0e10cSrcweir 
972*cdf0e10cSrcweir 	::rtl::OUString sText;
973*cdf0e10cSrcweir 	if ( m_pDialogWindow )
974*cdf0e10cSrcweir 		sText = m_pDialogWindow->GetQuickHelpText();
975*cdf0e10cSrcweir 
976*cdf0e10cSrcweir 	return sText;
977*cdf0e10cSrcweir }
978*cdf0e10cSrcweir 
979*cdf0e10cSrcweir // -----------------------------------------------------------------------------
980*cdf0e10cSrcweir // XAccessibleSelection
981*cdf0e10cSrcweir // -----------------------------------------------------------------------------
982*cdf0e10cSrcweir 
983*cdf0e10cSrcweir void AccessibleDialogWindow::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
984*cdf0e10cSrcweir {
985*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir 	if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
988*cdf0e10cSrcweir 		throw IndexOutOfBoundsException();
989*cdf0e10cSrcweir 
990*cdf0e10cSrcweir 	if ( m_pDialogWindow )
991*cdf0e10cSrcweir 	{
992*cdf0e10cSrcweir 		DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj;
993*cdf0e10cSrcweir 		if ( pDlgEdObj )
994*cdf0e10cSrcweir 		{
995*cdf0e10cSrcweir 			SdrView* pSdrView = m_pDialogWindow->GetView();
996*cdf0e10cSrcweir 			if ( pSdrView )
997*cdf0e10cSrcweir 			{
998*cdf0e10cSrcweir 				SdrPageView* pPgView = pSdrView->GetSdrPageView();
999*cdf0e10cSrcweir 				if ( pPgView )
1000*cdf0e10cSrcweir 					pSdrView->MarkObj( pDlgEdObj, pPgView );
1001*cdf0e10cSrcweir 			}
1002*cdf0e10cSrcweir 		}
1003*cdf0e10cSrcweir 	}
1004*cdf0e10cSrcweir }
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir sal_Bool AccessibleDialogWindow::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
1009*cdf0e10cSrcweir {
1010*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
1011*cdf0e10cSrcweir 
1012*cdf0e10cSrcweir 	if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
1013*cdf0e10cSrcweir 		throw IndexOutOfBoundsException();
1014*cdf0e10cSrcweir 
1015*cdf0e10cSrcweir 	sal_Bool bSelected = sal_False;
1016*cdf0e10cSrcweir 	if ( m_pDialogWindow )
1017*cdf0e10cSrcweir 	{
1018*cdf0e10cSrcweir 		DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj;
1019*cdf0e10cSrcweir 		if ( pDlgEdObj )
1020*cdf0e10cSrcweir 		{
1021*cdf0e10cSrcweir 			SdrView* pSdrView = m_pDialogWindow->GetView();
1022*cdf0e10cSrcweir 			if ( pSdrView )
1023*cdf0e10cSrcweir 				bSelected = pSdrView->IsObjMarked( pDlgEdObj );
1024*cdf0e10cSrcweir 		}
1025*cdf0e10cSrcweir 	}
1026*cdf0e10cSrcweir 
1027*cdf0e10cSrcweir 	return bSelected;
1028*cdf0e10cSrcweir }
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1031*cdf0e10cSrcweir 
1032*cdf0e10cSrcweir void AccessibleDialogWindow::clearAccessibleSelection(  ) throw (RuntimeException)
1033*cdf0e10cSrcweir {
1034*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
1035*cdf0e10cSrcweir 
1036*cdf0e10cSrcweir 	if ( m_pDialogWindow )
1037*cdf0e10cSrcweir 	{
1038*cdf0e10cSrcweir 		SdrView* pSdrView = m_pDialogWindow->GetView();
1039*cdf0e10cSrcweir 		if ( pSdrView )
1040*cdf0e10cSrcweir 			pSdrView->UnmarkAll();
1041*cdf0e10cSrcweir 	}
1042*cdf0e10cSrcweir }
1043*cdf0e10cSrcweir 
1044*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir void AccessibleDialogWindow::selectAllAccessibleChildren(  ) throw (RuntimeException)
1047*cdf0e10cSrcweir {
1048*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
1049*cdf0e10cSrcweir 
1050*cdf0e10cSrcweir 	if ( m_pDialogWindow )
1051*cdf0e10cSrcweir 	{
1052*cdf0e10cSrcweir 		SdrView* pSdrView = m_pDialogWindow->GetView();
1053*cdf0e10cSrcweir 		if ( pSdrView )
1054*cdf0e10cSrcweir 			pSdrView->MarkAll();
1055*cdf0e10cSrcweir 	}
1056*cdf0e10cSrcweir }
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1059*cdf0e10cSrcweir 
1060*cdf0e10cSrcweir sal_Int32 AccessibleDialogWindow::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
1061*cdf0e10cSrcweir {
1062*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
1063*cdf0e10cSrcweir 
1064*cdf0e10cSrcweir 	sal_Int32 nRet = 0;
1065*cdf0e10cSrcweir 
1066*cdf0e10cSrcweir 	for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
1067*cdf0e10cSrcweir 	{
1068*cdf0e10cSrcweir 		if ( isAccessibleChildSelected( i ) )
1069*cdf0e10cSrcweir 			++nRet;
1070*cdf0e10cSrcweir 	}
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir 	return nRet;
1073*cdf0e10cSrcweir }
1074*cdf0e10cSrcweir 
1075*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1076*cdf0e10cSrcweir 
1077*cdf0e10cSrcweir Reference< XAccessible > AccessibleDialogWindow::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
1078*cdf0e10cSrcweir {
1079*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
1080*cdf0e10cSrcweir 
1081*cdf0e10cSrcweir 	if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
1082*cdf0e10cSrcweir 		throw IndexOutOfBoundsException();
1083*cdf0e10cSrcweir 
1084*cdf0e10cSrcweir 	Reference< XAccessible > xChild;
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir 	for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
1087*cdf0e10cSrcweir 	{
1088*cdf0e10cSrcweir 		if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
1089*cdf0e10cSrcweir 		{
1090*cdf0e10cSrcweir 			xChild = getAccessibleChild( i );
1091*cdf0e10cSrcweir 			break;
1092*cdf0e10cSrcweir 		}
1093*cdf0e10cSrcweir 	}
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir 	return xChild;
1096*cdf0e10cSrcweir }
1097*cdf0e10cSrcweir 
1098*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir void AccessibleDialogWindow::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
1101*cdf0e10cSrcweir {
1102*cdf0e10cSrcweir 	OExternalLockGuard aGuard( this );
1103*cdf0e10cSrcweir 
1104*cdf0e10cSrcweir 	if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
1105*cdf0e10cSrcweir 		throw IndexOutOfBoundsException();
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir 	if ( m_pDialogWindow )
1108*cdf0e10cSrcweir 	{
1109*cdf0e10cSrcweir 		DlgEdObj* pDlgEdObj = m_aAccessibleChildren[nChildIndex].pDlgEdObj;
1110*cdf0e10cSrcweir 		if ( pDlgEdObj )
1111*cdf0e10cSrcweir 		{
1112*cdf0e10cSrcweir 			SdrView* pSdrView = m_pDialogWindow->GetView();
1113*cdf0e10cSrcweir 			if ( pSdrView )
1114*cdf0e10cSrcweir 			{
1115*cdf0e10cSrcweir 				SdrPageView* pPgView = pSdrView->GetSdrPageView();
1116*cdf0e10cSrcweir 				if ( pPgView )
1117*cdf0e10cSrcweir 					pSdrView->MarkObj( pDlgEdObj, pPgView, sal_True );
1118*cdf0e10cSrcweir 			}
1119*cdf0e10cSrcweir 		}
1120*cdf0e10cSrcweir 	}
1121*cdf0e10cSrcweir }
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1124