15900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file
55900e8ecSAndrew Rist * distributed with this work for additional information
65900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file
75900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the
85900e8ecSAndrew Rist * "License"); you may not use this file except in compliance
95900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at
105900e8ecSAndrew Rist *
115900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125900e8ecSAndrew Rist *
135900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing,
145900e8ecSAndrew Rist * software distributed under the License is distributed on an
155900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165900e8ecSAndrew Rist * KIND, either express or implied. See the License for the
175900e8ecSAndrew Rist * specific language governing permissions and limitations
185900e8ecSAndrew Rist * under the License.
195900e8ecSAndrew Rist *
205900e8ecSAndrew Rist *************************************************************/
215900e8ecSAndrew Rist
225900e8ecSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #define _SV_VALUESET_CXX
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
30cdf0e10cSrcweir #include <vcl/svapp.hxx>
31cdf0e10cSrcweir #include <svtools/valueset.hxx>
32cdf0e10cSrcweir #include "valueimp.hxx"
33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp>
34cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
35cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
36cdf0e10cSrcweir
37*2bfcd321SSteve Yin #include <com/sun/star/accessibility/AccessibleEventId.hpp>
38*2bfcd321SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
39*2bfcd321SSteve Yin #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
40*2bfcd321SSteve Yin #endif
41*2bfcd321SSteve Yin #ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
42*2bfcd321SSteve Yin #include <unotools/accessiblerelationsethelper.hxx>
43*2bfcd321SSteve Yin #endif
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir
46cdf0e10cSrcweir // ----------------
47cdf0e10cSrcweir // - ValueSetItem -
48cdf0e10cSrcweir // ----------------
49cdf0e10cSrcweir
ValueSetItem(ValueSet & rParent)50cdf0e10cSrcweir ValueSetItem::ValueSetItem( ValueSet& rParent ) :
51cdf0e10cSrcweir mrParent( rParent ),
52cdf0e10cSrcweir mnId( 0 ),
53cdf0e10cSrcweir mnBits( 0 ),
54cdf0e10cSrcweir mpData( NULL ),
55cdf0e10cSrcweir mpxAcc( NULL )
56cdf0e10cSrcweir {
57cdf0e10cSrcweir }
58cdf0e10cSrcweir
59cdf0e10cSrcweir // -----------------------------------------------------------------------
60cdf0e10cSrcweir
~ValueSetItem()61cdf0e10cSrcweir ValueSetItem::~ValueSetItem()
62cdf0e10cSrcweir {
63cdf0e10cSrcweir if( mpxAcc )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed();
66cdf0e10cSrcweir delete mpxAcc;
67cdf0e10cSrcweir }
68cdf0e10cSrcweir }
69cdf0e10cSrcweir
70cdf0e10cSrcweir // -----------------------------------------------------------------------
71cdf0e10cSrcweir
GetAccessible(bool bIsTransientChildrenDisabled)72cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir if( !mpxAcc )
75cdf0e10cSrcweir mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this, bIsTransientChildrenDisabled ) );
76cdf0e10cSrcweir
77cdf0e10cSrcweir return *mpxAcc;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
80cdf0e10cSrcweir // -----------------------------------------------------------------------
81cdf0e10cSrcweir
ClearAccessible()82cdf0e10cSrcweir void ValueSetItem::ClearAccessible()
83cdf0e10cSrcweir {
84cdf0e10cSrcweir if( mpxAcc )
85cdf0e10cSrcweir delete mpxAcc, mpxAcc = NULL;
86cdf0e10cSrcweir }
87cdf0e10cSrcweir
88cdf0e10cSrcweir
89cdf0e10cSrcweir // ---------------
90cdf0e10cSrcweir // - ValueSetAcc -
91cdf0e10cSrcweir // ---------------
92cdf0e10cSrcweir
ValueSetAcc(ValueSet * pParent,bool bIsTransientChildrenDisabled)93cdf0e10cSrcweir ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) :
94cdf0e10cSrcweir ValueSetAccComponentBase (m_aMutex),
95cdf0e10cSrcweir mpParent( pParent ),
96cdf0e10cSrcweir mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ),
97cdf0e10cSrcweir mbIsFocused(false)
98cdf0e10cSrcweir {
99cdf0e10cSrcweir }
100cdf0e10cSrcweir
101cdf0e10cSrcweir // -----------------------------------------------------------------------------
102cdf0e10cSrcweir
~ValueSetAcc()103cdf0e10cSrcweir ValueSetAcc::~ValueSetAcc()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir }
106cdf0e10cSrcweir
107cdf0e10cSrcweir // -----------------------------------------------------------------------
108cdf0e10cSrcweir
FireAccessibleEvent(short nEventId,const uno::Any & rOldValue,const uno::Any & rNewValue)109cdf0e10cSrcweir void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir if( nEventId )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners );
114cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() );
115cdf0e10cSrcweir accessibility::AccessibleEventObject aEvtObject;
116cdf0e10cSrcweir
117cdf0e10cSrcweir aEvtObject.EventId = nEventId;
118cdf0e10cSrcweir aEvtObject.Source = static_cast<uno::XWeak*>(this);
119cdf0e10cSrcweir aEvtObject.NewValue = rNewValue;
120cdf0e10cSrcweir aEvtObject.OldValue = rOldValue;
121cdf0e10cSrcweir
122cdf0e10cSrcweir while( aIter != aTmpListeners.end() )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir try
125cdf0e10cSrcweir {
126cdf0e10cSrcweir (*aIter)->notifyEvent( aEvtObject );
127cdf0e10cSrcweir }
128cdf0e10cSrcweir catch( uno::Exception& )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir }
131cdf0e10cSrcweir
132cdf0e10cSrcweir aIter++;
133cdf0e10cSrcweir }
134cdf0e10cSrcweir }
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir // -----------------------------------------------------------------------------
138cdf0e10cSrcweir
getUnoTunnelId()139cdf0e10cSrcweir const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId()
140cdf0e10cSrcweir {
141cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq;
142cdf0e10cSrcweir
143cdf0e10cSrcweir if( !aSeq.getLength() )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir static osl::Mutex aCreateMutex;
146cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( aCreateMutex );
147cdf0e10cSrcweir
148cdf0e10cSrcweir aSeq.realloc( 16 );
149cdf0e10cSrcweir rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
150cdf0e10cSrcweir }
151cdf0e10cSrcweir
152cdf0e10cSrcweir return aSeq;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
155cdf0e10cSrcweir // -----------------------------------------------------------------------------
156cdf0e10cSrcweir
getImplementation(const uno::Reference<uno::XInterface> & rxData)157cdf0e10cSrcweir ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
158cdf0e10cSrcweir throw()
159cdf0e10cSrcweir {
160cdf0e10cSrcweir try
161cdf0e10cSrcweir {
162cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
163cdf0e10cSrcweir return( xUnoTunnel.is() ? reinterpret_cast<ValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ))) : NULL );
164cdf0e10cSrcweir }
165cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& )
166cdf0e10cSrcweir {
167cdf0e10cSrcweir return NULL;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir }
170cdf0e10cSrcweir
171cdf0e10cSrcweir
172cdf0e10cSrcweir // -----------------------------------------------------------------------------
173cdf0e10cSrcweir
GetFocus(void)174cdf0e10cSrcweir void ValueSetAcc::GetFocus (void)
175cdf0e10cSrcweir {
176cdf0e10cSrcweir mbIsFocused = true;
177cdf0e10cSrcweir
178cdf0e10cSrcweir // Boradcast the state change.
179cdf0e10cSrcweir ::com::sun::star::uno::Any aOldState, aNewState;
180cdf0e10cSrcweir aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
181cdf0e10cSrcweir FireAccessibleEvent(
182cdf0e10cSrcweir ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
183cdf0e10cSrcweir aOldState, aNewState);
184cdf0e10cSrcweir }
185cdf0e10cSrcweir
186cdf0e10cSrcweir // -----------------------------------------------------------------------------
187cdf0e10cSrcweir
LoseFocus(void)188cdf0e10cSrcweir void ValueSetAcc::LoseFocus (void)
189cdf0e10cSrcweir {
190cdf0e10cSrcweir mbIsFocused = false;
191cdf0e10cSrcweir
192cdf0e10cSrcweir // Boradcast the state change.
193cdf0e10cSrcweir ::com::sun::star::uno::Any aOldState, aNewState;
194cdf0e10cSrcweir aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
195cdf0e10cSrcweir FireAccessibleEvent(
196cdf0e10cSrcweir ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
197cdf0e10cSrcweir aOldState, aNewState);
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir // -----------------------------------------------------------------------------
201cdf0e10cSrcweir
getAccessibleContext()202cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext()
203cdf0e10cSrcweir throw (uno::RuntimeException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir ThrowIfDisposed();
206cdf0e10cSrcweir return this;
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
209cdf0e10cSrcweir // -----------------------------------------------------------------------------
210cdf0e10cSrcweir
getAccessibleChildCount()211cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getAccessibleChildCount()
212cdf0e10cSrcweir throw (uno::RuntimeException)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
215cdf0e10cSrcweir ThrowIfDisposed();
216cdf0e10cSrcweir
217cdf0e10cSrcweir sal_Int32 nCount = mpParent->ImplGetVisibleItemCount();
218cdf0e10cSrcweir if (HasNoneField())
219cdf0e10cSrcweir nCount += 1;
220cdf0e10cSrcweir return nCount;
221cdf0e10cSrcweir }
222cdf0e10cSrcweir
223cdf0e10cSrcweir // -----------------------------------------------------------------------------
224cdf0e10cSrcweir
getAccessibleChild(sal_Int32 i)225cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleChild( sal_Int32 i )
226cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
227cdf0e10cSrcweir {
228cdf0e10cSrcweir ThrowIfDisposed();
229cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
230cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
231cdf0e10cSrcweir ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i));
232cdf0e10cSrcweir
233cdf0e10cSrcweir if( pItem )
234cdf0e10cSrcweir xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
235cdf0e10cSrcweir else
236cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
237cdf0e10cSrcweir
238cdf0e10cSrcweir return xRet;
239cdf0e10cSrcweir }
240cdf0e10cSrcweir
241cdf0e10cSrcweir // -----------------------------------------------------------------------------
242cdf0e10cSrcweir
getAccessibleParent()243cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleParent()
244cdf0e10cSrcweir throw (uno::RuntimeException)
245cdf0e10cSrcweir {
246cdf0e10cSrcweir ThrowIfDisposed();
247cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
248cdf0e10cSrcweir Window* pParent = mpParent->GetParent();
249cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
250cdf0e10cSrcweir
251cdf0e10cSrcweir if( pParent )
252cdf0e10cSrcweir xRet = pParent->GetAccessible();
253cdf0e10cSrcweir
254cdf0e10cSrcweir return xRet;
255cdf0e10cSrcweir }
256cdf0e10cSrcweir
257cdf0e10cSrcweir // -----------------------------------------------------------------------------
258cdf0e10cSrcweir
getAccessibleIndexInParent()259cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getAccessibleIndexInParent()
260cdf0e10cSrcweir throw (uno::RuntimeException)
261cdf0e10cSrcweir {
262cdf0e10cSrcweir ThrowIfDisposed();
263cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
264cdf0e10cSrcweir Window* pParent = mpParent->GetParent();
265cdf0e10cSrcweir sal_Int32 nRet = 0;
266cdf0e10cSrcweir
267cdf0e10cSrcweir if( pParent )
268cdf0e10cSrcweir {
269cdf0e10cSrcweir sal_Bool bFound = sal_False;
270cdf0e10cSrcweir
271cdf0e10cSrcweir for( sal_uInt16 i = 0, nCount = pParent->GetChildCount(); ( i < nCount ) && !bFound; i++ )
272cdf0e10cSrcweir {
273cdf0e10cSrcweir if( pParent->GetChild( i ) == mpParent )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir nRet = i;
276cdf0e10cSrcweir bFound = sal_True;
277cdf0e10cSrcweir }
278cdf0e10cSrcweir }
279cdf0e10cSrcweir }
280cdf0e10cSrcweir
281cdf0e10cSrcweir return nRet;
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
284cdf0e10cSrcweir // -----------------------------------------------------------------------------
285cdf0e10cSrcweir
getAccessibleRole()286cdf0e10cSrcweir sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole()
287cdf0e10cSrcweir throw (uno::RuntimeException)
288cdf0e10cSrcweir {
289cdf0e10cSrcweir ThrowIfDisposed();
290cdf0e10cSrcweir // #i73746# As the Java Access Bridge (v 2.0.1) uses "managesDescendants"
291cdf0e10cSrcweir // always if the role is LIST, we need a different role in this case
292cdf0e10cSrcweir return (mbIsTransientChildrenDisabled
293cdf0e10cSrcweir ? accessibility::AccessibleRole::PANEL
294cdf0e10cSrcweir : accessibility::AccessibleRole::LIST );
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir // -----------------------------------------------------------------------------
298cdf0e10cSrcweir
getAccessibleDescription()299cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleDescription()
300cdf0e10cSrcweir throw (uno::RuntimeException)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir ThrowIfDisposed();
303cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
304cdf0e10cSrcweir String aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) );
305cdf0e10cSrcweir
306cdf0e10cSrcweir return aRet;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir
309cdf0e10cSrcweir // -----------------------------------------------------------------------------
310cdf0e10cSrcweir
getAccessibleName()311cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleName()
312cdf0e10cSrcweir throw (uno::RuntimeException)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir ThrowIfDisposed();
315cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
316cdf0e10cSrcweir String aRet;
317cdf0e10cSrcweir
318cdf0e10cSrcweir if ( mpParent )
319cdf0e10cSrcweir aRet = mpParent->GetAccessibleName();
320cdf0e10cSrcweir
321cdf0e10cSrcweir if ( !aRet.Len() )
322cdf0e10cSrcweir {
323cdf0e10cSrcweir Window* pLabel = mpParent->GetAccessibleRelationLabeledBy();
324cdf0e10cSrcweir if ( pLabel && pLabel != mpParent )
325cdf0e10cSrcweir aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
326*2bfcd321SSteve Yin
327*2bfcd321SSteve Yin if ( !aRet.Len() )
328*2bfcd321SSteve Yin aRet = mpParent->GetQuickHelpText();
329cdf0e10cSrcweir }
330cdf0e10cSrcweir
331cdf0e10cSrcweir return aRet;
332cdf0e10cSrcweir }
333cdf0e10cSrcweir
334cdf0e10cSrcweir // -----------------------------------------------------------------------------
335cdf0e10cSrcweir
getAccessibleRelationSet()336cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::getAccessibleRelationSet()
337cdf0e10cSrcweir throw (uno::RuntimeException)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir ThrowIfDisposed();
340*2bfcd321SSteve Yin uno::Reference< accessibility::XAccessibleRelationSet > xRelSet;
341*2bfcd321SSteve Yin Window* pWindow = (Window*)mpParent;
342*2bfcd321SSteve Yin if ( pWindow )
343*2bfcd321SSteve Yin {
344*2bfcd321SSteve Yin utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper;
345*2bfcd321SSteve Yin xRelSet = pRelationSet;
346*2bfcd321SSteve Yin
347*2bfcd321SSteve Yin Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
348*2bfcd321SSteve Yin if ( pLabeledBy && pLabeledBy != pWindow )
349*2bfcd321SSteve Yin {
350*2bfcd321SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
351*2bfcd321SSteve Yin aSequence[0] = pLabeledBy->GetAccessible();
352*2bfcd321SSteve Yin pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
353*2bfcd321SSteve Yin }
354*2bfcd321SSteve Yin
355*2bfcd321SSteve Yin Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
356*2bfcd321SSteve Yin if ( pMemberOf && pMemberOf != pWindow )
357*2bfcd321SSteve Yin {
358*2bfcd321SSteve Yin uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
359*2bfcd321SSteve Yin aSequence[0] = pMemberOf->GetAccessible();
360*2bfcd321SSteve Yin pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
361*2bfcd321SSteve Yin }
362*2bfcd321SSteve Yin }
363*2bfcd321SSteve Yin return xRelSet;
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
366cdf0e10cSrcweir // -----------------------------------------------------------------------------
367cdf0e10cSrcweir
getAccessibleStateSet()368cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet()
369cdf0e10cSrcweir throw (uno::RuntimeException)
370cdf0e10cSrcweir {
371cdf0e10cSrcweir ThrowIfDisposed();
372cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
373cdf0e10cSrcweir
374cdf0e10cSrcweir // Set some states.
375cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
376cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
377cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
378cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
379cdf0e10cSrcweir if ( !mbIsTransientChildrenDisabled )
380cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS);
381cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE);
382cdf0e10cSrcweir if (mbIsFocused)
383cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED);
384cdf0e10cSrcweir
385cdf0e10cSrcweir return pStateSet;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
388cdf0e10cSrcweir // -----------------------------------------------------------------------------
389cdf0e10cSrcweir
getLocale()390cdf0e10cSrcweir lang::Locale SAL_CALL ValueSetAcc::getLocale()
391cdf0e10cSrcweir throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir ThrowIfDisposed();
394cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
395cdf0e10cSrcweir const ::rtl::OUString aEmptyStr;
396cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() );
397cdf0e10cSrcweir lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
398cdf0e10cSrcweir
399cdf0e10cSrcweir if( xParent.is() )
400cdf0e10cSrcweir {
401cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
402cdf0e10cSrcweir
403cdf0e10cSrcweir if( xParentContext.is() )
404cdf0e10cSrcweir aRet = xParentContext->getLocale ();
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
407cdf0e10cSrcweir return aRet;
408cdf0e10cSrcweir }
409cdf0e10cSrcweir
410cdf0e10cSrcweir // -----------------------------------------------------------------------------
411cdf0e10cSrcweir
addEventListener(const uno::Reference<accessibility::XAccessibleEventListener> & rxListener)412cdf0e10cSrcweir void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
413cdf0e10cSrcweir throw (uno::RuntimeException)
414cdf0e10cSrcweir {
415cdf0e10cSrcweir ThrowIfDisposed();
416cdf0e10cSrcweir ::osl::MutexGuard aGuard (m_aMutex);
417cdf0e10cSrcweir
418cdf0e10cSrcweir if( rxListener.is() )
419cdf0e10cSrcweir {
420cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
421cdf0e10cSrcweir sal_Bool bFound = sal_False;
422cdf0e10cSrcweir
423cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) )
424cdf0e10cSrcweir {
425cdf0e10cSrcweir if( *aIter == rxListener )
426cdf0e10cSrcweir bFound = sal_True;
427cdf0e10cSrcweir else
428cdf0e10cSrcweir aIter++;
429cdf0e10cSrcweir }
430cdf0e10cSrcweir
431cdf0e10cSrcweir if (!bFound)
432cdf0e10cSrcweir mxEventListeners.push_back( rxListener );
433cdf0e10cSrcweir }
434cdf0e10cSrcweir }
435cdf0e10cSrcweir
436cdf0e10cSrcweir // -----------------------------------------------------------------------------
437cdf0e10cSrcweir
removeEventListener(const uno::Reference<accessibility::XAccessibleEventListener> & rxListener)438cdf0e10cSrcweir void SAL_CALL ValueSetAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
439cdf0e10cSrcweir throw (uno::RuntimeException)
440cdf0e10cSrcweir {
441cdf0e10cSrcweir ThrowIfDisposed();
442cdf0e10cSrcweir ::osl::MutexGuard aGuard (m_aMutex);
443cdf0e10cSrcweir
444cdf0e10cSrcweir if( rxListener.is() )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
447cdf0e10cSrcweir sal_Bool bFound = sal_False;
448cdf0e10cSrcweir
449cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir if( *aIter == rxListener )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir mxEventListeners.erase( aIter );
454cdf0e10cSrcweir bFound = sal_True;
455cdf0e10cSrcweir }
456cdf0e10cSrcweir else
457cdf0e10cSrcweir aIter++;
458cdf0e10cSrcweir }
459cdf0e10cSrcweir }
460cdf0e10cSrcweir }
461cdf0e10cSrcweir
462cdf0e10cSrcweir // -----------------------------------------------------------------------------
463cdf0e10cSrcweir
containsPoint(const awt::Point & aPoint)464cdf0e10cSrcweir sal_Bool SAL_CALL ValueSetAcc::containsPoint( const awt::Point& aPoint )
465cdf0e10cSrcweir throw (uno::RuntimeException)
466cdf0e10cSrcweir {
467cdf0e10cSrcweir ThrowIfDisposed();
468cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() );
469cdf0e10cSrcweir const Point aSize( aRect.Width, aRect.Height );
470cdf0e10cSrcweir const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
471cdf0e10cSrcweir
472cdf0e10cSrcweir return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
473cdf0e10cSrcweir }
474cdf0e10cSrcweir
475cdf0e10cSrcweir // -----------------------------------------------------------------------------
476cdf0e10cSrcweir
getAccessibleAtPoint(const awt::Point & aPoint)477cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
478cdf0e10cSrcweir throw (uno::RuntimeException)
479cdf0e10cSrcweir {
480cdf0e10cSrcweir ThrowIfDisposed();
481cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
482cdf0e10cSrcweir const sal_uInt16 nItemId = mpParent->GetItemId( Point( aPoint.X, aPoint.Y ) );
483cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
484cdf0e10cSrcweir
485cdf0e10cSrcweir if( VALUESET_ITEM_NOTFOUND != nItemId )
486cdf0e10cSrcweir {
487cdf0e10cSrcweir const sal_uInt16 nItemPos = mpParent->GetItemPos( nItemId );
488cdf0e10cSrcweir
489cdf0e10cSrcweir if( VALUESET_ITEM_NONEITEM != nItemPos )
490cdf0e10cSrcweir {
491cdf0e10cSrcweir ValueSetItem* pItem = mpParent->mpImpl->mpItemList->GetObject( nItemPos );
492cdf0e10cSrcweir
493cdf0e10cSrcweir if( ( pItem->meType != VALUESETITEM_SPACE ) && !pItem->maRect.IsEmpty() )
494cdf0e10cSrcweir xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
495cdf0e10cSrcweir }
496cdf0e10cSrcweir }
497cdf0e10cSrcweir
498cdf0e10cSrcweir return xRet;
499cdf0e10cSrcweir }
500cdf0e10cSrcweir
501cdf0e10cSrcweir // -----------------------------------------------------------------------------
502cdf0e10cSrcweir
getBounds()503cdf0e10cSrcweir awt::Rectangle SAL_CALL ValueSetAcc::getBounds()
504cdf0e10cSrcweir throw (uno::RuntimeException)
505cdf0e10cSrcweir {
506cdf0e10cSrcweir ThrowIfDisposed();
507cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
508cdf0e10cSrcweir const Point aOutPos( mpParent->GetPosPixel() );
509cdf0e10cSrcweir const Size aOutSize( mpParent->GetOutputSizePixel() );
510cdf0e10cSrcweir awt::Rectangle aRet;
511cdf0e10cSrcweir
512cdf0e10cSrcweir aRet.X = aOutPos.X();
513cdf0e10cSrcweir aRet.Y = aOutPos.Y();
514cdf0e10cSrcweir aRet.Width = aOutSize.Width();
515cdf0e10cSrcweir aRet.Height = aOutSize.Height();
516cdf0e10cSrcweir
517cdf0e10cSrcweir return aRet;
518cdf0e10cSrcweir }
519cdf0e10cSrcweir
520cdf0e10cSrcweir // -----------------------------------------------------------------------------
521cdf0e10cSrcweir
getLocation()522cdf0e10cSrcweir awt::Point SAL_CALL ValueSetAcc::getLocation()
523cdf0e10cSrcweir throw (uno::RuntimeException)
524cdf0e10cSrcweir {
525cdf0e10cSrcweir ThrowIfDisposed();
526cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() );
527cdf0e10cSrcweir awt::Point aRet;
528cdf0e10cSrcweir
529cdf0e10cSrcweir aRet.X = aRect.X;
530cdf0e10cSrcweir aRet.Y = aRect.Y;
531cdf0e10cSrcweir
532cdf0e10cSrcweir return aRet;
533cdf0e10cSrcweir }
534cdf0e10cSrcweir
535cdf0e10cSrcweir // -----------------------------------------------------------------------------
536cdf0e10cSrcweir
getLocationOnScreen()537cdf0e10cSrcweir awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen()
538cdf0e10cSrcweir throw (uno::RuntimeException)
539cdf0e10cSrcweir {
540cdf0e10cSrcweir ThrowIfDisposed();
541cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
542cdf0e10cSrcweir const Point aScreenPos( mpParent->OutputToAbsoluteScreenPixel( Point() ) );
543cdf0e10cSrcweir awt::Point aRet;
544cdf0e10cSrcweir
545cdf0e10cSrcweir aRet.X = aScreenPos.X();
546cdf0e10cSrcweir aRet.Y = aScreenPos.Y();
547cdf0e10cSrcweir
548cdf0e10cSrcweir return aRet;
549cdf0e10cSrcweir }
550cdf0e10cSrcweir
551cdf0e10cSrcweir // -----------------------------------------------------------------------------
552cdf0e10cSrcweir
getSize()553cdf0e10cSrcweir awt::Size SAL_CALL ValueSetAcc::getSize()
554cdf0e10cSrcweir throw (uno::RuntimeException)
555cdf0e10cSrcweir {
556cdf0e10cSrcweir ThrowIfDisposed();
557cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() );
558cdf0e10cSrcweir awt::Size aRet;
559cdf0e10cSrcweir
560cdf0e10cSrcweir aRet.Width = aRect.Width;
561cdf0e10cSrcweir aRet.Height = aRect.Height;
562cdf0e10cSrcweir
563cdf0e10cSrcweir return aRet;
564cdf0e10cSrcweir }
565cdf0e10cSrcweir
566cdf0e10cSrcweir // -----------------------------------------------------------------------------
567cdf0e10cSrcweir
grabFocus()568cdf0e10cSrcweir void SAL_CALL ValueSetAcc::grabFocus()
569cdf0e10cSrcweir throw (uno::RuntimeException)
570cdf0e10cSrcweir {
571cdf0e10cSrcweir ThrowIfDisposed();
572cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
573cdf0e10cSrcweir mpParent->GrabFocus();
574cdf0e10cSrcweir }
575cdf0e10cSrcweir
576cdf0e10cSrcweir // -----------------------------------------------------------------------------
577cdf0e10cSrcweir
getAccessibleKeyBinding()578cdf0e10cSrcweir uno::Any SAL_CALL ValueSetAcc::getAccessibleKeyBinding()
579cdf0e10cSrcweir throw (uno::RuntimeException)
580cdf0e10cSrcweir {
581cdf0e10cSrcweir ThrowIfDisposed();
582cdf0e10cSrcweir return uno::Any();
583cdf0e10cSrcweir }
584cdf0e10cSrcweir
585cdf0e10cSrcweir // -----------------------------------------------------------------------------
586cdf0e10cSrcweir
getForeground()587cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getForeground( )
588cdf0e10cSrcweir throw (uno::RuntimeException)
589cdf0e10cSrcweir {
590cdf0e10cSrcweir ThrowIfDisposed();
591cdf0e10cSrcweir sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
592cdf0e10cSrcweir return static_cast<sal_Int32>(nColor);
593cdf0e10cSrcweir }
594cdf0e10cSrcweir
595cdf0e10cSrcweir // -----------------------------------------------------------------------------
596cdf0e10cSrcweir
getBackground()597cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getBackground( )
598cdf0e10cSrcweir throw (uno::RuntimeException)
599cdf0e10cSrcweir {
600cdf0e10cSrcweir ThrowIfDisposed();
601cdf0e10cSrcweir sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
602cdf0e10cSrcweir return static_cast<sal_Int32>(nColor);
603cdf0e10cSrcweir }
604cdf0e10cSrcweir
605cdf0e10cSrcweir // -----------------------------------------------------------------------------
606cdf0e10cSrcweir
selectAccessibleChild(sal_Int32 nChildIndex)607cdf0e10cSrcweir void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex )
608cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
609cdf0e10cSrcweir {
610cdf0e10cSrcweir ThrowIfDisposed();
611cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
612cdf0e10cSrcweir ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
613cdf0e10cSrcweir
614cdf0e10cSrcweir if(pItem != NULL)
615cdf0e10cSrcweir {
616cdf0e10cSrcweir mpParent->SelectItem( pItem->mnId );
617cdf0e10cSrcweir mpParent->Select ();
618cdf0e10cSrcweir }
619cdf0e10cSrcweir else
620cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
621cdf0e10cSrcweir }
622cdf0e10cSrcweir
623cdf0e10cSrcweir // -----------------------------------------------------------------------------
624cdf0e10cSrcweir
isAccessibleChildSelected(sal_Int32 nChildIndex)625cdf0e10cSrcweir sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex )
626cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
627cdf0e10cSrcweir {
628cdf0e10cSrcweir ThrowIfDisposed();
629cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
630cdf0e10cSrcweir ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
631cdf0e10cSrcweir sal_Bool bRet = sal_False;
632cdf0e10cSrcweir
633cdf0e10cSrcweir if (pItem != NULL)
634cdf0e10cSrcweir bRet = mpParent->IsItemSelected( pItem->mnId );
635cdf0e10cSrcweir else
636cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
637cdf0e10cSrcweir
638cdf0e10cSrcweir return bRet;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir
641cdf0e10cSrcweir // -----------------------------------------------------------------------------
642cdf0e10cSrcweir
clearAccessibleSelection()643cdf0e10cSrcweir void SAL_CALL ValueSetAcc::clearAccessibleSelection()
644cdf0e10cSrcweir throw (uno::RuntimeException)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir ThrowIfDisposed();
647cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
648cdf0e10cSrcweir mpParent->SetNoSelection();
649cdf0e10cSrcweir }
650cdf0e10cSrcweir
651cdf0e10cSrcweir // -----------------------------------------------------------------------------
652cdf0e10cSrcweir
selectAllAccessibleChildren()653cdf0e10cSrcweir void SAL_CALL ValueSetAcc::selectAllAccessibleChildren()
654cdf0e10cSrcweir throw (uno::RuntimeException)
655cdf0e10cSrcweir {
656cdf0e10cSrcweir ThrowIfDisposed();
657cdf0e10cSrcweir // unsupported due to single selection only
658cdf0e10cSrcweir }
659cdf0e10cSrcweir
660cdf0e10cSrcweir // -----------------------------------------------------------------------------
661cdf0e10cSrcweir
getSelectedAccessibleChildCount()662cdf0e10cSrcweir sal_Int32 SAL_CALL ValueSetAcc::getSelectedAccessibleChildCount()
663cdf0e10cSrcweir throw (uno::RuntimeException)
664cdf0e10cSrcweir {
665cdf0e10cSrcweir ThrowIfDisposed();
666cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
667cdf0e10cSrcweir sal_Int32 nRet = 0;
668cdf0e10cSrcweir
669cdf0e10cSrcweir for( sal_uInt16 i = 0, nCount = getItemCount(); i < nCount; i++ )
670cdf0e10cSrcweir {
671cdf0e10cSrcweir ValueSetItem* pItem = getItem (i);
672cdf0e10cSrcweir
673cdf0e10cSrcweir if( pItem && mpParent->IsItemSelected( pItem->mnId ) )
674cdf0e10cSrcweir ++nRet;
675cdf0e10cSrcweir }
676cdf0e10cSrcweir
677cdf0e10cSrcweir return nRet;
678cdf0e10cSrcweir }
679cdf0e10cSrcweir
680cdf0e10cSrcweir // -----------------------------------------------------------------------------
681cdf0e10cSrcweir
getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex)682cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
683cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
684cdf0e10cSrcweir {
685cdf0e10cSrcweir ThrowIfDisposed();
686cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
687cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
688cdf0e10cSrcweir
689cdf0e10cSrcweir for( sal_uInt16 i = 0, nCount = getItemCount(), nSel = 0; ( i < nCount ) && !xRet.is(); i++ )
690cdf0e10cSrcweir {
691cdf0e10cSrcweir ValueSetItem* pItem = getItem(i);
692cdf0e10cSrcweir
693cdf0e10cSrcweir if( pItem && mpParent->IsItemSelected( pItem->mnId ) && ( nSelectedChildIndex == static_cast< sal_Int32 >( nSel++ ) ) )
694cdf0e10cSrcweir xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
695cdf0e10cSrcweir }
696cdf0e10cSrcweir
697cdf0e10cSrcweir return xRet;
698cdf0e10cSrcweir }
699cdf0e10cSrcweir
700cdf0e10cSrcweir // -----------------------------------------------------------------------------
701cdf0e10cSrcweir
deselectAccessibleChild(sal_Int32 nChildIndex)702cdf0e10cSrcweir void SAL_CALL ValueSetAcc::deselectAccessibleChild( sal_Int32 nChildIndex )
703cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
704cdf0e10cSrcweir {
705cdf0e10cSrcweir ThrowIfDisposed();
706cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
707cdf0e10cSrcweir // Because of the single selection we can reset the whole selection when
708cdf0e10cSrcweir // the specified child is currently selected.
709cdf0e10cSrcweir if (isAccessibleChildSelected(nChildIndex))
710cdf0e10cSrcweir mpParent->SetNoSelection();
711cdf0e10cSrcweir }
712cdf0e10cSrcweir
713cdf0e10cSrcweir // -----------------------------------------------------------------------------
714cdf0e10cSrcweir
getSomething(const uno::Sequence<sal_Int8> & rId)715cdf0e10cSrcweir sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
716cdf0e10cSrcweir {
717cdf0e10cSrcweir sal_Int64 nRet;
718cdf0e10cSrcweir
719cdf0e10cSrcweir if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
720cdf0e10cSrcweir nRet = reinterpret_cast< sal_Int64 >( this );
721cdf0e10cSrcweir else
722cdf0e10cSrcweir nRet = 0;
723cdf0e10cSrcweir
724cdf0e10cSrcweir return nRet;
725cdf0e10cSrcweir }
726cdf0e10cSrcweir
727cdf0e10cSrcweir
728cdf0e10cSrcweir
729cdf0e10cSrcweir
disposing(void)730cdf0e10cSrcweir void SAL_CALL ValueSetAcc::disposing (void)
731cdf0e10cSrcweir {
732cdf0e10cSrcweir ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > aListenerListCopy;
733cdf0e10cSrcweir
734cdf0e10cSrcweir {
735cdf0e10cSrcweir // Make a copy of the list and clear the original.
736cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
737cdf0e10cSrcweir ::osl::MutexGuard aGuard (m_aMutex);
738cdf0e10cSrcweir aListenerListCopy = mxEventListeners;
739cdf0e10cSrcweir mxEventListeners.clear();
740cdf0e10cSrcweir
741cdf0e10cSrcweir // Reset the pointer to the parent. It has to be the one who has
742cdf0e10cSrcweir // disposed us because he is dying.
743cdf0e10cSrcweir mpParent = NULL;
744cdf0e10cSrcweir }
745cdf0e10cSrcweir
746cdf0e10cSrcweir // Inform all listeners that this objects is disposing.
747cdf0e10cSrcweir ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator
748cdf0e10cSrcweir aListenerIterator (aListenerListCopy.begin());
749cdf0e10cSrcweir lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
750cdf0e10cSrcweir while (aListenerIterator != aListenerListCopy.end())
751cdf0e10cSrcweir {
752cdf0e10cSrcweir try
753cdf0e10cSrcweir {
754cdf0e10cSrcweir (*aListenerIterator)->disposing (aEvent);
755cdf0e10cSrcweir }
756cdf0e10cSrcweir catch( uno::Exception& )
757cdf0e10cSrcweir {
758cdf0e10cSrcweir // Ignore exceptions.
759cdf0e10cSrcweir }
760cdf0e10cSrcweir
761cdf0e10cSrcweir ++aListenerIterator;
762cdf0e10cSrcweir }
763cdf0e10cSrcweir }
764cdf0e10cSrcweir
765cdf0e10cSrcweir
getItemCount(void) const766cdf0e10cSrcweir sal_uInt16 ValueSetAcc::getItemCount (void) const
767cdf0e10cSrcweir {
768cdf0e10cSrcweir sal_uInt16 nCount = mpParent->ImplGetVisibleItemCount();
769cdf0e10cSrcweir // When the None-Item is visible then increase the number of items by
770cdf0e10cSrcweir // one.
771cdf0e10cSrcweir if (HasNoneField())
772cdf0e10cSrcweir nCount += 1;
773cdf0e10cSrcweir return nCount;
774cdf0e10cSrcweir }
775cdf0e10cSrcweir
776cdf0e10cSrcweir
getItem(sal_uInt16 nIndex) const777cdf0e10cSrcweir ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const
778cdf0e10cSrcweir {
779cdf0e10cSrcweir ValueSetItem* pItem = NULL;
780cdf0e10cSrcweir
781cdf0e10cSrcweir if (HasNoneField())
782cdf0e10cSrcweir {
783cdf0e10cSrcweir if (nIndex == 0)
784cdf0e10cSrcweir // When present the first item is the then allways visible none field.
785cdf0e10cSrcweir pItem = mpParent->ImplGetItem (VALUESET_ITEM_NONEITEM);
786cdf0e10cSrcweir else
787cdf0e10cSrcweir // Shift down the index to compensate for the none field.
788cdf0e10cSrcweir nIndex -= 1;
789cdf0e10cSrcweir }
790cdf0e10cSrcweir if (pItem == NULL)
791*2bfcd321SSteve Yin pItem = mpParent->ImplGetItem (static_cast<sal_uInt16>(nIndex));
792cdf0e10cSrcweir
793cdf0e10cSrcweir return pItem;
794cdf0e10cSrcweir }
795cdf0e10cSrcweir
796cdf0e10cSrcweir
797cdf0e10cSrcweir
798cdf0e10cSrcweir
ThrowIfDisposed(void)799cdf0e10cSrcweir void ValueSetAcc::ThrowIfDisposed (void)
800cdf0e10cSrcweir throw (::com::sun::star::lang::DisposedException)
801cdf0e10cSrcweir {
802cdf0e10cSrcweir if (rBHelper.bDisposed || rBHelper.bInDispose)
803cdf0e10cSrcweir {
804cdf0e10cSrcweir OSL_TRACE ("Calling disposed object. Throwing exception:");
805cdf0e10cSrcweir throw lang::DisposedException (
806cdf0e10cSrcweir ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
807cdf0e10cSrcweir static_cast<uno::XWeak*>(this));
808cdf0e10cSrcweir }
809cdf0e10cSrcweir else
810cdf0e10cSrcweir {
811cdf0e10cSrcweir DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
812cdf0e10cSrcweir }
813cdf0e10cSrcweir }
814cdf0e10cSrcweir
815cdf0e10cSrcweir
816cdf0e10cSrcweir
IsDisposed(void)817cdf0e10cSrcweir sal_Bool ValueSetAcc::IsDisposed (void)
818cdf0e10cSrcweir {
819cdf0e10cSrcweir return (rBHelper.bDisposed || rBHelper.bInDispose);
820cdf0e10cSrcweir }
821cdf0e10cSrcweir
822cdf0e10cSrcweir
823cdf0e10cSrcweir
824cdf0e10cSrcweir
HasNoneField(void) const825cdf0e10cSrcweir bool ValueSetAcc::HasNoneField (void) const
826cdf0e10cSrcweir {
827cdf0e10cSrcweir DBG_ASSERT (mpParent!=NULL, "ValueSetAcc::HasNoneField called with mpParent==NULL");
828cdf0e10cSrcweir return ((mpParent->GetStyle() & WB_NONEFIELD) != 0);
829cdf0e10cSrcweir }
830cdf0e10cSrcweir
831cdf0e10cSrcweir
832cdf0e10cSrcweir
833cdf0e10cSrcweir
834cdf0e10cSrcweir // ----------------
835cdf0e10cSrcweir // - ValueItemAcc -
836cdf0e10cSrcweir // ----------------
837cdf0e10cSrcweir
ValueItemAcc(ValueSetItem * pParent,bool bIsTransientChildrenDisabled)838cdf0e10cSrcweir ValueItemAcc::ValueItemAcc( ValueSetItem* pParent, bool bIsTransientChildrenDisabled ) :
839cdf0e10cSrcweir mpParent( pParent ),
840cdf0e10cSrcweir mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled )
841cdf0e10cSrcweir {
842cdf0e10cSrcweir }
843cdf0e10cSrcweir
844cdf0e10cSrcweir // -----------------------------------------------------------------------------
845cdf0e10cSrcweir
~ValueItemAcc()846cdf0e10cSrcweir ValueItemAcc::~ValueItemAcc()
847cdf0e10cSrcweir {
848cdf0e10cSrcweir }
849cdf0e10cSrcweir
850cdf0e10cSrcweir // -----------------------------------------------------------------------
851cdf0e10cSrcweir
FireAccessibleEvent(short nEventId,const uno::Any & rOldValue,const uno::Any & rNewValue)852cdf0e10cSrcweir void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
853cdf0e10cSrcweir {
854cdf0e10cSrcweir if( nEventId )
855cdf0e10cSrcweir {
856cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > > aTmpListeners( mxEventListeners );
857cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() );
858cdf0e10cSrcweir accessibility::AccessibleEventObject aEvtObject;
859cdf0e10cSrcweir
860cdf0e10cSrcweir aEvtObject.EventId = nEventId;
861cdf0e10cSrcweir aEvtObject.Source = static_cast<uno::XWeak*>(this);
862cdf0e10cSrcweir aEvtObject.NewValue = rNewValue;
863cdf0e10cSrcweir aEvtObject.OldValue = rOldValue;
864cdf0e10cSrcweir
865cdf0e10cSrcweir while( aIter != aTmpListeners.end() )
866cdf0e10cSrcweir {
867cdf0e10cSrcweir (*aIter)->notifyEvent( aEvtObject );
868cdf0e10cSrcweir aIter++;
869cdf0e10cSrcweir }
870cdf0e10cSrcweir }
871cdf0e10cSrcweir }
872cdf0e10cSrcweir
873cdf0e10cSrcweir // -----------------------------------------------------------------------------
874cdf0e10cSrcweir
ParentDestroyed()875cdf0e10cSrcweir void ValueItemAcc::ParentDestroyed()
876cdf0e10cSrcweir {
877cdf0e10cSrcweir const ::vos::OGuard aGuard( maMutex );
878cdf0e10cSrcweir mpParent = NULL;
879cdf0e10cSrcweir }
880cdf0e10cSrcweir
881cdf0e10cSrcweir // -----------------------------------------------------------------------------
882cdf0e10cSrcweir
getUnoTunnelId()883cdf0e10cSrcweir const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId()
884cdf0e10cSrcweir {
885cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aSeq;
886cdf0e10cSrcweir
887cdf0e10cSrcweir if( !aSeq.getLength() )
888cdf0e10cSrcweir {
889cdf0e10cSrcweir static osl::Mutex aCreateMutex;
890cdf0e10cSrcweir osl::Guard< osl::Mutex > aGuard( aCreateMutex );
891cdf0e10cSrcweir
892cdf0e10cSrcweir aSeq.realloc( 16 );
893cdf0e10cSrcweir rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
894cdf0e10cSrcweir }
895cdf0e10cSrcweir
896cdf0e10cSrcweir return aSeq;
897cdf0e10cSrcweir }
898cdf0e10cSrcweir
899cdf0e10cSrcweir // -----------------------------------------------------------------------------
900cdf0e10cSrcweir
getImplementation(const uno::Reference<uno::XInterface> & rxData)901cdf0e10cSrcweir ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
902cdf0e10cSrcweir throw()
903cdf0e10cSrcweir {
904cdf0e10cSrcweir try
905cdf0e10cSrcweir {
906cdf0e10cSrcweir uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
907cdf0e10cSrcweir return( xUnoTunnel.is() ? reinterpret_cast<ValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ))) : NULL );
908cdf0e10cSrcweir }
909cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& )
910cdf0e10cSrcweir {
911cdf0e10cSrcweir return NULL;
912cdf0e10cSrcweir }
913cdf0e10cSrcweir }
914cdf0e10cSrcweir
915cdf0e10cSrcweir // -----------------------------------------------------------------------------
916cdf0e10cSrcweir
getAccessibleContext()917cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueItemAcc::getAccessibleContext()
918cdf0e10cSrcweir throw (uno::RuntimeException)
919cdf0e10cSrcweir {
920cdf0e10cSrcweir return this;
921cdf0e10cSrcweir }
922cdf0e10cSrcweir
923cdf0e10cSrcweir // -----------------------------------------------------------------------------
924cdf0e10cSrcweir
getAccessibleChildCount()925cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getAccessibleChildCount()
926cdf0e10cSrcweir throw (uno::RuntimeException)
927cdf0e10cSrcweir {
928cdf0e10cSrcweir return 0;
929cdf0e10cSrcweir }
930cdf0e10cSrcweir
931cdf0e10cSrcweir // -----------------------------------------------------------------------------
932cdf0e10cSrcweir
getAccessibleChild(sal_Int32)933cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleChild( sal_Int32 )
934cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
935cdf0e10cSrcweir {
936cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
937cdf0e10cSrcweir }
938cdf0e10cSrcweir
939cdf0e10cSrcweir // -----------------------------------------------------------------------------
940cdf0e10cSrcweir
getAccessibleParent()941cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleParent()
942cdf0e10cSrcweir throw (uno::RuntimeException)
943cdf0e10cSrcweir {
944cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
945cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
946cdf0e10cSrcweir
947cdf0e10cSrcweir if( mpParent )
948cdf0e10cSrcweir xRet = mpParent->mrParent.GetAccessible();
949cdf0e10cSrcweir
950cdf0e10cSrcweir return xRet;
951cdf0e10cSrcweir }
952cdf0e10cSrcweir
953cdf0e10cSrcweir // -----------------------------------------------------------------------------
954cdf0e10cSrcweir
getAccessibleIndexInParent()955cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent()
956cdf0e10cSrcweir throw (uno::RuntimeException)
957cdf0e10cSrcweir {
958cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
959cdf0e10cSrcweir // The index defaults to -1 to indicate the child does not belong to its
960cdf0e10cSrcweir // parent.
961cdf0e10cSrcweir sal_Int32 nIndexInParent = -1;
962cdf0e10cSrcweir
963cdf0e10cSrcweir if( mpParent )
964cdf0e10cSrcweir {
965cdf0e10cSrcweir bool bDone = false;
966cdf0e10cSrcweir
967cdf0e10cSrcweir sal_uInt16 nCount = mpParent->mrParent.ImplGetVisibleItemCount();
968cdf0e10cSrcweir ValueSetItem* pItem;
969cdf0e10cSrcweir for (sal_uInt16 i=0; i<nCount && !bDone; i++)
970cdf0e10cSrcweir {
971cdf0e10cSrcweir // Guard the retrieval of the i-th child with a try/catch block
972cdf0e10cSrcweir // just in case the number of children changes in the mean time.
973cdf0e10cSrcweir try
974cdf0e10cSrcweir {
975*2bfcd321SSteve Yin pItem = mpParent->mrParent.ImplGetItem(i);
976cdf0e10cSrcweir }
977cdf0e10cSrcweir catch (lang::IndexOutOfBoundsException aException)
978cdf0e10cSrcweir {
979cdf0e10cSrcweir pItem = NULL;
980cdf0e10cSrcweir }
981cdf0e10cSrcweir
982cdf0e10cSrcweir // Do not create an accessible object for the test.
983cdf0e10cSrcweir if (pItem != NULL && pItem->mpxAcc != NULL)
984cdf0e10cSrcweir if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this )
985cdf0e10cSrcweir {
986cdf0e10cSrcweir nIndexInParent = i;
987cdf0e10cSrcweir bDone = true;
988cdf0e10cSrcweir }
989cdf0e10cSrcweir }
990cdf0e10cSrcweir }
991cdf0e10cSrcweir
992*2bfcd321SSteve Yin //if this valueset contain a none field(common value is default), then we should increase the real index and set the noitem index value equal 0.
993*2bfcd321SSteve Yin if ( mpParent && ( (mpParent->mrParent.GetStyle() & WB_NONEFIELD) != 0 ) )
994*2bfcd321SSteve Yin {
995*2bfcd321SSteve Yin ValueSetItem* pFirstItem = mpParent->mrParent.ImplGetItem (VALUESET_ITEM_NONEITEM);
996*2bfcd321SSteve Yin if( pFirstItem && pFirstItem ->GetAccessible(mbIsTransientChildrenDisabled).get() == this )
997*2bfcd321SSteve Yin nIndexInParent = 0;
998*2bfcd321SSteve Yin else
999*2bfcd321SSteve Yin nIndexInParent++;
1000*2bfcd321SSteve Yin }
1001cdf0e10cSrcweir return nIndexInParent;
1002cdf0e10cSrcweir }
1003cdf0e10cSrcweir
1004cdf0e10cSrcweir // -----------------------------------------------------------------------------
1005cdf0e10cSrcweir
getAccessibleRole()1006cdf0e10cSrcweir sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole()
1007cdf0e10cSrcweir throw (uno::RuntimeException)
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir return accessibility::AccessibleRole::LIST_ITEM;
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir
1012cdf0e10cSrcweir // -----------------------------------------------------------------------------
1013cdf0e10cSrcweir
getAccessibleDescription()1014cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription()
1015cdf0e10cSrcweir throw (uno::RuntimeException)
1016cdf0e10cSrcweir {
1017cdf0e10cSrcweir return ::rtl::OUString();
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir
1020cdf0e10cSrcweir // -----------------------------------------------------------------------------
1021cdf0e10cSrcweir
getAccessibleName()1022cdf0e10cSrcweir ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleName()
1023cdf0e10cSrcweir throw (uno::RuntimeException)
1024cdf0e10cSrcweir {
1025cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1026cdf0e10cSrcweir String aRet;
1027cdf0e10cSrcweir
1028cdf0e10cSrcweir if( mpParent )
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir aRet = mpParent->maText;
1031cdf0e10cSrcweir
1032cdf0e10cSrcweir if( !aRet.Len() )
1033cdf0e10cSrcweir {
1034cdf0e10cSrcweir aRet = String( RTL_CONSTASCII_USTRINGPARAM( "Item " ) );
1035cdf0e10cSrcweir aRet += String::CreateFromInt32( mpParent->mnId );
1036cdf0e10cSrcweir }
1037cdf0e10cSrcweir }
1038cdf0e10cSrcweir
1039cdf0e10cSrcweir return aRet;
1040cdf0e10cSrcweir }
1041cdf0e10cSrcweir
1042cdf0e10cSrcweir // -----------------------------------------------------------------------------
1043cdf0e10cSrcweir
getAccessibleRelationSet()1044cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::getAccessibleRelationSet()
1045cdf0e10cSrcweir throw (uno::RuntimeException)
1046cdf0e10cSrcweir {
1047cdf0e10cSrcweir return uno::Reference< accessibility::XAccessibleRelationSet >();
1048cdf0e10cSrcweir }
1049cdf0e10cSrcweir
1050cdf0e10cSrcweir // -----------------------------------------------------------------------------
1051cdf0e10cSrcweir
getAccessibleStateSet()1052cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet()
1053cdf0e10cSrcweir throw (uno::RuntimeException)
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1056cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
1057cdf0e10cSrcweir
1058cdf0e10cSrcweir if( mpParent )
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
1061cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
1062cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
1063cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
1064cdf0e10cSrcweir if ( !mbIsTransientChildrenDisabled )
1065cdf0e10cSrcweir pStateSet->AddState (accessibility::AccessibleStateType::TRANSIENT);
1066cdf0e10cSrcweir
1067cdf0e10cSrcweir // SELECTABLE
1068cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
1069cdf0e10cSrcweir // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
1070cdf0e10cSrcweir
1071cdf0e10cSrcweir // SELECTED
1072cdf0e10cSrcweir if( mpParent->mrParent.GetSelectItemId() == mpParent->mnId )
1073cdf0e10cSrcweir {
1074cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
1075cdf0e10cSrcweir // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
1076cdf0e10cSrcweir }
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir
1079cdf0e10cSrcweir return pStateSet;
1080cdf0e10cSrcweir }
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir // -----------------------------------------------------------------------------
1083cdf0e10cSrcweir
getLocale()1084cdf0e10cSrcweir lang::Locale SAL_CALL ValueItemAcc::getLocale()
1085cdf0e10cSrcweir throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1088cdf0e10cSrcweir const ::rtl::OUString aEmptyStr;
1089cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xParent( getAccessibleParent() );
1090cdf0e10cSrcweir lang::Locale aRet( aEmptyStr, aEmptyStr, aEmptyStr );
1091cdf0e10cSrcweir
1092cdf0e10cSrcweir if( xParent.is() )
1093cdf0e10cSrcweir {
1094cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
1095cdf0e10cSrcweir
1096cdf0e10cSrcweir if( xParentContext.is() )
1097cdf0e10cSrcweir aRet = xParentContext->getLocale();
1098cdf0e10cSrcweir }
1099cdf0e10cSrcweir
1100cdf0e10cSrcweir return aRet;
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir
1103cdf0e10cSrcweir // -----------------------------------------------------------------------------
1104cdf0e10cSrcweir
addEventListener(const uno::Reference<accessibility::XAccessibleEventListener> & rxListener)1105cdf0e10cSrcweir void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
1106cdf0e10cSrcweir throw (uno::RuntimeException)
1107cdf0e10cSrcweir {
1108cdf0e10cSrcweir const ::vos::OGuard aGuard( maMutex );
1109cdf0e10cSrcweir
1110cdf0e10cSrcweir if( rxListener.is() )
1111cdf0e10cSrcweir {
1112cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
1113cdf0e10cSrcweir sal_Bool bFound = sal_False;
1114cdf0e10cSrcweir
1115cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) )
1116cdf0e10cSrcweir {
1117cdf0e10cSrcweir if( *aIter == rxListener )
1118cdf0e10cSrcweir bFound = sal_True;
1119cdf0e10cSrcweir else
1120cdf0e10cSrcweir aIter++;
1121cdf0e10cSrcweir }
1122cdf0e10cSrcweir
1123cdf0e10cSrcweir if (!bFound)
1124cdf0e10cSrcweir mxEventListeners.push_back( rxListener );
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir }
1127cdf0e10cSrcweir
1128cdf0e10cSrcweir // -----------------------------------------------------------------------------
1129cdf0e10cSrcweir
removeEventListener(const uno::Reference<accessibility::XAccessibleEventListener> & rxListener)1130cdf0e10cSrcweir void SAL_CALL ValueItemAcc::removeEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
1131cdf0e10cSrcweir throw (uno::RuntimeException)
1132cdf0e10cSrcweir {
1133cdf0e10cSrcweir const ::vos::OGuard aGuard( maMutex );
1134cdf0e10cSrcweir
1135cdf0e10cSrcweir if( rxListener.is() )
1136cdf0e10cSrcweir {
1137cdf0e10cSrcweir ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
1138cdf0e10cSrcweir sal_Bool bFound = sal_False;
1139cdf0e10cSrcweir
1140cdf0e10cSrcweir while( !bFound && ( aIter != mxEventListeners.end() ) )
1141cdf0e10cSrcweir {
1142cdf0e10cSrcweir if( *aIter == rxListener )
1143cdf0e10cSrcweir {
1144cdf0e10cSrcweir mxEventListeners.erase( aIter );
1145cdf0e10cSrcweir bFound = sal_True;
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir else
1148cdf0e10cSrcweir aIter++;
1149cdf0e10cSrcweir }
1150cdf0e10cSrcweir }
1151cdf0e10cSrcweir }
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir // -----------------------------------------------------------------------------
1154cdf0e10cSrcweir
containsPoint(const awt::Point & aPoint)1155cdf0e10cSrcweir sal_Bool SAL_CALL ValueItemAcc::containsPoint( const awt::Point& aPoint )
1156cdf0e10cSrcweir throw (uno::RuntimeException)
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() );
1159cdf0e10cSrcweir const Point aSize( aRect.Width, aRect.Height );
1160cdf0e10cSrcweir const Point aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
1161cdf0e10cSrcweir
1162cdf0e10cSrcweir return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir
1165cdf0e10cSrcweir // -----------------------------------------------------------------------------
1166cdf0e10cSrcweir
getAccessibleAtPoint(const awt::Point &)1167cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleAtPoint( const awt::Point& )
1168cdf0e10cSrcweir throw (uno::RuntimeException)
1169cdf0e10cSrcweir {
1170cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
1171cdf0e10cSrcweir return xRet;
1172cdf0e10cSrcweir }
1173cdf0e10cSrcweir
1174cdf0e10cSrcweir // -----------------------------------------------------------------------------
1175cdf0e10cSrcweir
getBounds()1176cdf0e10cSrcweir awt::Rectangle SAL_CALL ValueItemAcc::getBounds()
1177cdf0e10cSrcweir throw (uno::RuntimeException)
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1180cdf0e10cSrcweir awt::Rectangle aRet;
1181cdf0e10cSrcweir
1182cdf0e10cSrcweir if( mpParent )
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir Rectangle aRect( mpParent->maRect );
1185cdf0e10cSrcweir Point aOrigin;
1186cdf0e10cSrcweir Rectangle aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() );
1187cdf0e10cSrcweir
1188cdf0e10cSrcweir aRect.Intersection( aParentRect );
1189cdf0e10cSrcweir
1190cdf0e10cSrcweir aRet.X = aRect.Left();
1191cdf0e10cSrcweir aRet.Y = aRect.Top();
1192cdf0e10cSrcweir aRet.Width = aRect.GetWidth();
1193cdf0e10cSrcweir aRet.Height = aRect.GetHeight();
1194cdf0e10cSrcweir }
1195cdf0e10cSrcweir
1196cdf0e10cSrcweir return aRet;
1197cdf0e10cSrcweir }
1198cdf0e10cSrcweir
1199cdf0e10cSrcweir // -----------------------------------------------------------------------------
1200cdf0e10cSrcweir
getLocation()1201cdf0e10cSrcweir awt::Point SAL_CALL ValueItemAcc::getLocation()
1202cdf0e10cSrcweir throw (uno::RuntimeException)
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() );
1205cdf0e10cSrcweir awt::Point aRet;
1206cdf0e10cSrcweir
1207cdf0e10cSrcweir aRet.X = aRect.X;
1208cdf0e10cSrcweir aRet.Y = aRect.Y;
1209cdf0e10cSrcweir
1210cdf0e10cSrcweir return aRet;
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir // -----------------------------------------------------------------------------
1214cdf0e10cSrcweir
getLocationOnScreen()1215cdf0e10cSrcweir awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen()
1216cdf0e10cSrcweir throw (uno::RuntimeException)
1217cdf0e10cSrcweir {
1218cdf0e10cSrcweir const vos::OGuard aSolarGuard( Application::GetSolarMutex() );
1219cdf0e10cSrcweir awt::Point aRet;
1220cdf0e10cSrcweir
1221cdf0e10cSrcweir if( mpParent )
1222cdf0e10cSrcweir {
1223cdf0e10cSrcweir const Point aScreenPos( mpParent->mrParent.OutputToAbsoluteScreenPixel( mpParent->maRect.TopLeft() ) );
1224cdf0e10cSrcweir
1225cdf0e10cSrcweir aRet.X = aScreenPos.X();
1226cdf0e10cSrcweir aRet.Y = aScreenPos.Y();
1227cdf0e10cSrcweir }
1228cdf0e10cSrcweir
1229cdf0e10cSrcweir return aRet;
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir
1232cdf0e10cSrcweir // -----------------------------------------------------------------------------
1233cdf0e10cSrcweir
getSize()1234cdf0e10cSrcweir awt::Size SAL_CALL ValueItemAcc::getSize()
1235cdf0e10cSrcweir throw (uno::RuntimeException)
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir const awt::Rectangle aRect( getBounds() );
1238cdf0e10cSrcweir awt::Size aRet;
1239cdf0e10cSrcweir
1240cdf0e10cSrcweir aRet.Width = aRect.Width;
1241cdf0e10cSrcweir aRet.Height = aRect.Height;
1242cdf0e10cSrcweir
1243cdf0e10cSrcweir return aRet;
1244cdf0e10cSrcweir }
1245cdf0e10cSrcweir
1246cdf0e10cSrcweir // -----------------------------------------------------------------------------
1247cdf0e10cSrcweir
grabFocus()1248cdf0e10cSrcweir void SAL_CALL ValueItemAcc::grabFocus()
1249cdf0e10cSrcweir throw (uno::RuntimeException)
1250cdf0e10cSrcweir {
1251cdf0e10cSrcweir // nothing to do
1252cdf0e10cSrcweir }
1253cdf0e10cSrcweir
1254cdf0e10cSrcweir // -----------------------------------------------------------------------------
1255cdf0e10cSrcweir
getAccessibleKeyBinding()1256cdf0e10cSrcweir uno::Any SAL_CALL ValueItemAcc::getAccessibleKeyBinding()
1257cdf0e10cSrcweir throw (uno::RuntimeException)
1258cdf0e10cSrcweir {
1259cdf0e10cSrcweir return uno::Any();
1260cdf0e10cSrcweir }
1261cdf0e10cSrcweir
1262cdf0e10cSrcweir // -----------------------------------------------------------------------------
1263cdf0e10cSrcweir
getForeground()1264cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getForeground( )
1265cdf0e10cSrcweir throw (uno::RuntimeException)
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
1268cdf0e10cSrcweir return static_cast<sal_Int32>(nColor);
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir
1271cdf0e10cSrcweir // -----------------------------------------------------------------------------
1272cdf0e10cSrcweir
getBackground()1273cdf0e10cSrcweir sal_Int32 SAL_CALL ValueItemAcc::getBackground( )
1274cdf0e10cSrcweir throw (uno::RuntimeException)
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir sal_uInt32 nColor;
1277cdf0e10cSrcweir if (mpParent && mpParent->meType == VALUESETITEM_COLOR)
1278cdf0e10cSrcweir nColor = mpParent->maColor.GetColor();
1279cdf0e10cSrcweir else
1280cdf0e10cSrcweir nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
1281cdf0e10cSrcweir return static_cast<sal_Int32>(nColor);
1282cdf0e10cSrcweir }
1283cdf0e10cSrcweir
1284cdf0e10cSrcweir // -----------------------------------------------------------------------------
1285cdf0e10cSrcweir
getSomething(const uno::Sequence<sal_Int8> & rId)1286cdf0e10cSrcweir sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
1287cdf0e10cSrcweir {
1288cdf0e10cSrcweir sal_Int64 nRet;
1289cdf0e10cSrcweir
1290cdf0e10cSrcweir if( ( rId.getLength() == 16 ) && ( 0 == rtl_compareMemory( ValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
1291cdf0e10cSrcweir nRet = reinterpret_cast< sal_Int64 >( this );
1292cdf0e10cSrcweir else
1293cdf0e10cSrcweir nRet = 0;
1294cdf0e10cSrcweir
1295cdf0e10cSrcweir return nRet;
1296cdf0e10cSrcweir }
1297