1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_accessibility.hxx"
26 #include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
27 #include <svtools/accessibletableprovider.hxx>
28 #include <rtl/uuid.h>
29 //
30 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
31 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
32 #include <unotools/accessiblerelationsethelper.hxx>
33 
34 // ============================================================================
35 
36 using ::rtl::OUString;
37 
38 using ::com::sun::star::uno::Reference;
39 using ::com::sun::star::uno::Sequence;
40 using ::com::sun::star::uno::Any;
41 
42 using namespace ::com::sun::star;
43 using namespace ::com::sun::star::accessibility;
44 using namespace ::comphelper;
45 using namespace ::svt;
46 
47 
48 // ============================================================================
49 
50 namespace accessibility {
51 
52 using namespace com::sun::star::accessibility::AccessibleStateType;
53 // ============================================================================
54 
55 // Ctor/Dtor/disposing --------------------------------------------------------
56 
DBG_NAME(AccessibleBrowseBoxBase)57 DBG_NAME( AccessibleBrowseBoxBase )
58 
59 AccessibleBrowseBoxBase::AccessibleBrowseBoxBase(
60         const Reference< XAccessible >& rxParent,
61         IAccessibleTableProvider&                      rBrowseBox,
62 		const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
63         AccessibleBrowseBoxObjType      eObjType ) :
64     AccessibleBrowseBoxImplHelper( m_aMutex ),
65     mxParent( rxParent ),
66     mpBrowseBox( &rBrowseBox ),
67     m_xFocusWindow(_xFocusWindow),
68     maName( rBrowseBox.GetAccessibleObjectName( eObjType ) ),
69     maDescription( rBrowseBox.GetAccessibleObjectDescription( eObjType ) ),
70     meObjType( eObjType ),
71 	m_aClientId(0)
72 {
73     DBG_CTOR( AccessibleBrowseBoxBase, NULL );
74 	if ( m_xFocusWindow.is() )
75 		m_xFocusWindow->addFocusListener( this );
76 }
77 
AccessibleBrowseBoxBase(const Reference<XAccessible> & rxParent,IAccessibleTableProvider & rBrowseBox,const::com::sun::star::uno::Reference<::com::sun::star::awt::XWindow> & _xFocusWindow,AccessibleBrowseBoxObjType eObjType,const::rtl::OUString & rName,const::rtl::OUString & rDescription)78 AccessibleBrowseBoxBase::AccessibleBrowseBoxBase(
79         const Reference< XAccessible >& rxParent,
80         IAccessibleTableProvider&                      rBrowseBox,
81 		const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
82         AccessibleBrowseBoxObjType      eObjType,
83         const ::rtl::OUString&          rName,
84         const ::rtl::OUString&          rDescription ) :
85     AccessibleBrowseBoxImplHelper( m_aMutex ),
86     mxParent( rxParent ),
87     mpBrowseBox( &rBrowseBox ),
88     m_xFocusWindow(_xFocusWindow),
89     maName( rName ),
90     maDescription( rDescription ),
91     meObjType( eObjType ),
92 	m_aClientId(0)
93 {
94     DBG_CTOR( AccessibleBrowseBoxBase, NULL );
95 	if ( m_xFocusWindow.is() )
96 		m_xFocusWindow->addFocusListener( this );
97 }
98 
~AccessibleBrowseBoxBase()99 AccessibleBrowseBoxBase::~AccessibleBrowseBoxBase()
100 {
101     DBG_DTOR( AccessibleBrowseBoxBase, NULL );
102 
103     if( isAlive() )
104     {
105         // increment ref count to prevent double call of Dtor
106         osl_incrementInterlockedCount( &m_refCount );
107         dispose();
108     }
109 }
110 
disposing()111 void SAL_CALL AccessibleBrowseBoxBase::disposing()
112 {
113     ::osl::MutexGuard aGuard( getOslMutex() );
114 	if ( m_xFocusWindow.is() )
115 	{
116 		BBSolarGuard aSolarGuard;
117 		m_xFocusWindow->removeFocusListener( this );
118 	}
119 
120 	if ( getClientId( ) )
121 	{
122 		AccessibleEventNotifier::TClientId nId( getClientId( ) );
123 	    setClientId( 0 );
124 	    AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
125 	}
126 
127     mxParent = NULL;
128     mpBrowseBox = NULL;
129 }
130 
131 // XAccessibleContext ---------------------------------------------------------
132 
getAccessibleParent()133 Reference< XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleParent()
134     throw ( uno::RuntimeException )
135 {
136     ::osl::MutexGuard aGuard( getOslMutex() );
137     ensureIsAlive();
138     return mxParent;
139 }
140 
getAccessibleIndexInParent()141 sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getAccessibleIndexInParent()
142     throw ( uno::RuntimeException )
143 {
144     ::osl::MutexGuard aGuard( getOslMutex() );
145     ensureIsAlive();
146 
147     // -1 for child not found/no parent (according to specification)
148     sal_Int32 nRet = -1;
149 
150 	Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY );
151 
152     //  iterate over parent's children and search for this object
153     if( mxParent.is() )
154     {
155         Reference< XAccessibleContext >
156             xParentContext( mxParent->getAccessibleContext() );
157         if( xParentContext.is() )
158         {
159 			Reference< uno::XInterface > xChild;
160 
161             sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
162             for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
163             {
164 				xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
165 
166 				if ( xMeMyselfAndI.get() == xChild.get() )
167 				{
168                     nRet = nChild;
169 					break;
170 				}
171             }
172         }
173    }
174    return nRet;
175 }
176 
getAccessibleDescription()177 OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleDescription()
178     throw ( uno::RuntimeException )
179 {
180     ::osl::MutexGuard aGuard( getOslMutex() );
181     ensureIsAlive();
182     return maDescription;
183 }
184 
getAccessibleName()185 OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleName()
186     throw ( uno::RuntimeException )
187 {
188     ::osl::MutexGuard aGuard( getOslMutex() );
189     ensureIsAlive();
190     return maName;
191 }
192 
193 Reference< XAccessibleRelationSet > SAL_CALL
getAccessibleRelationSet()194 AccessibleBrowseBoxBase::getAccessibleRelationSet()
195     throw ( uno::RuntimeException )
196 {
197     ensureIsAlive();
198     // BrowseBox does not have relations.
199    	return new utl::AccessibleRelationSetHelper;
200 }
201 
202 Reference< XAccessibleStateSet > SAL_CALL
getAccessibleStateSet()203 AccessibleBrowseBoxBase::getAccessibleStateSet()
204     throw ( uno::RuntimeException )
205 {
206     BBSolarGuard aSolarGuard;
207     ::osl::MutexGuard aGuard( getOslMutex() );
208     // don't check whether alive -> StateSet may contain DEFUNC
209     return implCreateStateSetHelper();
210 }
211 
getLocale()212 lang::Locale SAL_CALL AccessibleBrowseBoxBase::getLocale()
213     throw ( IllegalAccessibleComponentStateException, uno::RuntimeException )
214 {
215     ::osl::MutexGuard aGuard( getOslMutex() );
216     ensureIsAlive();
217 	if( mxParent.is() )
218     {
219         Reference< XAccessibleContext >
220             xParentContext( mxParent->getAccessibleContext() );
221         if( xParentContext.is() )
222 	    	return xParentContext->getLocale();
223     }
224     throw IllegalAccessibleComponentStateException();
225 }
226 
227 // XAccessibleComponent -------------------------------------------------------
228 
containsPoint(const awt::Point & rPoint)229 sal_Bool SAL_CALL AccessibleBrowseBoxBase::containsPoint( const awt::Point& rPoint )
230     throw ( uno::RuntimeException )
231 {
232     return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
233 }
234 
getBounds()235 awt::Rectangle SAL_CALL AccessibleBrowseBoxBase::getBounds()
236     throw ( uno::RuntimeException )
237 {
238     return AWTRectangle( getBoundingBox() );
239 }
240 
getLocation()241 awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocation()
242     throw ( uno::RuntimeException )
243 {
244     return AWTPoint( getBoundingBox().TopLeft() );
245 }
246 
getLocationOnScreen()247 awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocationOnScreen()
248     throw ( uno::RuntimeException )
249 {
250     return AWTPoint( getBoundingBoxOnScreen().TopLeft() );
251 }
252 
getSize()253 awt::Size SAL_CALL AccessibleBrowseBoxBase::getSize()
254     throw ( uno::RuntimeException )
255 {
256     return AWTSize( getBoundingBox().GetSize() );
257 }
258 
isShowing()259 sal_Bool SAL_CALL AccessibleBrowseBoxBase::isShowing()
260     throw ( uno::RuntimeException )
261 {
262     BBSolarGuard aSolarGuard;
263     ::osl::MutexGuard aGuard( getOslMutex() );
264     ensureIsAlive();
265     return implIsShowing();
266 }
267 
isVisible()268 sal_Bool SAL_CALL AccessibleBrowseBoxBase::isVisible()
269     throw ( uno::RuntimeException )
270 {
271     Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
272     return xStateSet.is() ?
273         xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False;
274 }
275 
isFocusTraversable()276 sal_Bool SAL_CALL AccessibleBrowseBoxBase::isFocusTraversable()
277     throw ( uno::RuntimeException )
278 {
279     Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
280     return xStateSet.is() ?
281         xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False;
282 }
283 
focusGained(const::com::sun::star::awt::FocusEvent &)284 void SAL_CALL AccessibleBrowseBoxBase::focusGained( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException)
285 {
286 	com::sun::star::uno::Any aFocused;
287 	com::sun::star::uno::Any aEmpty;
288 	aFocused <<= FOCUSED;
289 
290 	commitEvent(AccessibleEventId::STATE_CHANGED,aFocused,aEmpty);
291 }
292 // -----------------------------------------------------------------------------
293 
focusLost(const::com::sun::star::awt::FocusEvent &)294 void SAL_CALL AccessibleBrowseBoxBase::focusLost( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException)
295 {
296 	com::sun::star::uno::Any aFocused;
297 	com::sun::star::uno::Any aEmpty;
298 	aFocused <<= FOCUSED;
299 
300 	commitEvent(AccessibleEventId::STATE_CHANGED,aEmpty,aFocused);
301 }
302 // XAccessibleEventBroadcaster ------------------------------------------------
303 
addEventListener(const Reference<XAccessibleEventListener> & _rxListener)304 void SAL_CALL AccessibleBrowseBoxBase::addEventListener(
305         const Reference< XAccessibleEventListener>& _rxListener )
306     throw ( uno::RuntimeException )
307 {
308 	if ( _rxListener.is() )
309 	{
310 		::osl::MutexGuard aGuard( getOslMutex() );
311 		if ( !getClientId( ) )
312 			setClientId( AccessibleEventNotifier::registerClient( ) );
313 
314 		AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener );
315 	}
316 }
317 
removeEventListener(const Reference<XAccessibleEventListener> & _rxListener)318 void SAL_CALL AccessibleBrowseBoxBase::removeEventListener(
319         const Reference< XAccessibleEventListener>& _rxListener )
320     throw ( uno::RuntimeException )
321 {
322     if( _rxListener.is() && getClientId( ) )
323     {
324 		::osl::MutexGuard aGuard( getOslMutex() );
325         sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
326 		if ( !nListenerCount )
327 		{
328 			// no listeners anymore
329 			// -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
330 			// and at least to us not firing any events anymore, in case somebody calls
331 			// NotifyAccessibleEvent, again
332 
333 			AccessibleEventNotifier::TClientId nId( getClientId( ) );
334 			setClientId( 0 );
335 			AccessibleEventNotifier::revokeClient( nId );
336 		}
337     }
338 }
339 
340 // XTypeProvider --------------------------------------------------------------
341 
getImplementationId()342 Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxBase::getImplementationId()
343     throw ( uno::RuntimeException )
344 {
345     ::osl::MutexGuard aGuard( getOslGlobalMutex() );
346     static Sequence< sal_Int8 > aId;
347     implCreateUuid( aId );
348 	return aId;
349 }
350 
351 // XServiceInfo ---------------------------------------------------------------
352 
supportsService(const OUString & rServiceName)353 sal_Bool SAL_CALL AccessibleBrowseBoxBase::supportsService(
354         const OUString& rServiceName )
355     throw ( uno::RuntimeException )
356 {
357     ::osl::MutexGuard aGuard( getOslMutex() );
358 
359     Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
360     const OUString* pArrBegin = aSupportedServices.getConstArray();
361     const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength();
362     const OUString* pString = pArrBegin;
363 
364     for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
365 		;
366 
367     return pString != pArrEnd;
368 }
369 
getSupportedServiceNames()370 Sequence< OUString > SAL_CALL AccessibleBrowseBoxBase::getSupportedServiceNames()
371     throw ( uno::RuntimeException )
372 {
373     const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
374     return Sequence< OUString >( &aServiceName, 1 );
375 }
376 
377 // other public methods -------------------------------------------------------
378 
setAccessibleName(const OUString & rName)379 void AccessibleBrowseBoxBase::setAccessibleName( const OUString& rName )
380 {
381     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
382     Any aOld;
383     aOld <<= maName;
384     maName = rName;
385 
386     aGuard.clear();
387 
388     commitEvent(
389         AccessibleEventId::NAME_CHANGED,
390         uno::makeAny( maName ),
391         aOld );
392 }
393 
setAccessibleDescription(const OUString & rDescription)394 void AccessibleBrowseBoxBase::setAccessibleDescription( const OUString& rDescription )
395 {
396     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
397     Any aOld;
398     aOld <<= maDescription;
399     maDescription = rDescription;
400 
401     aGuard.clear();
402 
403     commitEvent(
404         AccessibleEventId::DESCRIPTION_CHANGED,
405         uno::makeAny( maDescription ),
406         aOld );
407 }
408 
409 // internal virtual methods ---------------------------------------------------
410 
implIsShowing()411 sal_Bool AccessibleBrowseBoxBase::implIsShowing()
412 {
413     sal_Bool bShowing = sal_False;
414     if( mxParent.is() )
415     {
416         Reference< XAccessibleComponent >
417             xParentComp( mxParent->getAccessibleContext(), uno::UNO_QUERY );
418         if( xParentComp.is() )
419             bShowing = implGetBoundingBox().IsOver(
420                 VCLRectangle( xParentComp->getBounds() ) );
421     }
422 	return bShowing;
423 }
424 
implCreateStateSetHelper()425 ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxBase::implCreateStateSetHelper()
426 {
427     ::utl::AccessibleStateSetHelper*
428         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
429 
430     if( isAlive() )
431 	{
432         // SHOWING done with mxParent
433         if( implIsShowing() )
434 			pStateSetHelper->AddState( AccessibleStateType::SHOWING );
435         // BrowseBox fills StateSet with states depending on object type
436         mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() );
437 	}
438 	else
439 		pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
440 
441 	return pStateSetHelper;
442 }
443 
444 // internal helper methods ----------------------------------------------------
445 
isAlive() const446 sal_Bool AccessibleBrowseBoxBase::isAlive() const
447 {
448     return !rBHelper.bDisposed && !rBHelper.bInDispose && mpBrowseBox;
449 }
450 
ensureIsAlive() const451 void AccessibleBrowseBoxBase::ensureIsAlive() const
452     throw ( lang::DisposedException )
453 {
454     if( !isAlive() )
455         throw lang::DisposedException();
456 }
457 
getBoundingBox()458 Rectangle AccessibleBrowseBoxBase::getBoundingBox()
459     throw ( lang::DisposedException )
460 {
461     BBSolarGuard aSolarGuard;
462     ::osl::MutexGuard aGuard( getOslMutex() );
463     ensureIsAlive();
464 	Rectangle aRect = implGetBoundingBox();
465 	if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
466 	{
467 		DBG_ERRORFILE( "shit" );
468 	}
469     return aRect;
470 }
471 
getBoundingBoxOnScreen()472 Rectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen()
473     throw ( lang::DisposedException )
474 {
475     BBSolarGuard aSolarGuard;
476     ::osl::MutexGuard aGuard( getOslMutex() );
477     ensureIsAlive();
478 	Rectangle aRect = implGetBoundingBoxOnScreen();
479 	if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
480 	{
481 		DBG_ERRORFILE( "shit" );
482 	}
483     return aRect;
484 }
485 
commitEvent(sal_Int16 _nEventId,const Any & _rNewValue,const Any & _rOldValue)486 void AccessibleBrowseBoxBase::commitEvent(
487         sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
488 {
489     ::osl::ClearableMutexGuard aGuard( getOslMutex() );
490 	if ( !getClientId( ) )
491 	        // if we don't have a client id for the notifier, then we don't have listeners, then
492 	        // we don't need to notify anything
493 	        return;
494 
495 	// build an event object
496 	AccessibleEventObject aEvent;
497 	aEvent.Source = *this;
498 	aEvent.EventId = _nEventId;
499 	aEvent.OldValue = _rOldValue;
500 	aEvent.NewValue = _rNewValue;
501 
502 	// let the notifier handle this event
503 
504 	AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
505 }
506 // -----------------------------------------------------------------------------
507 
implCreateUuid(Sequence<sal_Int8> & rId)508 void AccessibleBrowseBoxBase::implCreateUuid( Sequence< sal_Int8 >& rId )
509 {
510     if( !rId.hasElements() )
511 	{
512         rId.realloc( 16 );
513         rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True );
514 	}
515 }
516 // -----------------------------------------------------------------------------
getAccessibleRole()517 sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole()
518     throw ( uno::RuntimeException )
519 {
520     ensureIsAlive();
521 	sal_Int16 nRole = AccessibleRole::UNKNOWN;
522 	switch ( meObjType )
523 	{
524         case BBTYPE_ROWHEADERCELL:
525 			nRole = AccessibleRole::ROW_HEADER;
526 			break;
527 		case BBTYPE_COLUMNHEADERCELL:
528 			nRole = AccessibleRole::COLUMN_HEADER;
529 			break;
530 		case BBTYPE_COLUMNHEADERBAR:
531 		case BBTYPE_ROWHEADERBAR:
532 		case BBTYPE_TABLE:
533 			nRole = AccessibleRole::TABLE;
534 			break;
535 		case BBTYPE_TABLECELL:
536 			nRole = AccessibleRole::TABLE_CELL;
537 			break;
538 		case BBTYPE_BROWSEBOX:
539 			nRole = AccessibleRole::PANEL;
540 			break;
541         case BBTYPE_CHECKBOXCELL:
542             nRole = AccessibleRole::CHECK_BOX;
543             break;
544 	}
545     return nRole;
546 }
547 // -----------------------------------------------------------------------------
getAccessibleKeyBinding()548 Any SAL_CALL AccessibleBrowseBoxBase::getAccessibleKeyBinding()
549         throw ( uno::RuntimeException )
550 {
551 	return Any();
552 }
553 // -----------------------------------------------------------------------------
getAccessibleAtPoint(const::com::sun::star::awt::Point &)554 Reference<XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& )
555         throw ( uno::RuntimeException )
556 {
557 	return NULL;
558 }
559 // -----------------------------------------------------------------------------
disposing(const::com::sun::star::lang::EventObject &)560 void SAL_CALL AccessibleBrowseBoxBase::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
561 {
562 	m_xFocusWindow = NULL;
563 }
564 // -----------------------------------------------------------------------------
getForeground()565 sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground(  ) throw (::com::sun::star::uno::RuntimeException)
566 {
567 	BBSolarGuard aSolarGuard;
568     ::osl::MutexGuard aGuard( getOslMutex() );
569     ensureIsAlive();
570 
571 	sal_Int32 nColor = 0;
572     Window* pInst = mpBrowseBox->GetWindowInstance();
573     if ( pInst )
574 	{
575         if ( pInst->IsControlForeground() )
576             nColor = pInst->GetControlForeground().GetColor();
577 		else
578 		{
579 			Font aFont;
580             if ( pInst->IsControlFont() )
581                 aFont = pInst->GetControlFont();
582 			else
583                 aFont = pInst->GetFont();
584 			nColor = aFont.GetColor().GetColor();
585 		}
586 	}
587 
588 	return nColor;
589 }
590 // -----------------------------------------------------------------------------
getBackground()591 sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground(  ) throw (::com::sun::star::uno::RuntimeException)
592 {
593 	BBSolarGuard aSolarGuard;
594     ::osl::MutexGuard aGuard( getOslMutex() );
595     ensureIsAlive();
596 	sal_Int32 nColor = 0;
597     Window* pInst = mpBrowseBox->GetWindowInstance();
598     if ( pInst )
599 	{
600         if ( pInst->IsControlBackground() )
601             nColor = pInst->GetControlBackground().GetColor();
602 		else
603             nColor = pInst->GetBackground().GetColor().GetColor();
604 	}
605 
606 	return nColor;
607 }
608 
609 // ============================================================================
610 DBG_NAME( BrowseBoxAccessibleElement )
611 
612 // XInterface -----------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(BrowseBoxAccessibleElement,AccessibleBrowseBoxBase,BrowseBoxAccessibleElement_Base)613 IMPLEMENT_FORWARD_XINTERFACE2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base )
614 
615 // XTypeProvider --------------------------------------------------------------
616 IMPLEMENT_FORWARD_XTYPEPROVIDER2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base )
617 
618 // XAccessible ----------------------------------------------------------------
619 
620 Reference< XAccessibleContext > SAL_CALL BrowseBoxAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException )
621 {
622     ensureIsAlive();
623 	return this;
624 }
625 
626 // ----------------------------------------------------------------------------
BrowseBoxAccessibleElement(const Reference<XAccessible> & rxParent,IAccessibleTableProvider & rBrowseBox,const Reference<awt::XWindow> & _xFocusWindow,AccessibleBrowseBoxObjType eObjType)627 BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox,
628 		const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType  eObjType )
629 	:AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType )
630 {
631 	DBG_CTOR( BrowseBoxAccessibleElement, NULL );
632 }
633 
634 // ----------------------------------------------------------------------------
BrowseBoxAccessibleElement(const Reference<XAccessible> & rxParent,IAccessibleTableProvider & rBrowseBox,const Reference<awt::XWindow> & _xFocusWindow,AccessibleBrowseBoxObjType eObjType,const::rtl::OUString & rName,const::rtl::OUString & rDescription)635 BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox,
636 		const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType  eObjType,
637 		const ::rtl::OUString& rName, const ::rtl::OUString& rDescription )
638 	:AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType, rName, rDescription )
639 {
640 	DBG_CTOR( BrowseBoxAccessibleElement, NULL );
641 }
642 
643 // ----------------------------------------------------------------------------
~BrowseBoxAccessibleElement()644 BrowseBoxAccessibleElement::~BrowseBoxAccessibleElement( )
645 {
646 	DBG_DTOR( BrowseBoxAccessibleElement, NULL );
647 }
648 
649 // ============================================================================
650 
651 } // namespace accessibility
652 
653 // ============================================================================
654 
655