vclxaccessibletoolbox.cxx (c82f2877) vclxaccessibletoolbox.cxx (21075d77)
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

--- 194 unchanged lines hidden (view full) ---

203VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus )
204{
205 VCLXAccessibleToolBoxItem* pItem = NULL;
206 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
207 if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) )
208 {
209 ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
210 // returns only toolbox buttons, not windows
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

--- 194 unchanged lines hidden (view full) ---

203VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus )
204{
205 VCLXAccessibleToolBoxItem* pItem = NULL;
206 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
207 if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) )
208 {
209 ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
210 // returns only toolbox buttons, not windows
211 if ( aIter != m_aAccessibleChildren.end() && !aIter->second.is())
211 if ( aIter != m_aAccessibleChildren.end() && aIter->second.is())
212 pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
213 }
214
215 return pItem;
216}
217// -----------------------------------------------------------------------------
218
219void VCLXAccessibleToolBox::UpdateFocus_Impl()

--- 59 unchanged lines hidden (view full) ---

279 VCLXAccessibleToolBoxItem* pItem =
280 static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
281 if ( pItem->HasFocus() )
282 pItem->SetFocus( sal_False );
283 }
284 }
285}
286// -----------------------------------------------------------------------------
212 pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
213 }
214
215 return pItem;
216}
217// -----------------------------------------------------------------------------
218
219void VCLXAccessibleToolBox::UpdateFocus_Impl()

--- 59 unchanged lines hidden (view full) ---

279 VCLXAccessibleToolBoxItem* pItem =
280 static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
281 if ( pItem->HasFocus() )
282 pItem->SetFocus( sal_False );
283 }
284 }
285}
286// -----------------------------------------------------------------------------
287void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 )
287void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos )
288{
289 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
290 if ( pToolBox )
291 {
288{
289 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
290 if ( pToolBox )
291 {
292 sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos );
293 VCLXAccessibleToolBoxItem* pFocusItem = NULL;
294
292 for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
293 aIter != m_aAccessibleChildren.end(); ++aIter )
294 {
295 sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first );
296
297 VCLXAccessibleToolBoxItem* pItem =
298 static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
299 pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
295 for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
296 aIter != m_aAccessibleChildren.end(); ++aIter )
297 {
298 sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first );
299
300 VCLXAccessibleToolBoxItem* pItem =
301 static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
302 pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
303 if ( nItemId == nFocusId )
304 pFocusItem = pItem;
300 }
305 }
306 //Solution:If the position is not a child item,the focus should not be called
307 if ( pFocusItem && (sal_uInt16)_nPos != TOOLBOX_ITEM_NOTFOUND )
308 pFocusItem->SetFocus( sal_True );
301 }
302}
303// -----------------------------------------------------------------------------
304void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos )
305{
306 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
307 if ( pToolBox )
308 {

--- 221 unchanged lines hidden (view full) ---

530 }
531}
532// -----------------------------------------------------------------------------
533void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
534{
535 // to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING)
536 Reference< XAccessibleContext > xTemp = this;
537
309 }
310}
311// -----------------------------------------------------------------------------
312void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos )
313{
314 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
315 if ( pToolBox )
316 {

--- 221 unchanged lines hidden (view full) ---

538 }
539}
540// -----------------------------------------------------------------------------
541void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
542{
543 // to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING)
544 Reference< XAccessibleContext > xTemp = this;
545
546 ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
538 switch ( rVclWindowEvent.GetId() )
539 {
540 case VCLEVENT_TOOLBOX_CLICK:
547 switch ( rVclWindowEvent.GetId() )
548 {
549 case VCLEVENT_TOOLBOX_CLICK:
550 case VCLEVENT_TOOLBOX_SELECT:
541 {
542 if ( rVclWindowEvent.GetData() )
543 {
544 UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
545 UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
546 }
551 {
552 if ( rVclWindowEvent.GetData() )
553 {
554 UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
555 UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
556 }
557 else if( pToolBox->GetItemPos(pToolBox->GetCurItemId()) != TOOLBOX_ITEM_NOTFOUND )
558 {
559 UpdateChecked_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) );
560 UpdateIndeterminate_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) );
561 }
547 break;
548 }
549 case VCLEVENT_TOOLBOX_DOUBLECLICK:
550 case VCLEVENT_TOOLBOX_ACTIVATE:
551 case VCLEVENT_TOOLBOX_DEACTIVATE:
562 break;
563 }
564 case VCLEVENT_TOOLBOX_DOUBLECLICK:
565 case VCLEVENT_TOOLBOX_ACTIVATE:
566 case VCLEVENT_TOOLBOX_DEACTIVATE:
552 case VCLEVENT_TOOLBOX_SELECT:
567 //case VCLEVENT_TOOLBOX_SELECT:
553 break;
568 break;
554
569 // IA2 CWS. MT: Still using VCLEVENT_TOOLBOX_CLICK, see comment in vcl/source/window/toolbox2.cxx
570 /*
571 case VCLEVENT_TOOLBOX_ITEMUPDATED:
572 {
573 if ( rVclWindowEvent.GetData() )
574 {
575 UpdateChecked_Impl( TOOLBOX_ITEM_NOTFOUND );
576 UpdateIndeterminate_Impl( (sal_Int32)rVclWindowEvent.GetData() );
577 }
578 break;
579 }
580 */
555 case VCLEVENT_TOOLBOX_HIGHLIGHT:
556 UpdateFocus_Impl();
557 break;
558
559 case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
560 ReleaseFocus_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
561 break;
562

--- 316 unchanged lines hidden ---
581 case VCLEVENT_TOOLBOX_HIGHLIGHT:
582 UpdateFocus_Impl();
583 break;
584
585 case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
586 ReleaseFocus_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
587 break;
588

--- 316 unchanged lines hidden ---