1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir #include "AccessibleFrameSelector.hxx"
27cdf0e10cSrcweir #include <com/sun/star/awt/KeyEvent.hpp>
28cdf0e10cSrcweir #include <com/sun/star/awt/KeyModifier.hpp>
29cdf0e10cSrcweir #include <com/sun/star/awt/Key.hpp>
30cdf0e10cSrcweir #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HDL_
31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HDL_
34cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HDL_
37cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
40cdf0e10cSrcweir #include <com/sun/star/awt/FocusChangeReason.hpp>
41cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
42cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx>
43cdf0e10cSrcweir #include <vos/mutex.hxx>
44cdf0e10cSrcweir #include <vcl/svapp.hxx>
45cdf0e10cSrcweir #include <svx/frmsel.hxx>
46cdf0e10cSrcweir #include <svx/dialmgr.hxx>
47cdf0e10cSrcweir #include "editeng/unolingu.hxx"
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #ifndef _SVX_DIALOGS_HRC
50cdf0e10cSrcweir #include <svx/dialogs.hrc>
51cdf0e10cSrcweir #endif
52cdf0e10cSrcweir #ifndef SVX_FRMSEL_HRC
53cdf0e10cSrcweir #include "frmsel.hrc"
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir 
56cdf0e10cSrcweir #ifndef MNEMONIC_CHAR
57cdf0e10cSrcweir #define MNEMONIC_CHAR ((sal_Unicode)'~')
58cdf0e10cSrcweir #endif
59cdf0e10cSrcweir 
60cdf0e10cSrcweir namespace svx {
61cdf0e10cSrcweir namespace a11y {
62cdf0e10cSrcweir 
63cdf0e10cSrcweir using ::rtl::OUString;
64cdf0e10cSrcweir using ::com::sun::star::uno::Any;
65cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY;
66cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
67cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
68cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException;
69cdf0e10cSrcweir using ::com::sun::star::uno::XInterface;
70cdf0e10cSrcweir using ::com::sun::star::lang::Locale;
71cdf0e10cSrcweir using ::com::sun::star::lang::EventObject;
72cdf0e10cSrcweir using ::com::sun::star::beans::XPropertyChangeListener;
73cdf0e10cSrcweir using ::com::sun::star::awt::XFocusListener;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir namespace AwtKey                    = ::com::sun::star::awt::Key;
78cdf0e10cSrcweir namespace AwtKeyModifier            = ::com::sun::star::awt::KeyModifier;
79cdf0e10cSrcweir namespace AwtFocusChangeReason      = ::com::sun::star::awt::FocusChangeReason;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir typedef ::com::sun::star::awt::Point        AwtPoint;
82cdf0e10cSrcweir typedef ::com::sun::star::awt::Size         AwtSize;
83cdf0e10cSrcweir typedef ::com::sun::star::awt::Rectangle    AwtRectangle;
84cdf0e10cSrcweir typedef ::com::sun::star::awt::KeyEvent     AwtKeyEvent;
85cdf0e10cSrcweir typedef ::com::sun::star::awt::FocusEvent   AwtFocusEvent;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir // ============================================================================
88cdf0e10cSrcweir 
89cdf0e10cSrcweir AccFrameSelector::AccFrameSelector( FrameSelector& rFrameSel, FrameBorderType eBorder ) :
90cdf0e10cSrcweir     Resource( SVX_RES( RID_SVXSTR_BORDER_CONTROL ) ),
91cdf0e10cSrcweir     mpFrameSel( &rFrameSel ),
92cdf0e10cSrcweir     meBorder( eBorder ),
93cdf0e10cSrcweir     maFocusListeners( maFocusMutex ),
94cdf0e10cSrcweir     maPropertyListeners( maPropertyMutex ),
95cdf0e10cSrcweir     maNames( SVX_RES( ARR_TEXTS ) ),
96cdf0e10cSrcweir     maDescriptions( SVX_RES(ARR_DESCRIPTIONS ) ),
97cdf0e10cSrcweir     mnClientId( 0 )
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     FreeResource();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     if ( mpFrameSel )
102cdf0e10cSrcweir     {
103cdf0e10cSrcweir         mpFrameSel->AddEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
104cdf0e10cSrcweir     }
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir // ----------------------------------------------------------------------------
108cdf0e10cSrcweir 
109cdf0e10cSrcweir AccFrameSelector::~AccFrameSelector()
110cdf0e10cSrcweir {
111cdf0e10cSrcweir     if ( mpFrameSel )
112cdf0e10cSrcweir     {
113cdf0e10cSrcweir         mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir // ----------------------------------------------------------------------------
118cdf0e10cSrcweir 
119cdf0e10cSrcweir Reference< XAccessibleContext > AccFrameSelector::getAccessibleContext(  )
120cdf0e10cSrcweir     throw (RuntimeException)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     return this;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir // ----------------------------------------------------------------------------
126cdf0e10cSrcweir 
127cdf0e10cSrcweir sal_Int32 AccFrameSelector::getAccessibleChildCount(  ) throw (RuntimeException)
128cdf0e10cSrcweir {
129cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
130cdf0e10cSrcweir     IsValid();
131cdf0e10cSrcweir     return (meBorder == FRAMEBORDER_NONE) ? mpFrameSel->GetEnabledBorderCount() : 0;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
134cdf0e10cSrcweir // ----------------------------------------------------------------------------
135cdf0e10cSrcweir 
136cdf0e10cSrcweir Reference< XAccessible > AccFrameSelector::getAccessibleChild( sal_Int32 i )
137cdf0e10cSrcweir     throw (RuntimeException)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
140cdf0e10cSrcweir     IsValid();
141cdf0e10cSrcweir     Reference< XAccessible > xRet;
142cdf0e10cSrcweir     if( meBorder == FRAMEBORDER_NONE )
143cdf0e10cSrcweir         xRet = mpFrameSel->GetChildAccessible( i );
144cdf0e10cSrcweir     if( !xRet.is() )
145cdf0e10cSrcweir         throw RuntimeException();
146cdf0e10cSrcweir     return xRet;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // ----------------------------------------------------------------------------
150cdf0e10cSrcweir 
151cdf0e10cSrcweir Reference< XAccessible > AccFrameSelector::getAccessibleParent(  )
152cdf0e10cSrcweir     throw (RuntimeException)
153cdf0e10cSrcweir {
154cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
155cdf0e10cSrcweir     IsValid();
156cdf0e10cSrcweir     Reference< XAccessible > xRet;
157cdf0e10cSrcweir     if(meBorder == FRAMEBORDER_NONE)
158cdf0e10cSrcweir         xRet = mpFrameSel->GetParent()->GetAccessible( sal_True );
159cdf0e10cSrcweir     else
160cdf0e10cSrcweir         xRet = mpFrameSel->CreateAccessible();
161cdf0e10cSrcweir     return xRet;
162cdf0e10cSrcweir }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir // ----------------------------------------------------------------------------
165cdf0e10cSrcweir 
166cdf0e10cSrcweir sal_Int32 AccFrameSelector::getAccessibleIndexInParent(  )
167cdf0e10cSrcweir     throw (RuntimeException)
168cdf0e10cSrcweir {
169cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
170cdf0e10cSrcweir     IsValid();
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     sal_Int32 nIdx = 0;
173cdf0e10cSrcweir     if( meBorder == FRAMEBORDER_NONE )
174cdf0e10cSrcweir     {
175cdf0e10cSrcweir         Window* pTabPage = mpFrameSel->GetParent();
176cdf0e10cSrcweir         sal_Int32 nChildren = pTabPage->GetChildCount();
177cdf0e10cSrcweir         for( nIdx = 0; nIdx < nChildren; ++nIdx )
178cdf0e10cSrcweir             if( pTabPage->GetChild( static_cast< sal_uInt16 >( nIdx ) ) == mpFrameSel )
179cdf0e10cSrcweir                 break;
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir     else
182cdf0e10cSrcweir         nIdx = mpFrameSel->GetEnabledBorderIndex( meBorder );
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     if( nIdx < 0 )
185cdf0e10cSrcweir         throw RuntimeException();
186cdf0e10cSrcweir     return nIdx;
187cdf0e10cSrcweir }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir // ----------------------------------------------------------------------------
190cdf0e10cSrcweir 
191cdf0e10cSrcweir sal_Int16 AccFrameSelector::getAccessibleRole(  ) throw (RuntimeException)
192cdf0e10cSrcweir {
193*9b8096d0SSteve Yin     // return AccessibleRole::OPTION_PANE;
194*9b8096d0SSteve Yin 	//IAccessibility2 Implementation 2009-----
195*9b8096d0SSteve Yin 	return meBorder == FRAMEBORDER_NONE ? AccessibleRole::OPTION_PANE : AccessibleRole::CHECK_BOX;
196*9b8096d0SSteve Yin 	//-----IAccessibility2 Implementation 2009
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // ----------------------------------------------------------------------------
200cdf0e10cSrcweir 
201cdf0e10cSrcweir OUString AccFrameSelector::getAccessibleDescription(  )
202cdf0e10cSrcweir     throw (RuntimeException)
203cdf0e10cSrcweir {
204cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
205cdf0e10cSrcweir     IsValid();
206cdf0e10cSrcweir     return maDescriptions.GetString(meBorder);
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir // ----------------------------------------------------------------------------
210cdf0e10cSrcweir 
211cdf0e10cSrcweir OUString AccFrameSelector::getAccessibleName(  )
212cdf0e10cSrcweir     throw (RuntimeException)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
215cdf0e10cSrcweir     IsValid();
216cdf0e10cSrcweir     return maNames.GetString(meBorder);
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir // ----------------------------------------------------------------------------
220cdf0e10cSrcweir 
221cdf0e10cSrcweir Reference< XAccessibleRelationSet > AccFrameSelector::getAccessibleRelationSet(  )
222cdf0e10cSrcweir     throw (RuntimeException)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
225cdf0e10cSrcweir     IsValid();
226cdf0e10cSrcweir     utl::AccessibleRelationSetHelper* pHelper;
227cdf0e10cSrcweir     Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper;
228*9b8096d0SSteve Yin     //if(meBorder == FRAMEBORDER_NONE)
229*9b8096d0SSteve Yin     //{
230*9b8096d0SSteve Yin     //    //add the label relation
231*9b8096d0SSteve Yin     //    Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
232*9b8096d0SSteve Yin     //    if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
233*9b8096d0SSteve Yin     //    {
234*9b8096d0SSteve Yin     //        AccessibleRelation aLabelRelation;
235*9b8096d0SSteve Yin     //        aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
236*9b8096d0SSteve Yin     //        aLabelRelation.TargetSet.realloc(1);
237*9b8096d0SSteve Yin     //        aLabelRelation.TargetSet.getArray()[0]  = pPrev->GetAccessible();
238*9b8096d0SSteve Yin     //        pHelper->AddRelation(aLabelRelation);
239*9b8096d0SSteve Yin     //    }
240*9b8096d0SSteve Yin     //}
241*9b8096d0SSteve Yin 	//IAccessibility2 Implementation 2009-----
242cdf0e10cSrcweir     if(meBorder == FRAMEBORDER_NONE)
243cdf0e10cSrcweir     {
244cdf0e10cSrcweir         //add the label relation
245*9b8096d0SSteve Yin 		Window *pLabeledBy = mpFrameSel->GetAccessibleRelationLabeledBy();
246*9b8096d0SSteve Yin 		if ( pLabeledBy && pLabeledBy != mpFrameSel )
247*9b8096d0SSteve Yin 		{
248*9b8096d0SSteve Yin 			AccessibleRelation aLabelRelation;
249cdf0e10cSrcweir             aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
250cdf0e10cSrcweir             aLabelRelation.TargetSet.realloc(1);
251*9b8096d0SSteve Yin             aLabelRelation.TargetSet.getArray()[0]  = pLabeledBy->GetAccessible();
252cdf0e10cSrcweir             pHelper->AddRelation(aLabelRelation);
253*9b8096d0SSteve Yin 		}
254*9b8096d0SSteve Yin 		Window* pMemberOf = mpFrameSel->GetAccessibleRelationMemberOf();
255*9b8096d0SSteve Yin 		if ( pMemberOf && pMemberOf != mpFrameSel )
256*9b8096d0SSteve Yin 		{
257*9b8096d0SSteve Yin 			AccessibleRelation aMemberOfRelation;
258*9b8096d0SSteve Yin             aMemberOfRelation.RelationType = AccessibleRelationType::MEMBER_OF;
259*9b8096d0SSteve Yin             aMemberOfRelation.TargetSet.realloc(1);
260*9b8096d0SSteve Yin             aMemberOfRelation.TargetSet.getArray()[0]  = pMemberOf->GetAccessible();
261*9b8096d0SSteve Yin             pHelper->AddRelation(aMemberOfRelation);
262*9b8096d0SSteve Yin 		}
263cdf0e10cSrcweir     }
264*9b8096d0SSteve Yin 	//-----IAccessibility2 Implementation 2009
265cdf0e10cSrcweir     return xRet;
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir // ----------------------------------------------------------------------------
269cdf0e10cSrcweir 
270cdf0e10cSrcweir Reference< XAccessibleStateSet > AccFrameSelector::getAccessibleStateSet(  )
271cdf0e10cSrcweir     throw (RuntimeException)
272cdf0e10cSrcweir {
273cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
274cdf0e10cSrcweir     utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
275cdf0e10cSrcweir     Reference< XAccessibleStateSet > xRet = pStateSetHelper;
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     if(!mpFrameSel)
278cdf0e10cSrcweir         pStateSetHelper->AddState(AccessibleStateType::DEFUNC);
279cdf0e10cSrcweir     else
280cdf0e10cSrcweir     {
281cdf0e10cSrcweir         const sal_Int16 aStandardStates[] =
282cdf0e10cSrcweir         {
283cdf0e10cSrcweir             AccessibleStateType::EDITABLE,
284cdf0e10cSrcweir             AccessibleStateType::FOCUSABLE,
285cdf0e10cSrcweir             AccessibleStateType::MULTI_SELECTABLE,
286cdf0e10cSrcweir             AccessibleStateType::SELECTABLE,
287cdf0e10cSrcweir             AccessibleStateType::SHOWING,
288cdf0e10cSrcweir             AccessibleStateType::VISIBLE,
289cdf0e10cSrcweir             AccessibleStateType::OPAQUE,
290cdf0e10cSrcweir             0};
291cdf0e10cSrcweir         sal_Int16 nState = 0;
292cdf0e10cSrcweir         while(aStandardStates[nState])
293cdf0e10cSrcweir         {
294cdf0e10cSrcweir             pStateSetHelper->AddState(aStandardStates[nState++]);
295cdf0e10cSrcweir         }
296cdf0e10cSrcweir         if(mpFrameSel->IsEnabled())
297cdf0e10cSrcweir         {
298cdf0e10cSrcweir             pStateSetHelper->AddState(AccessibleStateType::ENABLED);
299cdf0e10cSrcweir             pStateSetHelper->AddState(AccessibleStateType::SENSITIVE);
300cdf0e10cSrcweir         }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir         sal_Bool bIsParent = meBorder == FRAMEBORDER_NONE;
303cdf0e10cSrcweir         if(mpFrameSel->HasFocus() &&
304cdf0e10cSrcweir             (bIsParent || mpFrameSel->IsBorderSelected(meBorder)))
305cdf0e10cSrcweir         {
306cdf0e10cSrcweir             pStateSetHelper->AddState(AccessibleStateType::ACTIVE);
307cdf0e10cSrcweir             pStateSetHelper->AddState(AccessibleStateType::FOCUSED);
308cdf0e10cSrcweir             pStateSetHelper->AddState(AccessibleStateType::SELECTED);
309cdf0e10cSrcweir         }
310cdf0e10cSrcweir     }
311cdf0e10cSrcweir     return xRet;
312cdf0e10cSrcweir }
313cdf0e10cSrcweir 
314cdf0e10cSrcweir // ----------------------------------------------------------------------------
315cdf0e10cSrcweir 
316cdf0e10cSrcweir Locale AccFrameSelector::getLocale(  )
317cdf0e10cSrcweir     throw (IllegalAccessibleComponentStateException, RuntimeException)
318cdf0e10cSrcweir {
319cdf0e10cSrcweir     Locale aRet;
320cdf0e10cSrcweir     SvxLanguageToLocale( aRet, Application::GetSettings().GetUILanguage() );
321cdf0e10cSrcweir     return aRet;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir // ----------------------------------------------------------------------------
325cdf0e10cSrcweir 
326cdf0e10cSrcweir void AccFrameSelector::addPropertyChangeListener(
327cdf0e10cSrcweir     const Reference< XPropertyChangeListener >& xListener )
328cdf0e10cSrcweir         throw (RuntimeException)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir     maPropertyListeners.addInterface( xListener );
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir // ----------------------------------------------------------------------------
334cdf0e10cSrcweir 
335cdf0e10cSrcweir void AccFrameSelector::removePropertyChangeListener( const Reference< XPropertyChangeListener >& xListener )
336cdf0e10cSrcweir     throw (RuntimeException)
337cdf0e10cSrcweir {
338cdf0e10cSrcweir     maPropertyListeners.removeInterface( xListener );
339cdf0e10cSrcweir }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir // ----------------------------------------------------------------------------
342cdf0e10cSrcweir 
343cdf0e10cSrcweir sal_Bool AccFrameSelector::containsPoint( const AwtPoint& aPt )
344cdf0e10cSrcweir     throw (RuntimeException)
345cdf0e10cSrcweir {
346cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
347cdf0e10cSrcweir     IsValid();
348cdf0e10cSrcweir     //aPt is relative to the frame selector
349cdf0e10cSrcweir     return mpFrameSel->ContainsClickPoint( Point( aPt.X, aPt.Y ) );
350cdf0e10cSrcweir }
351cdf0e10cSrcweir 
352cdf0e10cSrcweir // ----------------------------------------------------------------------------
353cdf0e10cSrcweir 
354cdf0e10cSrcweir Reference< XAccessible > AccFrameSelector::getAccessibleAtPoint(
355cdf0e10cSrcweir     const AwtPoint& aPt )
356cdf0e10cSrcweir         throw (RuntimeException)
357cdf0e10cSrcweir {
358cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
359cdf0e10cSrcweir     IsValid();
360cdf0e10cSrcweir     //aPt is relative to the frame selector
361cdf0e10cSrcweir     return mpFrameSel->GetChildAccessible( Point( aPt.X, aPt.Y ) );
362cdf0e10cSrcweir }
363cdf0e10cSrcweir 
364cdf0e10cSrcweir AwtRectangle AccFrameSelector::getBounds(  ) throw (RuntimeException)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
367cdf0e10cSrcweir     IsValid();
368cdf0e10cSrcweir     Size aSz;
369cdf0e10cSrcweir     Point aPos;
370cdf0e10cSrcweir     switch(meBorder)
371cdf0e10cSrcweir     {
372cdf0e10cSrcweir         case FRAMEBORDER_NONE:
373cdf0e10cSrcweir             aSz = mpFrameSel->GetSizePixel();
374cdf0e10cSrcweir             aPos = mpFrameSel->GetPosPixel();
375cdf0e10cSrcweir         break;
376cdf0e10cSrcweir         default:
377cdf0e10cSrcweir             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
378cdf0e10cSrcweir             aPos = aSpot.TopLeft();
379cdf0e10cSrcweir             aSz = aSpot.GetSize();
380cdf0e10cSrcweir     }
381cdf0e10cSrcweir     AwtRectangle aRet;
382cdf0e10cSrcweir     aRet.X = aPos.X();
383cdf0e10cSrcweir     aRet.Y = aPos.Y();
384cdf0e10cSrcweir     aRet.Width = aSz.Width();
385cdf0e10cSrcweir     aRet.Height = aSz.Height();
386cdf0e10cSrcweir     return aRet;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir // ----------------------------------------------------------------------------
390cdf0e10cSrcweir 
391cdf0e10cSrcweir AwtPoint AccFrameSelector::getLocation(  ) throw (RuntimeException)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
394cdf0e10cSrcweir     IsValid();
395cdf0e10cSrcweir     Point aPos;
396cdf0e10cSrcweir     switch(meBorder)
397cdf0e10cSrcweir     {
398cdf0e10cSrcweir         case FRAMEBORDER_NONE:
399cdf0e10cSrcweir             aPos = mpFrameSel->GetPosPixel();
400cdf0e10cSrcweir         break;
401cdf0e10cSrcweir         default:
402cdf0e10cSrcweir             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
403cdf0e10cSrcweir             aPos = aSpot.TopLeft();
404cdf0e10cSrcweir     }
405cdf0e10cSrcweir     AwtPoint aRet(aPos.X(), aPos.Y());
406cdf0e10cSrcweir     return aRet;
407cdf0e10cSrcweir }
408cdf0e10cSrcweir 
409cdf0e10cSrcweir // ----------------------------------------------------------------------------
410cdf0e10cSrcweir 
411cdf0e10cSrcweir AwtPoint AccFrameSelector::getLocationOnScreen(  ) throw (RuntimeException)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
414cdf0e10cSrcweir     IsValid();
415cdf0e10cSrcweir     Point aPos;
416cdf0e10cSrcweir     switch(meBorder)
417cdf0e10cSrcweir     {
418cdf0e10cSrcweir         case FRAMEBORDER_NONE:
419cdf0e10cSrcweir             aPos = mpFrameSel->GetPosPixel();
420cdf0e10cSrcweir         break;
421cdf0e10cSrcweir         default:
422cdf0e10cSrcweir             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
423cdf0e10cSrcweir             aPos = aSpot.TopLeft();
424cdf0e10cSrcweir     }
425cdf0e10cSrcweir     aPos = mpFrameSel->OutputToAbsoluteScreenPixel( aPos );
426cdf0e10cSrcweir     AwtPoint aRet(aPos.X(), aPos.Y());
427cdf0e10cSrcweir     return aRet;
428cdf0e10cSrcweir }
429cdf0e10cSrcweir 
430cdf0e10cSrcweir // ----------------------------------------------------------------------------
431cdf0e10cSrcweir 
432cdf0e10cSrcweir AwtSize AccFrameSelector::getSize(  ) throw (RuntimeException)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
435cdf0e10cSrcweir     IsValid();
436cdf0e10cSrcweir     Size aSz;
437cdf0e10cSrcweir     switch(meBorder)
438cdf0e10cSrcweir     {
439cdf0e10cSrcweir         case FRAMEBORDER_NONE:
440cdf0e10cSrcweir             aSz = mpFrameSel->GetSizePixel();
441cdf0e10cSrcweir         break;
442cdf0e10cSrcweir         default:
443cdf0e10cSrcweir             const Rectangle aSpot = mpFrameSel->GetClickBoundRect( meBorder );
444cdf0e10cSrcweir             aSz = aSpot.GetSize();
445cdf0e10cSrcweir     }
446cdf0e10cSrcweir     AwtSize aRet(aSz.Width(), aSz.Height());
447cdf0e10cSrcweir     return aRet;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir // ----------------------------------------------------------------------------
451cdf0e10cSrcweir 
452cdf0e10cSrcweir sal_Bool AccFrameSelector::isShowing(  ) throw (RuntimeException)
453cdf0e10cSrcweir {
454cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
455cdf0e10cSrcweir     IsValid();
456cdf0e10cSrcweir     return sal_True;
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
459cdf0e10cSrcweir // ----------------------------------------------------------------------------
460cdf0e10cSrcweir 
461cdf0e10cSrcweir sal_Bool AccFrameSelector::isVisible(  ) throw (RuntimeException)
462cdf0e10cSrcweir {
463cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
464cdf0e10cSrcweir     IsValid();
465cdf0e10cSrcweir     return sal_True;
466cdf0e10cSrcweir }
467cdf0e10cSrcweir 
468cdf0e10cSrcweir // ----------------------------------------------------------------------------
469cdf0e10cSrcweir 
470cdf0e10cSrcweir sal_Bool AccFrameSelector::isFocusTraversable(  ) throw (RuntimeException)
471cdf0e10cSrcweir {
472cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
473cdf0e10cSrcweir     IsValid();
474cdf0e10cSrcweir     return sal_True;
475cdf0e10cSrcweir }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir // ----------------------------------------------------------------------------
478cdf0e10cSrcweir 
479cdf0e10cSrcweir void AccFrameSelector::addFocusListener( const Reference< XFocusListener >& xListener ) throw (RuntimeException)
480cdf0e10cSrcweir {
481cdf0e10cSrcweir     maFocusListeners.addInterface( xListener );
482cdf0e10cSrcweir }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir // ----------------------------------------------------------------------------
485cdf0e10cSrcweir 
486cdf0e10cSrcweir void AccFrameSelector::removeFocusListener( const Reference< XFocusListener >& xListener ) throw (RuntimeException)
487cdf0e10cSrcweir {
488cdf0e10cSrcweir     maFocusListeners.removeInterface( xListener );
489cdf0e10cSrcweir }
490cdf0e10cSrcweir 
491cdf0e10cSrcweir // ----------------------------------------------------------------------------
492cdf0e10cSrcweir 
493cdf0e10cSrcweir void AccFrameSelector::grabFocus(  ) throw (RuntimeException)
494cdf0e10cSrcweir {
495cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
496cdf0e10cSrcweir     IsValid();
497cdf0e10cSrcweir     mpFrameSel->GrabFocus();
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir // ----------------------------------------------------------------------------
501cdf0e10cSrcweir 
502cdf0e10cSrcweir Any AccFrameSelector::getAccessibleKeyBinding(  ) throw (RuntimeException)
503cdf0e10cSrcweir {
504cdf0e10cSrcweir     Any aRet;
505cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
506cdf0e10cSrcweir     IsValid();
507cdf0e10cSrcweir     utl::AccessibleRelationSetHelper* pHelper;
508cdf0e10cSrcweir     Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper;
509cdf0e10cSrcweir     if(meBorder == FRAMEBORDER_NONE)
510cdf0e10cSrcweir     {
511cdf0e10cSrcweir         Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
512cdf0e10cSrcweir         if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
513cdf0e10cSrcweir         {
514cdf0e10cSrcweir             String sText = pPrev->GetText();
515cdf0e10cSrcweir             xub_StrLen nFound = sText.Search( MNEMONIC_CHAR );
516cdf0e10cSrcweir             if(STRING_NOTFOUND != nFound && ++nFound < sText.Len())
517cdf0e10cSrcweir             {
518cdf0e10cSrcweir                 sText.ToUpperAscii();
519cdf0e10cSrcweir                 sal_Unicode cChar = sText.GetChar(nFound);
520cdf0e10cSrcweir                 AwtKeyEvent aEvent;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir                 aEvent.KeyCode = 0;
523cdf0e10cSrcweir                 aEvent.KeyChar = cChar;
524cdf0e10cSrcweir                 aEvent.KeyFunc = 0;
525cdf0e10cSrcweir                 if(cChar >= 'A' && cChar <= 'Z')
526cdf0e10cSrcweir                 {
527cdf0e10cSrcweir                      aEvent.KeyCode = AwtKey::A + cChar - 'A';
528cdf0e10cSrcweir                 }
529cdf0e10cSrcweir                 aEvent.Modifiers = AwtKeyModifier::MOD2;
530cdf0e10cSrcweir                 aRet <<= aEvent;
531cdf0e10cSrcweir             }
532cdf0e10cSrcweir         }
533cdf0e10cSrcweir     }
534cdf0e10cSrcweir     return aRet;
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir // ----------------------------------------------------------------------------
538cdf0e10cSrcweir 
539cdf0e10cSrcweir sal_Int32 AccFrameSelector::getForeground(  )
540cdf0e10cSrcweir         throw (RuntimeException)
541cdf0e10cSrcweir {
542cdf0e10cSrcweir     Any aRet;
543cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
544cdf0e10cSrcweir     IsValid();
545cdf0e10cSrcweir     return mpFrameSel->GetControlForeground().GetColor();
546cdf0e10cSrcweir }
547cdf0e10cSrcweir 
548cdf0e10cSrcweir // ----------------------------------------------------------------------------
549cdf0e10cSrcweir 
550cdf0e10cSrcweir sal_Int32 AccFrameSelector::getBackground(  )
551cdf0e10cSrcweir         throw (RuntimeException)
552cdf0e10cSrcweir {
553cdf0e10cSrcweir     Any aRet;
554cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
555cdf0e10cSrcweir     IsValid();
556cdf0e10cSrcweir     return mpFrameSel->GetControlBackground().GetColor();
557cdf0e10cSrcweir }
558cdf0e10cSrcweir 
559cdf0e10cSrcweir // ----------------------------------------------------------------------------
560cdf0e10cSrcweir 
561cdf0e10cSrcweir void AccFrameSelector::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
562cdf0e10cSrcweir {
563cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
564cdf0e10cSrcweir 
565cdf0e10cSrcweir     if ( xListener.is() )
566cdf0e10cSrcweir     {
567cdf0e10cSrcweir         if ( !mnClientId )
568cdf0e10cSrcweir         {
569cdf0e10cSrcweir             mnClientId = ::comphelper::AccessibleEventNotifier::registerClient();
570cdf0e10cSrcweir         }
571cdf0e10cSrcweir         ::comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
572cdf0e10cSrcweir     }
573cdf0e10cSrcweir }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir // ----------------------------------------------------------------------------
576cdf0e10cSrcweir 
577cdf0e10cSrcweir void AccFrameSelector::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
578cdf0e10cSrcweir {
579cdf0e10cSrcweir     vos::OGuard aGuard( Application::GetSolarMutex() );
580cdf0e10cSrcweir 
581cdf0e10cSrcweir     if ( xListener.is() && mnClientId != 0 &&
582cdf0e10cSrcweir          ::comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ) == 0 )
583cdf0e10cSrcweir     {
584cdf0e10cSrcweir         // no listeners anymore
585cdf0e10cSrcweir         // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
586cdf0e10cSrcweir         // and at least to us not firing any events anymore, in case somebody calls
587cdf0e10cSrcweir         // NotifyAccessibleEvent, again
588cdf0e10cSrcweir         ::comphelper::AccessibleEventNotifier::TClientId nId( mnClientId );
589cdf0e10cSrcweir         mnClientId = 0;
590cdf0e10cSrcweir         ::comphelper::AccessibleEventNotifier::revokeClient( nId );
591cdf0e10cSrcweir     }
592cdf0e10cSrcweir }
593cdf0e10cSrcweir 
594cdf0e10cSrcweir // ----------------------------------------------------------------------------
595cdf0e10cSrcweir 
596cdf0e10cSrcweir OUString AccFrameSelector::getImplementationName(  ) throw (RuntimeException)
597cdf0e10cSrcweir {
598cdf0e10cSrcweir     return OUString::createFromAscii("AccFrameSelector");
599cdf0e10cSrcweir }
600cdf0e10cSrcweir 
601cdf0e10cSrcweir // ----------------------------------------------------------------------------
602cdf0e10cSrcweir 
603cdf0e10cSrcweir const sal_Char sAccessible[]          = "Accessible";
604cdf0e10cSrcweir const sal_Char sAccessibleContext[]   = "AccessibleContext";
605cdf0e10cSrcweir const sal_Char sAccessibleComponent[] = "AccessibleComponent";
606cdf0e10cSrcweir 
607cdf0e10cSrcweir sal_Bool AccFrameSelector::supportsService( const OUString& rServiceName )
608cdf0e10cSrcweir     throw (RuntimeException)
609cdf0e10cSrcweir {
610cdf0e10cSrcweir     return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
611cdf0e10cSrcweir             rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
612cdf0e10cSrcweir             rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );
613cdf0e10cSrcweir }
614cdf0e10cSrcweir 
615cdf0e10cSrcweir // ----------------------------------------------------------------------------
616cdf0e10cSrcweir 
617cdf0e10cSrcweir Sequence< OUString > AccFrameSelector::getSupportedServiceNames(  )
618cdf0e10cSrcweir     throw (RuntimeException)
619cdf0e10cSrcweir {
620cdf0e10cSrcweir     Sequence< OUString > aRet(3);
621cdf0e10cSrcweir 	OUString* pArray = aRet.getArray();
622cdf0e10cSrcweir     pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
623cdf0e10cSrcweir     pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
624cdf0e10cSrcweir     pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
625cdf0e10cSrcweir     return aRet;
626cdf0e10cSrcweir }
627cdf0e10cSrcweir 
628cdf0e10cSrcweir // ----------------------------------------------------------------------------
629cdf0e10cSrcweir 
630cdf0e10cSrcweir void AccFrameSelector::IsValid() throw (RuntimeException)
631cdf0e10cSrcweir {
632cdf0e10cSrcweir     if(!mpFrameSel)
633cdf0e10cSrcweir         throw RuntimeException();
634cdf0e10cSrcweir }
635cdf0e10cSrcweir 
636cdf0e10cSrcweir // ----------------------------------------------------------------------------
637cdf0e10cSrcweir 
638cdf0e10cSrcweir void    AccFrameSelector::NotifyFocusListeners(sal_Bool bGetFocus)
639cdf0e10cSrcweir {
640cdf0e10cSrcweir     vos::OGuard aGuard(Application::GetSolarMutex());
641cdf0e10cSrcweir     AwtFocusEvent aEvent;
642cdf0e10cSrcweir     aEvent.FocusFlags = 0;
643cdf0e10cSrcweir     if(bGetFocus)
644cdf0e10cSrcweir     {
645cdf0e10cSrcweir         sal_uInt16 nFocusFlags = mpFrameSel->GetGetFocusFlags();
646cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_TAB)
647cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::TAB;
648cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_CURSOR)
649cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::CURSOR;
650cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_MNEMONIC)
651cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::MNEMONIC;
652cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_FORWARD)
653cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::FORWARD;
654cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_BACKWARD)
655cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::BACKWARD;
656cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_AROUND)
657cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::AROUND;
658cdf0e10cSrcweir         if(nFocusFlags&GETFOCUS_UNIQUEMNEMONIC)
659cdf0e10cSrcweir             aEvent.FocusFlags |= AwtFocusChangeReason::UNIQUEMNEMONIC;
660cdf0e10cSrcweir     //        if(nFocusFlags&GETFOCUS_INIT)
661cdf0e10cSrcweir     //            aEvent.FocusFlags |= AwtFocusChangeReason::
662cdf0e10cSrcweir     }
663cdf0e10cSrcweir //    else
664cdf0e10cSrcweir     //how can I find the current focus window?
665cdf0e10cSrcweir //        aEvent.NextFocus = ;
666cdf0e10cSrcweir     aEvent.Temporary = sal_False;
667cdf0e10cSrcweir 
668cdf0e10cSrcweir     Reference < XAccessibleContext > xThis( this );
669cdf0e10cSrcweir     aEvent.Source = xThis;
670cdf0e10cSrcweir 
671cdf0e10cSrcweir     ::cppu::OInterfaceIteratorHelper aIter( maFocusListeners );
672cdf0e10cSrcweir 	while( aIter.hasMoreElements() )
673cdf0e10cSrcweir 	{
674cdf0e10cSrcweir         Reference < XFocusListener > xListener( aIter.next(), UNO_QUERY );
675cdf0e10cSrcweir         if(bGetFocus)
676cdf0e10cSrcweir             xListener->focusGained( aEvent );
677cdf0e10cSrcweir         else
678cdf0e10cSrcweir             xListener->focusLost( aEvent );
679cdf0e10cSrcweir     }
680cdf0e10cSrcweir }
681cdf0e10cSrcweir 
682cdf0e10cSrcweir // ----------------------------------------------------------------------------
683cdf0e10cSrcweir 
684cdf0e10cSrcweir IMPL_LINK( AccFrameSelector, WindowEventListener, VclSimpleEvent*, pEvent )
685cdf0e10cSrcweir {
686cdf0e10cSrcweir     VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
687cdf0e10cSrcweir     DBG_ASSERT( pWinEvent, "AccFrameSelector::WindowEventListener - unknown window event" );
688cdf0e10cSrcweir     if ( pWinEvent )
689cdf0e10cSrcweir     {
690cdf0e10cSrcweir         Window* pWindow = pWinEvent->GetWindow();
691cdf0e10cSrcweir         DBG_ASSERT( pWindow, "AccFrameSelector::WindowEventListener: no window!" );
692cdf0e10cSrcweir         if ( !pWindow->IsAccessibilityEventsSuppressed() || ( pWinEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
693cdf0e10cSrcweir         {
694cdf0e10cSrcweir             ProcessWindowEvent( *pWinEvent );
695cdf0e10cSrcweir         }
696cdf0e10cSrcweir     }
697cdf0e10cSrcweir 
698cdf0e10cSrcweir     return 0;
699cdf0e10cSrcweir }
700cdf0e10cSrcweir 
701cdf0e10cSrcweir // ----------------------------------------------------------------------------
702cdf0e10cSrcweir 
703cdf0e10cSrcweir void AccFrameSelector::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
704cdf0e10cSrcweir {
705cdf0e10cSrcweir     switch ( rVclWindowEvent.GetId() )
706cdf0e10cSrcweir     {
707cdf0e10cSrcweir 		case VCLEVENT_WINDOW_GETFOCUS:
708cdf0e10cSrcweir 		{
709cdf0e10cSrcweir             if ( meBorder == FRAMEBORDER_NONE )
710cdf0e10cSrcweir             {
711cdf0e10cSrcweir                 Any aOldValue, aNewValue;
712cdf0e10cSrcweir                 aNewValue <<= AccessibleStateType::FOCUSED;
713cdf0e10cSrcweir                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
714cdf0e10cSrcweir             }
715cdf0e10cSrcweir 		}
716cdf0e10cSrcweir 		break;
717cdf0e10cSrcweir 		case VCLEVENT_WINDOW_LOSEFOCUS:
718cdf0e10cSrcweir 		{
719cdf0e10cSrcweir             if ( meBorder == FRAMEBORDER_NONE )
720cdf0e10cSrcweir             {
721cdf0e10cSrcweir                 Any aOldValue, aNewValue;
722cdf0e10cSrcweir                 aOldValue <<= AccessibleStateType::FOCUSED;
723cdf0e10cSrcweir                 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
724cdf0e10cSrcweir             }
725cdf0e10cSrcweir 		}
726cdf0e10cSrcweir 		break;
727cdf0e10cSrcweir         default:
728cdf0e10cSrcweir 		{
729cdf0e10cSrcweir 		}
730cdf0e10cSrcweir 		break;
731cdf0e10cSrcweir 	}
732cdf0e10cSrcweir }
733cdf0e10cSrcweir 
734cdf0e10cSrcweir // ----------------------------------------------------------------------------
735cdf0e10cSrcweir 
736cdf0e10cSrcweir void AccFrameSelector::NotifyAccessibleEvent( const sal_Int16 _nEventId,
737cdf0e10cSrcweir     const Any& _rOldValue, const Any& _rNewValue )
738cdf0e10cSrcweir {
739cdf0e10cSrcweir     if ( mnClientId )
740cdf0e10cSrcweir     {
741cdf0e10cSrcweir         Reference< XInterface > xSource( *this );
742cdf0e10cSrcweir         AccessibleEventObject aEvent( xSource, _nEventId, _rNewValue, _rOldValue );
743cdf0e10cSrcweir         ::comphelper::AccessibleEventNotifier::addEvent( mnClientId, aEvent );
744cdf0e10cSrcweir     }
745cdf0e10cSrcweir }
746cdf0e10cSrcweir 
747cdf0e10cSrcweir // ----------------------------------------------------------------------------
748cdf0e10cSrcweir 
749cdf0e10cSrcweir void AccFrameSelector::Invalidate()
750cdf0e10cSrcweir {
751*9b8096d0SSteve Yin 	if ( mpFrameSel )
752*9b8096d0SSteve Yin     {
753*9b8096d0SSteve Yin         mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
754*9b8096d0SSteve Yin     }
755cdf0e10cSrcweir     mpFrameSel = 0;
756cdf0e10cSrcweir     EventObject aEvent;
757cdf0e10cSrcweir     Reference < XAccessibleContext > xThis( this );
758cdf0e10cSrcweir 	aEvent.Source = xThis;
759cdf0e10cSrcweir     maFocusListeners.disposeAndClear( aEvent );
760cdf0e10cSrcweir     maPropertyListeners.disposeAndClear( aEvent );
761cdf0e10cSrcweir }
762cdf0e10cSrcweir 
763cdf0e10cSrcweir // ============================================================================
764cdf0e10cSrcweir 
765cdf0e10cSrcweir } // namespace a11y
766cdf0e10cSrcweir } // namespace svx
767cdf0e10cSrcweir 
768