Author: mseidel Date: Sat May 25 21:00:06 2019 New Revision: 1860014 URL: http://svn.apache.org/viewvc?rev=1860014&view=rev Log: Cleaned up whitespace, fixed typos
Modified: openoffice/trunk/main/accessibility/source/standard/vclxaccessibletoolbox.cxx Modified: openoffice/trunk/main/accessibility/source/standard/vclxaccessibletoolbox.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/accessibility/source/standard/vclxaccessibletoolbox.cxx?rev=1860014&r1=1860013&r2=1860014&view=diff ============================================================================== --- openoffice/trunk/main/accessibility/source/standard/vclxaccessibletoolbox.cxx (original) +++ openoffice/trunk/main/accessibility/source/standard/vclxaccessibletoolbox.cxx Sat May 25 21:00:06 2019 @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -65,7 +65,7 @@ namespace _rxORB, _rxInnerAccessibleContext, _rxOwningAccessible, - _rxParentAccessible ) + _rxParentAccessible) ,m_nIndexInParent(_nIndexInParent) { } @@ -98,7 +98,7 @@ namespace inline sal_Int32 getIndexInParent() const { return m_nIndexInParent; } inline void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; } - static sal_Bool isWindowItem( const Reference< XAccessible >& _rxAcc, OToolBoxWindowItem** /* [out] */ _ppImplementation = NULL ); + static sal_Bool isWindowItem( const Reference< XAccessible >& _rxAcc, OToolBoxWindowItem** /* [out] */ _ppImplementation = NULL ); public: OToolBoxWindowItem(sal_Int32 _nIndexInParent, @@ -174,7 +174,7 @@ namespace sal_Int64 SAL_CALL OToolBoxWindowItem::getSomething( const Sequence< sal_Int8 >& _rId ) throw (RuntimeException) { if ( ( 16 == _rId.getLength() ) - && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rId.getConstArray(), 16 ) ) + && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rId.getConstArray(), 16 ) ) ) return reinterpret_cast< sal_Int64>( this ); @@ -203,13 +203,13 @@ VCLXAccessibleToolBox::~VCLXAccessibleTo VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus ) { VCLXAccessibleToolBoxItem* pItem = NULL; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) ) { ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); // returns only toolbox buttons, not windows - if ( aIter != m_aAccessibleChildren.end() && aIter->second.is()) - pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); + if ( aIter != m_aAccessibleChildren.end() && aIter->second.is()) + pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); } return pItem; @@ -218,92 +218,92 @@ VCLXAccessibleToolBoxItem* VCLXAccessibl void VCLXAccessibleToolBox::UpdateFocus_Impl() { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if( !pToolBox ) - return; - - // submit events only if toolbox has the focus to avoid sending events due to mouse move - sal_Bool bHasFocus = sal_False; - if ( pToolBox->HasFocus() ) - bHasFocus = sal_True; - else - { - // check for subtoolbar, i.e. check if our parent is a toolbar - ToolBox* pToolBoxParent = dynamic_cast< ToolBox* >( pToolBox->GetParent() ); - // subtoolbars never get the focus as key input is just forwarded, so check if the parent toolbar has it - if ( pToolBoxParent && pToolBoxParent->HasFocus() ) - bHasFocus = sal_True; - } + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if( !pToolBox ) + return; + + // submit events only if toolbox has the focus to avoid sending events due to mouse move + sal_Bool bHasFocus = sal_False; + if ( pToolBox->HasFocus() ) + bHasFocus = sal_True; + else + { + // check for subtoolbar, i.e. check if our parent is a toolbar + ToolBox* pToolBoxParent = dynamic_cast< ToolBox* >( pToolBox->GetParent() ); + // subtoolbars never get the focus as key input is just forwarded, so check if the parent toolbar has it + if ( pToolBoxParent && pToolBoxParent->HasFocus() ) + bHasFocus = sal_True; + } - if ( bHasFocus ) + if ( bHasFocus ) { sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); sal_uInt16 nFocusCount = 0; - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) + for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); + aIter != m_aAccessibleChildren.end(); ++aIter ) { - sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first ); + sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first ); - if ( aIter->second.is() ) - { - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - if ( pItem->HasFocus() && nItemId != nHighlightItemId ) - { - // reset the old focused item - pItem->SetFocus( sal_False ); - nFocusCount++; - } - if ( nItemId == nHighlightItemId ) - { - // set the new focused item - pItem->SetFocus( sal_True ); - nFocusCount++; - } - } - // both items changed? - if ( nFocusCount > 1 ) - break; - } + if ( aIter->second.is() ) + { + VCLXAccessibleToolBoxItem* pItem = + static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); + if ( pItem->HasFocus() && nItemId != nHighlightItemId ) + { + // reset the old focused item + pItem->SetFocus( sal_False ); + nFocusCount++; + } + if ( nItemId == nHighlightItemId ) + { + // set the new focused item + pItem->SetFocus( sal_True ); + nFocusCount++; + } + } + // both items changed? + if ( nFocusCount > 1 ) + break; + } } } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos ) { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) // #107124#, do not check for focus because this message is also handled in losefocus + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) // #107124#, do not check for focus because this message is also handled in losefocus { - ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); - if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() ) - { - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - if ( pItem->HasFocus() ) - pItem->SetFocus( sal_False ); - } + ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); + if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() ) + { + VCLXAccessibleToolBoxItem* pItem = + static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); + if ( pItem->HasFocus() ) + pItem->SetFocus( sal_False ); + } } } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 _nPos ) { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { sal_uInt16 nFocusId = pToolBox->GetItemId( (sal_uInt16)_nPos ); VCLXAccessibleToolBoxItem* pFocusItem = NULL; - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) + for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); + aIter != m_aAccessibleChildren.end(); ++aIter ) { sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first ); - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) ); - if ( nItemId == nFocusId ) - pFocusItem = pItem; - } - //Solution:If the position is not a child item,the focus should not be called + VCLXAccessibleToolBoxItem* pItem = + static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); + pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) ); + if ( nItemId == nFocusId ) + pFocusItem = pItem; + } + // Solution: If the position is not a child item, the focus should not be called if ( pFocusItem && (sal_uInt16)_nPos != TOOLBOX_ITEM_NOTFOUND ) pFocusItem->SetFocus( sal_True ); } @@ -311,19 +311,19 @@ void VCLXAccessibleToolBox::UpdateChecke // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos ) { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)_nPos ); - ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); - if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() ) - { - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); - if ( pItem ) - pItem->SetIndeterminate( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW ); - } + ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos ); + if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() ) + { + VCLXAccessibleToolBoxItem* pItem = + static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() ); + if ( pItem ) + pItem->SetIndeterminate( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW ); + } } } // ----------------------------------------------------------------------------- @@ -339,8 +339,8 @@ void VCLXAccessibleToolBox::implReleaseT NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xItemAcc ), Any() ); } - OToolBoxWindowItem* pWindowItem = NULL; - if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) ) + OToolBoxWindowItem* pWindowItem = NULL; + if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) ) { static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() )->ReleaseToolBox(); if ( _bDispose ) @@ -362,14 +362,14 @@ void VCLXAccessibleToolBox::implReleaseT // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded ) { - if ( _nPos < sal_Int32( m_aAccessibleChildren.size() ) ) - { - UpdateAllItems_Impl(); - return; - } + if ( _nPos < sal_Int32( m_aAccessibleChildren.size() ) ) + { + UpdateAllItems_Impl(); + return; + } - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { if ( !_bItemAdded ) { // the item was removed @@ -388,8 +388,8 @@ void VCLXAccessibleToolBox::UpdateItem_I { Reference< XAccessible > xItemAcc( aIndexAdjust->second ); - OToolBoxWindowItem* pWindowItem = NULL; - if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) ) + OToolBoxWindowItem* pWindowItem = NULL; + if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) ) { VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() ); if ( pItem ) @@ -412,7 +412,7 @@ void VCLXAccessibleToolBox::UpdateItem_I ++aIndexAdjust; } - if ( _bItemAdded ) + if ( _bItemAdded ) { // TODO: we should make this dependent on the existence of event listeners // with the current implementation, we always create accessible object @@ -424,19 +424,19 @@ void VCLXAccessibleToolBox::UpdateItem_I // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::UpdateAllItems_Impl() { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { // deregister the old items - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) + for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); + aIter != m_aAccessibleChildren.end(); ++aIter ) { implReleaseToolboxItem( aIter, true, true ); } m_aAccessibleChildren.clear(); // register the new items - sal_uInt16 i, nCount = pToolBox->GetItemCount(); + sal_uInt16 i, nCount = pToolBox->GetItemCount(); for ( i = 0; i < nCount; ++i ) { Any aNewValue; @@ -450,17 +450,17 @@ void VCLXAccessibleToolBox::UpdateAllIte void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ) { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); if( pWindow && pToolBox ) { Reference< XAccessible > xChild( pWindow->GetAccessible() ); - if( xChild.is() ) + if( xChild.is() ) { Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( pToolBox->GetDownItemId() ) ) ) ); - VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() ); + VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() ); - pItem->SetChild( xChild ); - pItem->NotifyChildEvent( xChild, bOpen ); + pItem->SetChild( xChild ); + pItem->NotifyChildEvent( xChild, bOpen ); } } } @@ -482,59 +482,59 @@ void VCLXAccessibleToolBox::UpdateItemEn // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow ) { - Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pChildWindow - && pToolBox - && pToolBox == pChildWindow->GetParent() - && pChildWindow->GetType() == WINDOW_TOOLBOX ) - { - sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); - Reference< XAccessible > xItem = getAccessibleChild( nIndex ); - if ( xItem.is() ) - { - Reference< XAccessible > xChild = pChildWindow->GetAccessible(); - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() ); - pItem->SetChild( xChild ); - pItem->NotifyChildEvent( xChild, _bShow ); - } - } + Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pChildWindow + && pToolBox + && pToolBox == pChildWindow->GetParent() + && pChildWindow->GetType() == WINDOW_TOOLBOX ) + { + sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); + Reference< XAccessible > xItem = getAccessibleChild( nIndex ); + if ( xItem.is() ) + { + Reference< XAccessible > xChild = pChildWindow->GetAccessible(); + VCLXAccessibleToolBoxItem* pItem = + static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() ); + pItem->SetChild( xChild ); + pItem->NotifyChildEvent( xChild, _bShow ); + } + } } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox ) { - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - { - sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); - Reference< XAccessible > xItem = getAccessibleChild( nIndex ); - if ( xItem.is() ) - { - Reference< XAccessible > xChild = _pSubToolBox->GetAccessible(); - VCLXAccessibleToolBoxItem* pItem = - static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() ); - if ( pItem->GetChild() == xChild ) - { - pItem->SetChild( Reference< XAccessible >() ); - pItem->NotifyChildEvent( xChild, false ); - } - } - } + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) + { + sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() ); + Reference< XAccessible > xItem = getAccessibleChild( nIndex ); + if ( xItem.is() ) + { + Reference< XAccessible > xChild = _pSubToolBox->GetAccessible(); + VCLXAccessibleToolBoxItem* pItem = + static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() ); + if ( pItem->GetChild() == xChild ) + { + pItem->SetChild( Reference< XAccessible >() ); + pItem->NotifyChildEvent( xChild, false ); + } + } + } } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) { VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); if ( pToolBox->IsHorizontal() ) - rStateSet.AddState( AccessibleStateType::HORIZONTAL ); + rStateSet.AddState( AccessibleStateType::HORIZONTAL ); else - rStateSet.AddState( AccessibleStateType::VERTICAL ); + rStateSet.AddState( AccessibleStateType::VERTICAL ); } } // ----------------------------------------------------------------------------- @@ -543,38 +543,38 @@ void VCLXAccessibleToolBox::ProcessWindo // to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING) Reference< XAccessibleContext > xTemp = this; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); switch ( rVclWindowEvent.GetId() ) { case VCLEVENT_TOOLBOX_CLICK: - case VCLEVENT_TOOLBOX_SELECT: - { + case VCLEVENT_TOOLBOX_SELECT: + { if ( rVclWindowEvent.GetData() ) - { - UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); - } + { + UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); + UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); + } else if( pToolBox->GetItemPos(pToolBox->GetCurItemId()) != TOOLBOX_ITEM_NOTFOUND ) { UpdateChecked_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) ); - UpdateIndeterminate_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) ); + UpdateIndeterminate_Impl( pToolBox->GetItemPos(pToolBox->GetCurItemId()) ); } break; - } + } case VCLEVENT_TOOLBOX_DOUBLECLICK: case VCLEVENT_TOOLBOX_ACTIVATE: case VCLEVENT_TOOLBOX_DEACTIVATE: - //case VCLEVENT_TOOLBOX_SELECT: + //case VCLEVENT_TOOLBOX_SELECT: break; // IA2 CWS. MT: Still using VCLEVENT_TOOLBOX_CLICK, see comment in vcl/source/window/toolbox2.cxx /* case VCLEVENT_TOOLBOX_ITEMUPDATED: { - if ( rVclWindowEvent.GetData() ) - { + if ( rVclWindowEvent.GetData() ) + { UpdateChecked_Impl( TOOLBOX_ITEM_NOTFOUND ); - UpdateIndeterminate_Impl( (sal_Int32)rVclWindowEvent.GetData() ); - } + UpdateIndeterminate_Impl( (sal_Int32)rVclWindowEvent.GetData() ); + } break; } */ @@ -583,30 +583,30 @@ void VCLXAccessibleToolBox::ProcessWindo break; case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: - ReleaseFocus_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); + ReleaseFocus_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); break; case VCLEVENT_TOOLBOX_ITEMADDED : -// UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), VCLEVENT_TOOLBOX_ITEMADDED == rVclWindowEvent.GetId() ); - UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), sal_True ); +// UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), VCLEVENT_TOOLBOX_ITEMADDED == rVclWindowEvent.GetId() ); + UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), sal_True ); break; - case VCLEVENT_TOOLBOX_ITEMREMOVED : + case VCLEVENT_TOOLBOX_ITEMREMOVED : case VCLEVENT_TOOLBOX_ALLITEMSCHANGED : { UpdateAllItems_Impl(); break; } - case VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED: + case VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED: { - sal_Int32 nPos = (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(); + sal_Int32 nPos = (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(); ToolBoxItemsMap::iterator aAccessiblePos( m_aAccessibleChildren.find( nPos ) ); if ( m_aAccessibleChildren.end() != aAccessiblePos ) - { + { implReleaseToolboxItem( aAccessiblePos, false, true ); - m_aAccessibleChildren.erase (aAccessiblePos); - } + m_aAccessibleChildren.erase (aAccessiblePos); + } Any aNewValue; aNewValue <<= getAccessibleChild(nPos); @@ -614,13 +614,13 @@ void VCLXAccessibleToolBox::ProcessWindo break; } case VCLEVENT_TOOLBOX_ITEMTEXTCHANGED : - UpdateItemName_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); + UpdateItemName_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); break; case VCLEVENT_TOOLBOX_ITEMENABLED : case VCLEVENT_TOOLBOX_ITEMDISABLED : { - UpdateItemEnabled_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); + UpdateItemEnabled_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() ); break; } @@ -633,26 +633,26 @@ void VCLXAccessibleToolBox::ProcessWindo case VCLEVENT_OBJECT_DYING : { - // if this toolbox is a subtoolbox, we have to relese it from its parent - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox && pToolBox->GetParent() && - pToolBox->GetParent()->GetType() == WINDOW_TOOLBOX ) - { - VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >( - pToolBox->GetParent()->GetAccessible()->getAccessibleContext().get() ); - if ( pParent ) - pParent->ReleaseSubToolBox( pToolBox ); - } - - // dispose all items - for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) + // if this toolbox is a subtoolbox, we have to release it from its parent + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox && pToolBox->GetParent() && + pToolBox->GetParent()->GetType() == WINDOW_TOOLBOX ) + { + VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >( + pToolBox->GetParent()->GetAccessible()->getAccessibleContext().get() ); + if ( pParent ) + pParent->ReleaseSubToolBox( pToolBox ); + } + + // dispose all items + for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); + aIter != m_aAccessibleChildren.end(); ++aIter ) { implReleaseToolboxItem( aIter, false, true ); } m_aAccessibleChildren.clear(); - //!!! no break to call base class + // !!! no break to call base class } default: @@ -664,18 +664,18 @@ void VCLXAccessibleToolBox::ProcessWindo { switch ( rVclWindowEvent.GetId() ) { - case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children - { - Reference< XAccessible > xReturn = GetItemWindowAccessible(rVclWindowEvent); - if ( xReturn.is() ) - NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny(xReturn) ); - else - HandleSubToolBarEvent( rVclWindowEvent, true ); - } - break; + case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children + { + Reference< XAccessible > xReturn = GetItemWindowAccessible(rVclWindowEvent); + if ( xReturn.is() ) + NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny(xReturn) ); + else + HandleSubToolBarEvent( rVclWindowEvent, true ); + } + break; - default: - VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); + default: + VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); } } @@ -696,7 +696,7 @@ void SAL_CALL VCLXAccessibleToolBox::dis // release the items for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin(); - aIter != m_aAccessibleChildren.end(); ++aIter ) + aIter != m_aAccessibleChildren.end(); ++aIter ) { implReleaseToolboxItem( aIter, false, true ); } @@ -726,11 +726,11 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBox comphelper::OExternalLockGuard aGuard( this ); sal_Int32 nCount = 0; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) - nCount = pToolBox->GetItemCount(); + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) + nCount = pToolBox->GetItemCount(); - return nCount; + return nCount; } // ----------------------------------------------------------------------------- Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) @@ -740,33 +740,33 @@ Reference< XAccessible > SAL_CALL VCLXAc comphelper::OExternalLockGuard aGuard( this ); - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { Reference< XAccessible > xChild; // search for the child ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i); if ( m_aAccessibleChildren.end() == aIter ) - { + { sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)i ); - sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); + sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId(); Window* pItemWindow = pToolBox->GetItemWindow( nItemId ); // not found -> create a new child - VCLXAccessibleToolBoxItem* pChild = new VCLXAccessibleToolBoxItem( pToolBox, i ); + VCLXAccessibleToolBoxItem* pChild = new VCLXAccessibleToolBoxItem( pToolBox, i ); Reference< XAccessible> xParent = pChild; if ( pItemWindow ) { xChild = new OToolBoxWindowItem(0,::comphelper::getProcessServiceFactory(),pItemWindow->GetAccessible(),xParent); pItemWindow->SetAccessible(xChild); - pChild->SetChild( xChild ); + pChild->SetChild( xChild ); } xChild = pChild; if ( nHighlightItemId > 0 && nItemId == nHighlightItemId ) pChild->SetFocus( sal_True ); if ( pToolBox->IsItemChecked( nItemId ) ) pChild->SetChecked( sal_True ); - if ( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW ) - pChild->SetIndeterminate( true ); + if ( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW ) + pChild->SetIndeterminate( true ); m_aAccessibleChildren.insert( ToolBoxItemsMap::value_type( i, xChild ) ); } else @@ -777,7 +777,7 @@ Reference< XAccessible > SAL_CALL VCLXAc return xChild; } - return NULL; + return NULL; } // ----------------------------------------------------------------------------- Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( const awt::Point& _rPoint ) throw (RuntimeException) @@ -785,8 +785,8 @@ Reference< XAccessible > SAL_CALL VCLXAc comphelper::OExternalLockGuard aGuard( this ); Reference< XAccessible > xAccessible; - ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pToolBox ) + ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); + if ( pToolBox ) { sal_uInt16 nItemPos = pToolBox->GetItemPos( VCLPoint( _rPoint ) ); if ( nItemPos != TOOLBOX_ITEM_NOTFOUND ) @@ -798,10 +798,10 @@ Reference< XAccessible > SAL_CALL VCLXAc // ----------------------------------------------------------------------------- Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent ) { - Reference< XAccessible > xReturn; + Reference< XAccessible > xReturn; Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() ); - if ( pChildWindow && pToolBox ) + if ( pChildWindow && pToolBox ) { sal_uInt16 nCount = pToolBox->GetItemCount(); for (sal_uInt16 i = 0 ; i < nCount && !xReturn.is() ; ++i) @@ -828,77 +828,77 @@ Reference< XAccessible > VCLXAccessibleT // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); - sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex); - pToolBox->ChangeHighlight( nPos ); + OExternalLockGuard aGuard( this ); + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); + sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex); + pToolBox->ChangeHighlight( nPos ); } // ----------------------------------------------------------------------------- sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); - sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex); - if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) ) - return sal_True; - else - return sal_False; + OExternalLockGuard aGuard( this ); + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); + sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex); + if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) ) + return sal_True; + else + return sal_False; } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::clearAccessibleSelection( ) throw (RuntimeException) { - OExternalLockGuard aGuard( this ); - ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); - pToolBox -> LoseFocus(); + OExternalLockGuard aGuard( this ); + ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); + pToolBox -> LoseFocus(); } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::selectAllAccessibleChildren( ) throw (RuntimeException) { - OExternalLockGuard aGuard( this ); - // intentionally empty. makes no sense for a toolbox + OExternalLockGuard aGuard( this ); + // intentionally empty. makes no sense for a toolbox } // ----------------------------------------------------------------------------- sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( ) throw (RuntimeException) { - OExternalLockGuard aGuard( this ); - sal_Int32 nRet = 0; - for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) - { - if ( isAccessibleChildSelected( i ) ) - { - nRet = 1; - break; // a toolbox can only have (n)one selected child - } - } - return nRet; + OExternalLockGuard aGuard( this ); + sal_Int32 nRet = 0; + for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) + { + if ( isAccessibleChildSelected( i ) ) + { + nRet = 1; + break; // a toolbox can only have (n)one selected child + } + } + return nRet; } // ----------------------------------------------------------------------------- Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) - { - if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) - { - xChild = getAccessibleChild( i ); - break; - } - } - return xChild; + OExternalLockGuard aGuard( this ); + if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + Reference< XAccessible > xChild; + for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) + { + if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) + { + xChild = getAccessibleChild( i ); + break; + } + } + return xChild; } // ----------------------------------------------------------------------------- void VCLXAccessibleToolBox::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); - clearAccessibleSelection(); // a toolbox can only have (n)one selected child + OExternalLockGuard aGuard( this ); + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + clearAccessibleSelection(); // a toolbox can only have (n)one selected child } // -----------------------------------------------------------------------------