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