This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push: new 405e754 Fixed mixed style (space/tabs) in indentation 405e754 is described below commit 405e754e50bc60b5a0660ce293b5e854860efe0d Author: mseidel <msei...@apache.org> AuthorDate: Fri Aug 27 21:13:23 2021 +0200 Fixed mixed style (space/tabs) in indentation --- .../standard/accessiblemenubasecomponent.cxx | 173 ++++---- .../source/standard/accessiblemenucomponent.cxx | 56 +-- .../standard/accessiblemenuitemcomponent.cxx | 178 ++++----- .../source/standard/vclxaccessiblebox.cxx | 442 ++++++++++----------- .../source/standard/vclxaccessiblecheckbox.cxx | 140 +++---- .../source/standard/vclxaccessibleedit.cxx | 172 ++++---- .../source/standard/vclxaccessiblelist.cxx | 326 +++++++-------- 7 files changed, 743 insertions(+), 744 deletions(-) diff --git a/main/accessibility/source/standard/accessiblemenubasecomponent.cxx b/main/accessibility/source/standard/accessiblemenubasecomponent.cxx index 099e851..e937c7d 100644 --- a/main/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/main/accessibility/source/standard/accessiblemenubasecomponent.cxx @@ -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. - * + * *************************************************************/ @@ -58,7 +58,7 @@ OAccessibleMenuBaseComponent::OAccessibleMenuBaseComponent( Menu* pMenu ) ,m_pMenu( pMenu ) ,m_bEnabled( sal_False ) ,m_bFocused( sal_False ) - ,m_bVisible( sal_False ) + ,m_bVisible( sal_False ) ,m_bSelected( sal_False ) ,m_bChecked( sal_False ) { @@ -123,7 +123,7 @@ void OAccessibleMenuBaseComponent::SetStates() { m_bEnabled = IsEnabled(); m_bFocused = IsFocused(); - m_bVisible = IsVisible(); + m_bVisible = IsVisible(); m_bSelected = IsSelected(); m_bChecked = IsChecked(); } @@ -139,20 +139,20 @@ void OAccessibleMenuBaseComponent::SetEnabled( sal_Bool bEnabled ) { nStateType = AccessibleStateType::VISIBLE; } - Any aOldValue[2], aNewValue[2]; + Any aOldValue[2], aNewValue[2]; if ( m_bEnabled ) - { - aOldValue[0] <<= AccessibleStateType::SENSITIVE; - aOldValue[1] <<= nStateType; - } + { + aOldValue[0] <<= AccessibleStateType::SENSITIVE; + aOldValue[1] <<= nStateType; + } else - { - aNewValue[0] <<= nStateType; - aNewValue[1] <<= AccessibleStateType::SENSITIVE; - } + { + aNewValue[0] <<= nStateType; + aNewValue[1] <<= AccessibleStateType::SENSITIVE; + } m_bEnabled = bEnabled; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] ); - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] ); + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] ); + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] ); } } @@ -176,14 +176,14 @@ void OAccessibleMenuBaseComponent::SetFocused( sal_Bool bFocused ) void OAccessibleMenuBaseComponent::SetVisible( sal_Bool bVisible ) { - if ( m_bVisible != bVisible ) + if ( m_bVisible != bVisible ) { Any aOldValue, aNewValue; - if ( m_bVisible ) + if ( m_bVisible ) aOldValue <<= AccessibleStateType::VISIBLE; else aNewValue <<= AccessibleStateType::VISIBLE; - m_bVisible = bVisible; + m_bVisible = bVisible; NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); } } @@ -192,16 +192,16 @@ void OAccessibleMenuBaseComponent::SetVisible( sal_Bool bVisible ) void OAccessibleMenuBaseComponent::SetSelected( sal_Bool bSelected ) { - if ( m_bSelected != bSelected ) - { - Any aOldValue, aNewValue; - if ( m_bSelected ) - aOldValue <<= AccessibleStateType::SELECTED; - else - aNewValue <<= AccessibleStateType::SELECTED; - m_bSelected = bSelected; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); - } + if ( m_bSelected != bSelected ) + { + Any aOldValue, aNewValue; + if ( m_bSelected ) + aOldValue <<= AccessibleStateType::SELECTED; + else + aNewValue <<= AccessibleStateType::SELECTED; + m_bSelected = bSelected; + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); + } } // ----------------------------------------------------------------------------- @@ -240,23 +240,23 @@ void OAccessibleMenuBaseComponent::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, sal_Bool bFocused ) { - if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp ) - pComp->SetFocused( bFocused ); - } - } + if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) + { + Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); + if ( xChild.is() ) + { + OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); + if ( pComp ) + pComp->SetFocused( bFocused ); + } + } } // ----------------------------------------------------------------------------- void OAccessibleMenuBaseComponent::UpdateVisible() { - SetVisible( IsVisible() ); + SetVisible( IsVisible() ); for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); @@ -264,7 +264,7 @@ void OAccessibleMenuBaseComponent::UpdateVisible() { OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); if ( pComp ) - pComp->SetVisible( pComp->IsVisible() ); + pComp->SetVisible( pComp->IsVisible() ); } } } @@ -382,7 +382,7 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i ) } } - return xChild; + return xChild; } // ----------------------------------------------------------------------------- @@ -394,8 +394,8 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Po { Reference< XAccessible > xAcc = getAccessibleChild( i ); if ( xAcc.is() ) - { - Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); + { + Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); if ( xComp.is() ) { Rectangle aRect = VCLRectangle( xComp->getBounds() ); @@ -496,23 +496,23 @@ sal_Bool OAccessibleMenuBaseComponent::IsHighlighted() sal_Bool OAccessibleMenuBaseComponent::IsChildHighlighted() { - sal_Bool bChildHighlighted = sal_False; + sal_Bool bChildHighlighted = sal_False; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) - { - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); - if ( xChild.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); - if ( pComp && pComp->IsHighlighted() ) - { - bChildHighlighted = sal_True; - break; - } - } - } + for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + { + Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); + if ( xChild.is() ) + { + OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() ); + if ( pComp && pComp->IsHighlighted() ) + { + bChildHighlighted = sal_True; + break; + } + } + } - return bChildHighlighted; + return bChildHighlighted; } // ----------------------------------------------------------------------------- @@ -525,7 +525,7 @@ void OAccessibleMenuBaseComponent::SelectChild( sal_Int32 i ) // highlight the child if ( m_pMenu ) - m_pMenu->HighlightItem( (sal_uInt16)i ); + m_pMenu->HighlightItem( (sal_uInt16)i ); } // ----------------------------------------------------------------------------- @@ -540,12 +540,12 @@ void OAccessibleMenuBaseComponent::DeSelectAll() sal_Bool OAccessibleMenuBaseComponent::IsChildSelected( sal_Int32 i ) { - sal_Bool bSelected = sal_False; + sal_Bool bSelected = sal_False; - if ( m_pMenu && m_pMenu->IsHighlighted( (sal_uInt16)i ) ) - bSelected = sal_True; + if ( m_pMenu && m_pMenu->IsHighlighted( (sal_uInt16)i ) ) + bSelected = sal_True; - return bSelected; + return bSelected; } // ----------------------------------------------------------------------------- @@ -570,7 +570,7 @@ void OAccessibleMenuBaseComponent::Click() sal_Bool OAccessibleMenuBaseComponent::IsPopupMenuOpen() { - return sal_False; + return sal_False; } // ----------------------------------------------------------------------------- @@ -594,24 +594,24 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen switch ( rVclMenuEvent.GetId() ) { - case VCLEVENT_MENU_SHOW: - case VCLEVENT_MENU_HIDE: - { - UpdateVisible(); - } - break; + case VCLEVENT_MENU_SHOW: + case VCLEVENT_MENU_HIDE: + { + UpdateVisible(); + } + break; case VCLEVENT_MENU_HIGHLIGHT: { - SetFocused( sal_False ); - UpdateFocused( nItemPos, sal_True ); - UpdateSelected( nItemPos, sal_True ); - } + SetFocused( sal_False ); + UpdateFocused( nItemPos, sal_True ); + UpdateSelected( nItemPos, sal_True ); + } break; case VCLEVENT_MENU_DEHIGHLIGHT: { - UpdateFocused( nItemPos, sal_False ); - UpdateSelected( nItemPos, sal_False ); - } + UpdateFocused( nItemPos, sal_False ); + UpdateSelected( nItemPos, sal_False ); + } break; case VCLEVENT_MENU_SUBMENUACTIVATE: { @@ -619,7 +619,7 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen break; case VCLEVENT_MENU_SUBMENUDEACTIVATE: { - UpdateFocused( nItemPos, sal_True ); + UpdateFocused( nItemPos, sal_True ); } break; case VCLEVENT_MENU_ENABLE: @@ -669,8 +669,8 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen UpdateChecked( nItemPos, sal_False ); } break; - case VCLEVENT_OBJECT_DYING: - { + case VCLEVENT_OBJECT_DYING: + { if ( m_pMenu ) { m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) ); @@ -686,8 +686,8 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen } m_aAccessibleChildren.clear(); } - } - break; + } + break; default: { } @@ -775,7 +775,7 @@ Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStat } else { - pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); } return xSet; @@ -783,8 +783,7 @@ Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStat // ----------------------------------------------------------------------------- -sal_Bool OAccessibleMenuBaseComponent::IsMenuHideDisabledEntries() +sal_Bool OAccessibleMenuBaseComponent::IsMenuHideDisabledEntries() { return sal_False; } - diff --git a/main/accessibility/source/standard/accessiblemenucomponent.cxx b/main/accessibility/source/standard/accessiblemenucomponent.cxx index 53dc658..472eb7b 100644 --- a/main/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/main/accessibility/source/standard/accessiblemenucomponent.cxx @@ -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. - * + * *************************************************************/ @@ -75,12 +75,12 @@ sal_Bool OAccessibleMenuComponent::IsEnabled() sal_Bool OAccessibleMenuComponent::IsVisible() { - sal_Bool bVisible = sal_False; + sal_Bool bVisible = sal_False; if ( m_pMenu ) - bVisible = m_pMenu->IsMenuVisible(); + bVisible = m_pMenu->IsMenuVisible(); - return bVisible; + return bVisible; } // ----------------------------------------------------------------------------- @@ -88,27 +88,27 @@ sal_Bool OAccessibleMenuComponent::IsVisible() void OAccessibleMenuComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) { if ( IsEnabled() ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } + { + rStateSet.AddState( AccessibleStateType::ENABLED ); + rStateSet.AddState( AccessibleStateType::SENSITIVE ); + } rStateSet.AddState( AccessibleStateType::FOCUSABLE ); if ( IsFocused() ) rStateSet.AddState( AccessibleStateType::FOCUSED ); - if ( IsVisible() ) - { - rStateSet.AddState( AccessibleStateType::VISIBLE ); - rStateSet.AddState( AccessibleStateType::SHOWING ); - } + if ( IsVisible() ) + { + rStateSet.AddState( AccessibleStateType::VISIBLE ); + rStateSet.AddState( AccessibleStateType::SHOWING ); + } - rStateSet.AddState( AccessibleStateType::OPAQUE ); + rStateSet.AddState( AccessibleStateType::OPAQUE ); } // ----------------------------------------------------------------------------- -// OCommonAccessibleComponent +// OCommonAccessibleComponent // ----------------------------------------------------------------------------- awt::Rectangle OAccessibleMenuComponent::implGetBounds() throw (RuntimeException) @@ -128,7 +128,7 @@ awt::Rectangle OAccessibleMenuComponent::implGetBounds() throw (RuntimeException Reference< XAccessible > xParent = getAccessibleParent(); if ( xParent.is() ) { - Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); + Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); if ( xParentComponent.is() ) { awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen(); @@ -164,7 +164,7 @@ sal_Int32 OAccessibleMenuComponent::getAccessibleChildCount() throw (RuntimeExce { OExternalLockGuard aGuard( this ); - return GetChildCount(); + return GetChildCount(); } // ----------------------------------------------------------------------------- @@ -242,9 +242,9 @@ Reference< XAccessibleRelationSet > OAccessibleMenuComponent::getAccessibleRelat { OExternalLockGuard aGuard( this ); - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; + return xSet; } // ----------------------------------------------------------------------------- @@ -281,7 +281,7 @@ awt::Point OAccessibleMenuComponent::getLocationOnScreen( ) throw (RuntimeExcep if ( pWindow ) { Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL ); - aPos = AWTPoint( aRect.TopLeft() ); + aPos = AWTPoint( aRect.TopLeft() ); } } @@ -308,7 +308,7 @@ sal_Int32 OAccessibleMenuComponent::getForeground( ) throw (RuntimeException) { OExternalLockGuard aGuard( this ); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); sal_Int32 nColor = rStyleSettings.GetMenuTextColor().GetColor(); return nColor; @@ -387,13 +387,13 @@ void OAccessibleMenuComponent::selectAccessibleChild( sal_Int32 nChildIndex ) th // ----------------------------------------------------------------------------- sal_Bool OAccessibleMenuComponent::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) -{ +{ OExternalLockGuard aGuard( this ); if ( nChildIndex < 0 || nChildIndex >= GetChildCount() ) throw IndexOutOfBoundsException(); - return IsChildSelected( nChildIndex ); + return IsChildSelected( nChildIndex ); } // ----------------------------------------------------------------------------- @@ -421,7 +421,7 @@ sal_Int32 OAccessibleMenuComponent::getSelectedAccessibleChildCount( ) throw (R sal_Int32 nRet = 0; for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ ) - { + { if ( IsChildSelected( i ) ) ++nRet; } @@ -441,7 +441,7 @@ Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( s Reference< XAccessible > xChild; for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ ) - { + { if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) { xChild = GetChild( i ); diff --git a/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx index 05abcb7..246ea56 100644 --- a/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx @@ -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. - * + * *************************************************************/ @@ -93,12 +93,12 @@ sal_Bool OAccessibleMenuItemComponent::IsEnabled() sal_Bool OAccessibleMenuItemComponent::IsVisible() { - sal_Bool bVisible = sal_False; + sal_Bool bVisible = sal_False; if ( m_pParent ) - bVisible = m_pParent->IsItemPosVisible( m_nItemPos ); + bVisible = m_pParent->IsItemPosVisible( m_nItemPos ); - return bVisible; + return bVisible; } // ----------------------------------------------------------------------------- @@ -106,9 +106,9 @@ sal_Bool OAccessibleMenuItemComponent::IsVisible() void OAccessibleMenuItemComponent::Select() { // open the parent menu - Reference< XAccessible > xParent( getAccessibleParent() ); + Reference< XAccessible > xParent( getAccessibleParent() ); if ( xParent.is() ) - { + { OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() ); if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() ) pComp->Click(); @@ -116,7 +116,7 @@ void OAccessibleMenuItemComponent::Select() // highlight the menu item if ( m_pParent ) - m_pParent->HighlightItem( m_nItemPos ); + m_pParent->HighlightItem( m_nItemPos ); } // ----------------------------------------------------------------------------- @@ -131,69 +131,69 @@ void OAccessibleMenuItemComponent::DeSelect() void OAccessibleMenuItemComponent::Click() { - // open the parent menu - Reference< XAccessible > xParent( getAccessibleParent() ); - if ( xParent.is() ) - { - OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() ); - if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() ) - pComp->Click(); - } - - // click the menu item - if ( m_pParent ) - { - Window* pWindow = m_pParent->GetWindow(); - if ( pWindow ) - { - // #102438# Menu items are not selectable - // Popup menus are executed asynchronously, triggered by a timer. - // As Menu::SelectItem only works, if the corresponding menu window is - // already created, we have to set the menu delay to 0, so - // that the popup menus are executed synchronously. - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - sal_uLong nDelay = aMouseSettings.GetMenuDelay(); - aMouseSettings.SetMenuDelay( 0 ); - aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings ); - - m_pParent->SelectItem( m_pParent->GetItemId( m_nItemPos ) ); - - // meanwhile the window pointer may be invalid - pWindow = m_pParent->GetWindow(); - if ( pWindow ) - { - // set the menu delay back to the old value - aSettings = pWindow->GetSettings(); - aMouseSettings = aSettings.GetMouseSettings(); - aMouseSettings.SetMenuDelay( nDelay ); - aSettings.SetMouseSettings( aMouseSettings ); - pWindow->SetSettings( aSettings ); - } - } - } + // open the parent menu + Reference< XAccessible > xParent( getAccessibleParent() ); + if ( xParent.is() ) + { + OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() ); + if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() ) + pComp->Click(); + } + + // click the menu item + if ( m_pParent ) + { + Window* pWindow = m_pParent->GetWindow(); + if ( pWindow ) + { + // #102438# Menu items are not selectable + // Popup menus are executed asynchronously, triggered by a timer. + // As Menu::SelectItem only works, if the corresponding menu window is + // already created, we have to set the menu delay to 0, so + // that the popup menus are executed synchronously. + AllSettings aSettings = pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + sal_uLong nDelay = aMouseSettings.GetMenuDelay(); + aMouseSettings.SetMenuDelay( 0 ); + aSettings.SetMouseSettings( aMouseSettings ); + pWindow->SetSettings( aSettings ); + + m_pParent->SelectItem( m_pParent->GetItemId( m_nItemPos ) ); + + // meanwhile the window pointer may be invalid + pWindow = m_pParent->GetWindow(); + if ( pWindow ) + { + // set the menu delay back to the old value + aSettings = pWindow->GetSettings(); + aMouseSettings = aSettings.GetMouseSettings(); + aMouseSettings.SetMenuDelay( nDelay ); + aSettings.SetMouseSettings( aMouseSettings ); + pWindow->SetSettings( aSettings ); + } + } + } } // ----------------------------------------------------------------------------- void OAccessibleMenuItemComponent::SetItemPos( sal_uInt16 nItemPos ) -{ - m_nItemPos = nItemPos; +{ + m_nItemPos = nItemPos; } // ----------------------------------------------------------------------------- void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAccessibleName ) { - if ( !m_sAccessibleName.equals( sAccessibleName ) ) - { - Any aOldValue, aNewValue; - aOldValue <<= m_sAccessibleName; - aNewValue <<= sAccessibleName; - m_sAccessibleName = sAccessibleName; - NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); - } + if ( !m_sAccessibleName.equals( sAccessibleName ) ) + { + Any aOldValue, aNewValue; + aOldValue <<= m_sAccessibleName; + aNewValue <<= sAccessibleName; + m_sAccessibleName = sAccessibleName; + NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue ); + } } // ----------------------------------------------------------------------------- @@ -208,7 +208,7 @@ void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAc if ( sName.isEmpty() ) sName = m_pParent->GetItemText( nItemId ); sName = OutputDevice::GetNonMnemonicString( sName ); - + // IA2 CWS, MT: Is adding 5 blanks really before the accelname reasonable? And which Platform / Accessibility API does need it this way? ATK has API for this... // Also, IAccessible2 has IAccessibleAction::keyBinding, so I doubt that this is needed. // But if so, it needs to move to the IA2 bridge. @@ -217,7 +217,7 @@ void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAc if ( sAccName.getLength() ) { sName += ::rtl::OUString::createFromAscii(" "); - sName += aAccelName; + sName += aAccelName; } */ } @@ -229,12 +229,12 @@ void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAc void OAccessibleMenuItemComponent::SetItemText( const ::rtl::OUString& sItemText ) { - Any aOldValue, aNewValue; - if ( OCommonAccessibleText::implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) ) - { - m_sItemText = sItemText; - NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue ); - } + Any aOldValue, aNewValue; + if ( OCommonAccessibleText::implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) ) + { + m_sItemText = sItemText; + NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue ); + } } // ----------------------------------------------------------------------------- @@ -254,22 +254,22 @@ void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateS { sal_Bool bEnabled = IsEnabled(); if ( bEnabled ) - { - rStateSet.AddState( AccessibleStateType::ENABLED ); - rStateSet.AddState( AccessibleStateType::SENSITIVE ); - } + { + rStateSet.AddState( AccessibleStateType::ENABLED ); + rStateSet.AddState( AccessibleStateType::SENSITIVE ); + } - if ( IsVisible() ) - { + if ( IsVisible() ) + { rStateSet.AddState( AccessibleStateType::SHOWING ); if( !IsMenuHideDisabledEntries() || bEnabled ) rStateSet.AddState( AccessibleStateType::VISIBLE ); } - rStateSet.AddState( AccessibleStateType::OPAQUE ); + rStateSet.AddState( AccessibleStateType::OPAQUE ); } // ----------------------------------------------------------------------------- -// OCommonAccessibleComponent +// OCommonAccessibleComponent // ----------------------------------------------------------------------------- awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() throw (RuntimeException) @@ -292,7 +292,7 @@ awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() throw (RuntimeExcep Reference< XAccessible > xParent = getAccessibleParent(); if ( xParent.is() ) { - Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); + Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY ); if ( xParentComponent.is() ) { awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen(); @@ -379,7 +379,7 @@ sal_Int16 OAccessibleMenuItemComponent::getAccessibleRole( ) throw (RuntimeExce ::rtl::OUString sDescription; if ( m_pParent ) - sDescription = m_pParent->GetHelpText( m_pParent->GetItemId( m_nItemPos ) ); + sDescription = m_pParent->GetHelpText( m_pParent->GetItemId( m_nItemPos ) ); return sDescription; } @@ -399,9 +399,9 @@ Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleR { OExternalLockGuard aGuard( this ); - utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; - return xSet; + return xSet; } // ----------------------------------------------------------------------------- @@ -443,7 +443,7 @@ sal_Int32 OAccessibleMenuItemComponent::getForeground( ) throw (RuntimeException { Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); + nColor = xParentComp->getForeground(); } return nColor; @@ -461,7 +461,7 @@ sal_Int32 OAccessibleMenuItemComponent::getBackground( ) throw (RuntimeExceptio { Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); + nColor = xParentComp->getBackground(); } return nColor; @@ -481,7 +481,7 @@ Reference< awt::XFont > OAccessibleMenuItemComponent::getFont( ) throw (Runtime { Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); if ( xParentComp.is() ) - xFont = xParentComp->getFont(); + xFont = xParentComp->getFont(); } return xFont; @@ -504,24 +504,24 @@ Reference< awt::XFont > OAccessibleMenuItemComponent::getFont( ) throw (Runtime ::rtl::OUString sRet; if ( m_pParent ) - sRet = m_pParent->GetTipHelpText( m_pParent->GetItemId( m_nItemPos ) ); + sRet = m_pParent->GetTipHelpText( m_pParent->GetItemId( m_nItemPos ) ); return sRet; } // ----------------------------------------------------------------------------- -sal_Bool OAccessibleMenuItemComponent::IsMenuHideDisabledEntries() +sal_Bool OAccessibleMenuItemComponent::IsMenuHideDisabledEntries() { if (m_pParent ) { - if( m_pParent->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES) + if( m_pParent->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES) { return sal_True; } // IA2 CWS, but the menus shouldn't have different flags, and even if so, the GetStartedFromMenu shouldn't matter /* - else if (m_pParent->GetStartedFromMenu() && + else if (m_pParent->GetStartedFromMenu() && m_pParent->GetStartedFromMenu()->GetMenuFlags() & MENU_FLAG_HIDEDISABLEDENTRIES) { return sal_True; diff --git a/main/accessibility/source/standard/vclxaccessiblebox.cxx b/main/accessibility/source/standard/vclxaccessiblebox.cxx index 42c71e6..6af5429 100644 --- a/main/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/main/accessibility/source/standard/vclxaccessiblebox.cxx @@ -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. - * + * *************************************************************/ @@ -46,19 +46,19 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::accessibility; VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, bool bIsDropDownBox) - : VCLXAccessibleComponent (pVCLWindow), - m_aBoxType (aType), - m_bIsDropDownBox (bIsDropDownBox), - m_nIndexInParent (DEFAULT_INDEX_IN_PARENT) + : VCLXAccessibleComponent (pVCLWindow), + m_aBoxType (aType), + m_bIsDropDownBox (bIsDropDownBox), + m_nIndexInParent (DEFAULT_INDEX_IN_PARENT) { - // Set up the flags that indicate which children this object has. - m_bHasListChild = true; - - // A text field is not present for non drop down list boxes. - if ((m_aBoxType==LISTBOX) && ! m_bIsDropDownBox) - m_bHasTextChild = false; - else - m_bHasTextChild = true; + // Set up the flags that indicate which children this object has. + m_bHasListChild = true; + + // A text field is not present for non drop down list boxes. + if ((m_aBoxType==LISTBOX) && ! m_bIsDropDownBox) + m_bHasTextChild = false; + else + m_bHasTextChild = true; } VCLXAccessibleBox::~VCLXAccessibleBox (void) @@ -67,48 +67,48 @@ VCLXAccessibleBox::~VCLXAccessibleBox (void) void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) { - uno::Any aOldValue, aNewValue; - uno::Reference<XAccessible> xAcc; + uno::Any aOldValue, aNewValue; + uno::Reference<XAccessible> xAcc; switch ( rVclWindowEvent.GetId() ) { - case VCLEVENT_WINDOW_SHOW: - case VCLEVENT_WINDOW_HIDE: - { - Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); - // Just compare to the combo box text field. All other children - // are identical to this object in which case this object will - // be removed in a short time. - if (m_aBoxType==COMBOBOX) - { - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); - if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) ) - if (pChildWindow == pComboBox->GetSubEdit()) - { - if (rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW) - { - // Instantiate text field. - getAccessibleChild (0); - aNewValue <<= m_xText; - } - else - { - // Release text field. - aOldValue <<= m_xText; - m_xText = NULL; - } - // Tell the listeners about the new/removed child. - NotifyAccessibleEvent ( - AccessibleEventId::CHILD, - aOldValue, aNewValue); - } - - } - } - break; - - default: - VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent); + case VCLEVENT_WINDOW_SHOW: + case VCLEVENT_WINDOW_HIDE: + { + Window* pChildWindow = (Window *) rVclWindowEvent.GetData(); + // Just compare to the combo box text field. All other children + // are identical to this object in which case this object will + // be removed in a short time. + if (m_aBoxType==COMBOBOX) + { + ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) ) + if (pChildWindow == pComboBox->GetSubEdit()) + { + if (rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW) + { + // Instantiate text field. + getAccessibleChild (0); + aNewValue <<= m_xText; + } + else + { + // Release text field. + aOldValue <<= m_xText; + m_xText = NULL; + } + // Tell the listeners about the new/removed child. + NotifyAccessibleEvent ( + AccessibleEventId::CHILD, + aOldValue, aNewValue); + } + + } + } + break; + + default: + VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent); } } @@ -121,9 +121,9 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven case VCLEVENT_LISTBOX_FOCUSITEMCHANGED: { - // Forward the call to the list child. - VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if ( pList == NULL ) + // Forward the call to the list child. + VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); + if ( pList == NULL ) { getAccessibleChild ( m_bHasTextChild ? 1 : 0 ); pList = static_cast<VCLXAccessibleList*>(m_xList.get()); @@ -142,11 +142,11 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven } } break; - } + } case VCLEVENT_DROPDOWN_OPEN: { - VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if ( pList == NULL ) + VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); + if ( pList == NULL ) { getAccessibleChild ( m_bHasTextChild ? 1 : 0 ); pList = static_cast<VCLXAccessibleList*>(m_xList.get()); @@ -160,8 +160,8 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven } case VCLEVENT_DROPDOWN_CLOSE: { - VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if ( pList == NULL ) + VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); + if ( pList == NULL ) { getAccessibleChild ( m_bHasTextChild ? 1 : 0 ); pList = static_cast<VCLXAccessibleList*>(m_xList.get()); @@ -175,22 +175,22 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven { Any aOldValue, aNewValue; aNewValue <<= AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); } break; } case VCLEVENT_COMBOBOX_SELECT: { - VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if (pList != NULL && m_xText.is()) - { - Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY); - if ( xText.is() ) + VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); + if (pList != NULL && m_xText.is()) { + Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY); + if ( xText.is() ) + { ::rtl::OUString sText = xText->getSelectedText(); if ( sText.isEmpty() ) sText = xText->getText(); - pList->UpdateSelection_Acc (sText, m_bIsDropDownBox); + pList->UpdateSelection_Acc (sText, m_bIsDropDownBox); //if(m_bIsDropDownBox && !pList->IsInDropDown()) if (m_bIsDropDownBox || ( !m_bIsDropDownBox && m_aBoxType==COMBOBOX)) NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any()); @@ -200,8 +200,8 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven aOldValue <<= AccessibleStateType::INDETERMINATE; NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue); + } } - } break; } //case VCLEVENT_DROPDOWN_OPEN: @@ -209,63 +209,63 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven case VCLEVENT_LISTBOX_DOUBLECLICK: case VCLEVENT_LISTBOX_SCROLLED: //case VCLEVENT_LISTBOX_SELECT: - case VCLEVENT_LISTBOX_ITEMADDED: - case VCLEVENT_LISTBOX_ITEMREMOVED: - case VCLEVENT_COMBOBOX_ITEMADDED: - case VCLEVENT_COMBOBOX_ITEMREMOVED: + case VCLEVENT_LISTBOX_ITEMADDED: + case VCLEVENT_LISTBOX_ITEMREMOVED: + case VCLEVENT_COMBOBOX_ITEMADDED: + case VCLEVENT_COMBOBOX_ITEMREMOVED: case VCLEVENT_COMBOBOX_SCROLLED: - { - // Forward the call to the list child. - VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if ( pList == NULL ) + { + // Forward the call to the list child. + VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); + if ( pList == NULL ) { getAccessibleChild ( m_bHasTextChild ? 1 : 0 ); pList = static_cast<VCLXAccessibleList*>(m_xList.get()); } if ( pList != NULL ) pList->ProcessWindowEvent (rVclWindowEvent); - break; - } + break; + } //case VCLEVENT_COMBOBOX_SELECT: - case VCLEVENT_COMBOBOX_DESELECT: - { - // Selection is handled by VCLXAccessibleList which operates on - // the same VCL object as this box does. In case of the - // combobox, however, we have to help the list with providing - // the text of the currently selected item. - VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); - if (pList != NULL && m_xText.is()) - { - Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY); - if ( xText.is() ) + case VCLEVENT_COMBOBOX_DESELECT: + { + // Selection is handled by VCLXAccessibleList which operates on + // the same VCL object as this box does. In case of the + // combobox, however, we have to help the list with providing + // the text of the currently selected item. + VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); + if (pList != NULL && m_xText.is()) + { + Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY); + if ( xText.is() ) { ::rtl::OUString sText = xText->getSelectedText(); if ( sText.isEmpty() ) sText = xText->getText(); - pList->UpdateSelection (sText); + pList->UpdateSelection (sText); } - } + } break; - } + } case VCLEVENT_EDIT_MODIFY: - case VCLEVENT_EDIT_SELECTIONCHANGED: - // case VCLEVENT_EDIT_CARETCHANGED: - // Modify/Selection events are handled by the combo box instead of - // directly by the edit field (Why?). Therefore, delegate this - // call to the edit field. - if (m_aBoxType==COMBOBOX) - { - if (m_xText.is()) - { - Reference<XAccessibleContext> xContext = m_xText->getAccessibleContext(); - VCLXAccessibleEdit* pEdit = static_cast<VCLXAccessibleEdit*>(xContext.get()); - if (pEdit != NULL) - pEdit->ProcessWindowEvent (rVclWindowEvent); - } - } - break; + case VCLEVENT_EDIT_SELECTIONCHANGED: + //case VCLEVENT_EDIT_CARETCHANGED: + // Modify/Selection events are handled by the combo box instead of + // directly by the edit field (Why?). Therefore, delegate this + // call to the edit field. + if (m_aBoxType==COMBOBOX) + { + if (m_xText.is()) + { + Reference<XAccessibleContext> xContext = m_xText->getAccessibleContext(); + VCLXAccessibleEdit* pEdit = static_cast<VCLXAccessibleEdit*>(xContext.get()); + if (pEdit != NULL) + pEdit->ProcessWindowEvent (rVclWindowEvent); + } + } + break; /* // MT: Not sending VCLEVENT_LISTBOX_STATEUPDATE, see comment in ListBox::SelectEntryPos case VCLEVENT_LISTBOX_STATEUPDATE: @@ -277,7 +277,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven ListBox* pListBox = static_cast< ListBox* >( GetWindow() ); if (pListBox != NULL && pListBox->GetEntryCount() > 0) { - nSelectedEntryCount = pListBox->GetSelectEntryCount(); + nSelectedEntryCount = pListBox->GetSelectEntryCount(); Any aOldValue; Any aNewValue; if ( nSelectedEntryCount == 0) @@ -311,31 +311,31 @@ Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext //===== XAccessibleContext ================================================== sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleChildCount (void) - throw (RuntimeException) + throw (RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - // Usually a box has a text field and a list of items as its children. - // Non drop down list boxes have no text field. Additionally check - // whether the object is valid. - sal_Int32 nCount = 0; - if (IsValid()) - nCount += (m_bHasTextChild?1:0) + (m_bHasListChild?1:0); - else - { - // Object not valid anymore. Release references to children. - m_bHasTextChild = false; - m_xText = NULL; - m_bHasListChild = false; - m_xList = NULL; - } - - return nCount; + // Usually a box has a text field and a list of items as its children. + // Non drop down list boxes have no text field. Additionally check + // whether the object is valid. + sal_Int32 nCount = 0; + if (IsValid()) + nCount += (m_bHasTextChild?1:0) + (m_bHasListChild?1:0); + else + { + // Object not valid anymore. Release references to children. + m_bHasTextChild = false; + m_xText = NULL; + m_bHasListChild = false; + m_xList = NULL; + } + + return nCount; } Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 i) - throw (IndexOutOfBoundsException, RuntimeException) + throw (IndexOutOfBoundsException, RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -344,54 +344,54 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 throw IndexOutOfBoundsException(); Reference< XAccessible > xChild; - if (IsValid()) - { - if (i==1 || ! m_bHasTextChild) - { - // List. - if ( ! m_xList.is()) - { - VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(), + if (IsValid()) + { + if (i==1 || ! m_bHasTextChild) + { + // List. + if ( ! m_xList.is()) + { + VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(), (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX), this); - pList->SetIndexInParent (i); - m_xList = pList; - } - xChild = m_xList; - } - else - { - // Text Field. - if ( ! m_xText.is()) - { - if (m_aBoxType==COMBOBOX) - { - ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); - if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL) + pList->SetIndexInParent (i); + m_xList = pList; + } + xChild = m_xList; + } + else + { + // Text Field. + if ( ! m_xText.is()) + { + if (m_aBoxType==COMBOBOX) + { + ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow()); + if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL) //Set the edit's acc name the same as parent { pComboBox->GetSubEdit()->SetAccessibleName(getAccessibleName()); - m_xText = pComboBox->GetSubEdit()->GetAccessible(); + m_xText = pComboBox->GetSubEdit()->GetAccessible(); } - } - else if (m_bIsDropDownBox) - m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this); - } - xChild = m_xText; - } - } - - return xChild; + } + else if (m_bIsDropDownBox) + m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this); + } + xChild = m_xText; + } + } + + return xChild; } sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - // Return the role <const>COMBO_BOX</const> for both VCL combo boxes and - // VCL list boxes in DropDown-Mode else <const>PANEL</const>. + // Return the role <const>COMBO_BOX</const> for both VCL combo boxes and + // VCL list boxes in DropDown-Mode else <const>PANEL</const>. // This way the Java bridge has not to handle both independently. - //return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL; + //return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL; if (m_bIsDropDownBox || (!m_bIsDropDownBox && m_aBoxType == COMBOBOX )) return AccessibleRole::COMBO_BOX; else @@ -399,28 +399,28 @@ sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeExc } sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleIndexInParent (void) - throw (::com::sun::star::uno::RuntimeException) + throw (::com::sun::star::uno::RuntimeException) { - if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) - return m_nIndexInParent; - else - return VCLXAccessibleComponent::getAccessibleIndexInParent(); + if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) + return m_nIndexInParent; + else + return VCLXAccessibleComponent::getAccessibleIndexInParent(); } //===== XAccessibleAction =================================================== sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleActionCount (void) - throw (RuntimeException) + throw (RuntimeException) { ::osl::Guard< ::osl::Mutex> aGuard (GetMutex()); - // There is one action for drop down boxes (toggle popup) and none for - // the other boxes. + // There is one action for drop down boxes (toggle popup) and none for + // the other boxes. return m_bIsDropDownBox ? 1 : 0; } sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex) - throw (IndexOutOfBoundsException, RuntimeException) + throw (IndexOutOfBoundsException, RuntimeException) { sal_Bool bNotify = sal_False; @@ -428,28 +428,28 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex) vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if (nIndex<0 || nIndex>=getAccessibleActionCount()) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); + if (nIndex<0 || nIndex>=getAccessibleActionCount()) + throw ::com::sun::star::lang::IndexOutOfBoundsException(); if (m_aBoxType == COMBOBOX) - { - ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() ); - if (pComboBox != NULL) - { - pComboBox->ToggleDropDown(); - bNotify = sal_True; - } - } - else if (m_aBoxType == LISTBOX) - { - ListBox* pListBox = static_cast< ListBox* >( GetWindow() ); - if (pListBox != NULL) - { - pListBox->ToggleDropDown(); - bNotify = sal_True; - } - } - } + { + ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() ); + if (pComboBox != NULL) + { + pComboBox->ToggleDropDown(); + bNotify = sal_True; + } + } + else if (m_aBoxType == LISTBOX) + { + ListBox* pListBox = static_cast< ListBox* >( GetWindow() ); + if (pListBox != NULL) + { + pListBox->ToggleDropDown(); + bNotify = sal_True; + } + } + } if (bNotify) NotifyAccessibleEvent (AccessibleEventId::ACTION_CHANGED, Any(), Any()); @@ -458,11 +458,11 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex) } ::rtl::OUString SAL_CALL VCLXAccessibleBox::getAccessibleActionDescription (sal_Int32 nIndex) - throw (IndexOutOfBoundsException, RuntimeException) + throw (IndexOutOfBoundsException, RuntimeException) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - if (nIndex<0 || nIndex>=getAccessibleActionCount()) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); + if (nIndex<0 || nIndex>=getAccessibleActionCount()) + throw ::com::sun::star::lang::IndexOutOfBoundsException(); return m_bIsDropDownBox ? TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP) : ::rtl::OUString(); } @@ -474,8 +474,8 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBind Reference< XAccessibleKeyBinding > xRet; - if (nIndex<0 || nIndex>=getAccessibleActionCount()) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); + if (nIndex<0 || nIndex>=getAccessibleActionCount()) + throw ::com::sun::star::lang::IndexOutOfBoundsException(); // ... which key? return xRet; @@ -490,7 +490,7 @@ void SAL_CALL VCLXAccessibleBox::disposing (void) // ===== XAccessibleValue =============================================== Any VCLXAccessibleBox::getCurrentValue( ) - throw( RuntimeException ) + throw( RuntimeException ) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -506,7 +506,7 @@ Any VCLXAccessibleBox::getCurrentValue( ) aAny <<= sText; } } - if (m_aBoxType == LISTBOX && m_bIsDropDownBox && m_xList.is() ) + if (m_aBoxType == LISTBOX && m_bIsDropDownBox && m_xList.is() ) { VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get()); @@ -522,38 +522,38 @@ Any VCLXAccessibleBox::getCurrentValue( ) } } } - - return aAny; + + return aAny; } -sal_Bool VCLXAccessibleBox::setCurrentValue( const Any& aNumber ) - throw( RuntimeException ) +sal_Bool VCLXAccessibleBox::setCurrentValue( const Any& aNumber ) + throw( RuntimeException ) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::rtl::OUString fValue; - sal_Bool bValid = (aNumber >>= fValue); - if( bValid ) - { - } - return bValid; + ::rtl::OUString fValue; + sal_Bool bValid = (aNumber >>= fValue); + if( bValid ) + { + + } + return bValid; } -Any VCLXAccessibleBox::getMaximumValue( ) - throw( RuntimeException ) +Any VCLXAccessibleBox::getMaximumValue( ) + throw( RuntimeException ) { - Any aAny; - return aAny; + Any aAny; + return aAny; } -Any VCLXAccessibleBox::getMinimumValue( ) - throw( RuntimeException ) +Any VCLXAccessibleBox::getMinimumValue( ) + throw( RuntimeException ) { - Any aAny; - return aAny; + Any aAny; + return aAny; } // Set the INDETERMINATE state when there is no selected item for combobox @@ -581,7 +581,7 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r ListBox* pListBox = static_cast< ListBox* >( GetWindow() ); if (pListBox != NULL && pListBox->GetEntryCount() > 0) { - nSelectedEntryCount = pListBox->GetSelectEntryCount(); + nSelectedEntryCount = pListBox->GetSelectEntryCount(); if ( nSelectedEntryCount == 0) rStateSet.AddState(AccessibleStateType::INDETERMINATE); } diff --git a/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx index 59db862..abf4333 100644 --- a/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -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. - * + * *************************************************************/ @@ -56,8 +56,8 @@ using namespace ::comphelper; VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow ) :VCLXAccessibleTextComponent( pVCLWindow ) { - m_bChecked = IsChecked(); - m_bIndeterminate = IsIndeterminate(); + m_bChecked = IsChecked(); + m_bIndeterminate = IsIndeterminate(); } // ----------------------------------------------------------------------------- @@ -70,26 +70,26 @@ VCLXAccessibleCheckBox::~VCLXAccessibleCheckBox() bool VCLXAccessibleCheckBox::IsChecked() { - bool bChecked = false; + bool bChecked = false; - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 1 ) - bChecked = true; + VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); + if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 1 ) + bChecked = true; - return bChecked; + return bChecked; } // ----------------------------------------------------------------------------- bool VCLXAccessibleCheckBox::IsIndeterminate() { - bool bIndeterminate = false; + bool bIndeterminate = false; - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 2 ) - bIndeterminate = true; + VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); + if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 2 ) + bIndeterminate = true; - return bIndeterminate; + return bIndeterminate; } // ----------------------------------------------------------------------------- @@ -128,17 +128,17 @@ void VCLXAccessibleCheckBox::SetIndeterminate( bool bIndeterminate ) void VCLXAccessibleCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { - switch ( rVclWindowEvent.GetId() ) - { + switch ( rVclWindowEvent.GetId() ) + { case VCLEVENT_CHECKBOX_TOGGLE: - { - SetChecked( IsChecked() ); - SetIndeterminate( IsIndeterminate() ); - } - break; + { + SetChecked( IsChecked() ); + SetIndeterminate( IsIndeterminate() ); + } + break; default: VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); - } + } } // ----------------------------------------------------------------------------- @@ -147,13 +147,13 @@ void VCLXAccessibleCheckBox::FillAccessibleStateSet( utl::AccessibleStateSetHelp { VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - if ( IsChecked() ) - rStateSet.AddState( AccessibleStateType::CHECKED ); + if ( IsChecked() ) + rStateSet.AddState( AccessibleStateType::CHECKED ); - if ( IsIndeterminate() ) - rStateSet.AddState( AccessibleStateType::INDETERMINATE ); + if ( IsIndeterminate() ) + rStateSet.AddState( AccessibleStateType::INDETERMINATE ); } // ----------------------------------------------------------------------------- @@ -194,7 +194,7 @@ sal_Int32 VCLXAccessibleCheckBox::getAccessibleActionCount( ) throw (RuntimeExce { OExternalLockGuard aGuard( this ); - return 1; + return 1; } // ----------------------------------------------------------------------------- @@ -204,7 +204,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw ( OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); + throw IndexOutOfBoundsException(); CheckBox* pCheckBox = (CheckBox*) GetWindow(); VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); @@ -236,7 +236,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw ( OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); + throw IndexOutOfBoundsException(); if(IsChecked()) return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_UNCHECK ) ); @@ -248,39 +248,39 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw ( Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) { - OExternalLockGuard aGuard( this ); - - if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); - - OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); - Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; - - Window* pWindow = GetWindow(); - if ( pWindow ) - { - KeyEvent aKeyEvent = pWindow->GetActivationKey(); - KeyCode aKeyCode = aKeyEvent.GetKeyCode(); - if ( aKeyCode.GetCode() != 0 ) - { - awt::KeyStroke aKeyStroke; - aKeyStroke.Modifiers = 0; - if ( aKeyCode.IsShift() ) - aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT; - if ( aKeyCode.IsMod1() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; - if ( aKeyCode.IsMod2() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; - if ( aKeyCode.IsMod3() ) - aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; - aKeyStroke.KeyCode = aKeyCode.GetCode(); - aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); - aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); - pKeyBindingHelper->AddKeyBinding( aKeyStroke ); - } - } - - return xKeyBinding; + OExternalLockGuard aGuard( this ); + + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw IndexOutOfBoundsException(); + + OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); + Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + KeyEvent aKeyEvent = pWindow->GetActivationKey(); + KeyCode aKeyCode = aKeyEvent.GetKeyCode(); + if ( aKeyCode.GetCode() != 0 ) + { + awt::KeyStroke aKeyStroke; + aKeyStroke.Modifiers = 0; + if ( aKeyCode.IsShift() ) + aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT; + if ( aKeyCode.IsMod1() ) + aKeyStroke.Modifiers |= awt::KeyModifier::MOD1; + if ( aKeyCode.IsMod2() ) + aKeyStroke.Modifiers |= awt::KeyModifier::MOD2; + if ( aKeyCode.IsMod3() ) + aKeyStroke.Modifiers |= awt::KeyModifier::MOD3; + aKeyStroke.KeyCode = aKeyCode.GetCode(); + aKeyStroke.KeyChar = aKeyEvent.GetCharCode(); + aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() ); + pKeyBindingHelper->AddKeyBinding( aKeyStroke ); + } + } + + return xKeyBinding; } // ----------------------------------------------------------------------------- @@ -296,7 +296,7 @@ Any VCLXAccessibleCheckBox::getCurrentValue( ) throw (RuntimeException) VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pVCLXCheckBox ) aValue <<= (sal_Int32) pVCLXCheckBox->getState(); - + return aValue; } @@ -310,7 +310,7 @@ sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) throw (Ru VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); if ( pVCLXCheckBox ) - { + { sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0; OSL_VERIFY( aNumber >>= nValue ); OSL_VERIFY( getMinimumValue() >>= nValueMin ); @@ -324,7 +324,7 @@ sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) throw (Ru pVCLXCheckBox->setState( (sal_Int16) nValue ); bReturn = sal_True; } - + return bReturn; } @@ -341,7 +341,7 @@ Any VCLXAccessibleCheckBox::getMaximumValue( ) throw (RuntimeException) aValue <<= (sal_Int32) 2; else aValue <<= (sal_Int32) 1; - + return aValue; } @@ -353,7 +353,7 @@ Any VCLXAccessibleCheckBox::getMinimumValue( ) throw (RuntimeException) Any aValue; aValue <<= (sal_Int32) 0; - + return aValue; } diff --git a/main/accessibility/source/standard/vclxaccessibleedit.cxx b/main/accessibility/source/standard/vclxaccessibleedit.cxx index 0324822..1e84240 100644 --- a/main/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/main/accessibility/source/standard/vclxaccessibleedit.cxx @@ -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. - * + * *************************************************************/ @@ -88,10 +88,10 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve { sal_Int32 nOldCaretPosition = m_nCaretPosition; sal_Int32 nOldSelectionStart = m_nSelectionStart; - + m_nCaretPosition = getCaretPosition(); m_nSelectionStart = getSelectionStart(); - + Window* pWindow = GetWindow(); if ( pWindow && pWindow->HasChildPathFocus() ) { @@ -102,21 +102,21 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve aNewValue <<= (sal_Int32) m_nCaretPosition; NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue ); } - + // #i104470# VCL only has SELECTION_CHANGED, but UAA distinguishes between SELECTION_CHANGED and CARET_CHANGED sal_Bool bHasSelection = ( m_nSelectionStart != m_nCaretPosition ); sal_Bool bHadSelection = ( nOldSelectionStart != nOldCaretPosition ); if ( ( bHasSelection != bHadSelection ) || ( bHasSelection && ( ( m_nCaretPosition != nOldCaretPosition ) || ( m_nSelectionStart != nOldSelectionStart ) ) ) ) - { - NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); - } - - } - } - break; + { + NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() ); + } + + } + } + break; default: VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent ); - } + } } // ----------------------------------------------------------------------------- @@ -128,10 +128,10 @@ void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); if ( pVCLXEdit ) { - rStateSet.AddState( AccessibleStateType::FOCUSABLE ); - rStateSet.AddState( AccessibleStateType::SINGLE_LINE ); - if ( pVCLXEdit->isEditable() ) - rStateSet.AddState( AccessibleStateType::EDITABLE ); + rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + rStateSet.AddState( AccessibleStateType::SINGLE_LINE ); + if ( pVCLXEdit->isEditable() ) + rStateSet.AddState( AccessibleStateType::EDITABLE ); } } @@ -141,7 +141,7 @@ void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& ::rtl::OUString VCLXAccessibleEdit::implGetText() { - ::rtl::OUString aText; + ::rtl::OUString aText; Edit* pEdit = static_cast< Edit* >( GetWindow() ); if ( pEdit ) @@ -158,7 +158,7 @@ void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& } } - return aText; + return aText; } // ----------------------------------------------------------------------------- @@ -251,8 +251,8 @@ sal_Int32 VCLXAccessibleEdit::getAccessibleActionCount( ) throw (RuntimeExceptio { OExternalLockGuard aGuard( this ); - // There is one action: activate - return 1; + // There is one action: activate + return 1; } // ----------------------------------------------------------------------------- @@ -262,17 +262,17 @@ sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (Inde OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); + throw IndexOutOfBoundsException(); - sal_Bool bDoAction = sal_False; - Window* pWindow = GetWindow(); - if ( pWindow ) - { - pWindow->GrabFocus(); - bDoAction = sal_True; - } + sal_Bool bDoAction = sal_False; + Window* pWindow = GetWindow(); + if ( pWindow ) + { + pWindow->GrabFocus(); + bDoAction = sal_True; + } - return bDoAction; + return bDoAction; } // ----------------------------------------------------------------------------- @@ -282,10 +282,10 @@ sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (Inde OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); + throw IndexOutOfBoundsException(); - static const ::rtl::OUString sAction( RTL_CONSTASCII_USTRINGPARAM( "activate" ) ); - return sAction; + static const ::rtl::OUString sAction( RTL_CONSTASCII_USTRINGPARAM( "activate" ) ); + return sAction; } // ----------------------------------------------------------------------------- @@ -295,7 +295,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleEdit::getAccessibleActionKeyBin OExternalLockGuard aGuard( this ); if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) - throw IndexOutOfBoundsException(); + throw IndexOutOfBoundsException(); return Reference< XAccessibleKeyBinding >(); } @@ -340,41 +340,41 @@ awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) throw { OExternalLockGuard aGuard( this ); - awt::Rectangle aBounds( 0, 0, 0, 0 ); - sal_Int32 nLength = implGetText().getLength(); + awt::Rectangle aBounds( 0, 0, 0, 0 ); + sal_Int32 nLength = implGetText().getLength(); - if ( !implIsValidRange( nIndex, nIndex, nLength ) ) - throw IndexOutOfBoundsException(); + if ( !implIsValidRange( nIndex, nIndex, nLength ) ) + throw IndexOutOfBoundsException(); Control* pControl = static_cast< Control* >( GetWindow() ); if ( pControl ) - { - if ( nIndex == nLength ) - { - // #108914# calculate virtual bounding rectangle - for ( sal_Int32 i = 0; i < nLength; ++i ) - { - Rectangle aRect = pControl->GetCharacterBounds( i ); - sal_Int32 nHeight = aRect.GetHeight(); - if ( aBounds.Height < nHeight ) - { - aBounds.Y = aRect.Top(); - aBounds.Height = nHeight; - } - if ( i == nLength - 1 ) - { - aBounds.X = aRect.Right() + 1; - aBounds.Width = 1; - } - } - } - else - { - aBounds = AWTRectangle( pControl->GetCharacterBounds( nIndex ) ); - } - } + { + if ( nIndex == nLength ) + { + // #108914# calculate virtual bounding rectangle + for ( sal_Int32 i = 0; i < nLength; ++i ) + { + Rectangle aRect = pControl->GetCharacterBounds( i ); + sal_Int32 nHeight = aRect.GetHeight(); + if ( aBounds.Height < nHeight ) + { + aBounds.Y = aRect.Top(); + aBounds.Height = nHeight; + } + if ( i == nLength - 1 ) + { + aBounds.X = aRect.Right() + 1; + aBounds.Width = 1; + } + } + } + else + { + aBounds = AWTRectangle( pControl->GetCharacterBounds( nIndex ) ); + } + } - return aBounds; + return aBounds; } // ----------------------------------------------------------------------------- @@ -431,8 +431,8 @@ sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEnd sal_Bool bReturn = sal_False; ::rtl::OUString sText( implGetText() ); - if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); + if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) + throw IndexOutOfBoundsException(); VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() ); Edit* pEdit = static_cast< Edit* >( GetWindow() ); @@ -541,7 +541,7 @@ sal_Bool VCLXAccessibleEdit::pasteText( sal_Int32 nIndex ) throw (IndexOutOfBoun } } - return bReturn; + return bReturn; } // ----------------------------------------------------------------------------- @@ -550,7 +550,7 @@ sal_Bool VCLXAccessibleEdit::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIn { OExternalLockGuard aGuard( this ); - return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() ); + return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() ); } // ----------------------------------------------------------------------------- @@ -559,7 +559,7 @@ sal_Bool VCLXAccessibleEdit::insertText( const ::rtl::OUString& sText, sal_Int32 { OExternalLockGuard aGuard( this ); - return replaceText( nIndex, nIndex, sText ); + return replaceText( nIndex, nIndex, sText ); } // ----------------------------------------------------------------------------- @@ -571,8 +571,8 @@ sal_Bool VCLXAccessibleEdit::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndI sal_Bool bReturn = sal_False; ::rtl::OUString sText( implGetText() ); - if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); + if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) ) + throw IndexOutOfBoundsException(); sal_Int32 nMinIndex = ::std::min( nStartIndex, nEndIndex ); sal_Int32 nMaxIndex = ::std::max( nStartIndex, nEndIndex ); @@ -595,10 +595,10 @@ sal_Bool VCLXAccessibleEdit::setAttributes( sal_Int32 nStartIndex, sal_Int32 nEn { OExternalLockGuard aGuard( this ); - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); + if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - return sal_False; // attributes cannot be set for an edit + return sal_False; // attributes cannot be set for an edit } // ----------------------------------------------------------------------------- @@ -607,16 +607,16 @@ sal_Bool VCLXAccessibleEdit::setText( const ::rtl::OUString& sText ) throw (Runt { OExternalLockGuard aGuard( this ); - sal_Bool bSuccess = sal_False; - try - { - bSuccess = replaceText( 0, implGetText().getLength(), sText ); - } - catch( const IndexOutOfBoundsException& ) - { - OSL_ENSURE( sal_False, "VCLXAccessibleText::setText: caught an exception!" ); - } - return bSuccess; + sal_Bool bSuccess = sal_False; + try + { + bSuccess = replaceText( 0, implGetText().getLength(), sText ); + } + catch( const IndexOutOfBoundsException& ) + { + OSL_ENSURE( sal_False, "VCLXAccessibleText::setText: caught an exception!" ); + } + return bSuccess; } // ----------------------------------------------------------------------------- diff --git a/main/accessibility/source/standard/vclxaccessiblelist.cxx b/main/accessibility/source/standard/vclxaccessiblelist.cxx index 1686fa8..3320b1b 100644 --- a/main/accessibility/source/standard/vclxaccessiblelist.cxx +++ b/main/accessibility/source/standard/vclxaccessiblelist.cxx @@ -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. - * + * *************************************************************/ @@ -52,7 +52,7 @@ using namespace ::accessibility; namespace { void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, sal_Bool bSelected ) - throw (::com::sun::star::lang::IndexOutOfBoundsException) + throw (::com::sun::star::lang::IndexOutOfBoundsException) { sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount() : (sal_Int32)_rListBox.GetEntryCount(); @@ -63,39 +63,39 @@ namespace VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType, const Reference< XAccessible >& _xParent) - : VCLXAccessibleComponent (pVCLWindow), - m_aBoxType (aBoxType), - m_nVisibleLineCount (0), - m_nIndexInParent (DEFAULT_INDEX_IN_PARENT), + : VCLXAccessibleComponent (pVCLWindow), + m_aBoxType (aBoxType), + m_nVisibleLineCount (0), + m_nIndexInParent (DEFAULT_INDEX_IN_PARENT), m_nLastTopEntry ( 0 ), m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), m_bDisableProcessEvent ( false ), m_bVisible ( true ), - m_nCurSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), - m_xParent ( _xParent ) + m_nCurSelectedPos ( LISTBOX_ENTRY_NOTFOUND ), + m_xParent ( _xParent ) { - // Because combo boxes and list boxes have the no common interface for - // methods with identical signature we have to write down twice the - // same code. - switch (m_aBoxType) - { - case COMBOBOX: - { - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); - if ( pBox != NULL ) - m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox); - break; - } - - case LISTBOX: - { - ListBox* pBox = static_cast<ListBox*>(GetWindow()); - if ( pBox != NULL ) - m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox); - break; - } - } - UpdateVisibleLineCount(); + // Because combo boxes and list boxes have the no common interface for + // methods with identical signature we have to write down twice the + // same code. + switch (m_aBoxType) + { + case COMBOBOX: + { + ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + if ( pBox != NULL ) + m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox); + break; + } + + case LISTBOX: + { + ListBox* pBox = static_cast<ListBox*>(GetWindow()); + if ( pBox != NULL ) + m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox); + break; + } + } + UpdateVisibleLineCount(); m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos(); sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount()); @@ -105,13 +105,13 @@ VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType VCLXAccessibleList::~VCLXAccessibleList (void) { - delete m_pListBoxHelper; + delete m_pListBoxHelper; } // ----------------------------------------------------------------------------- void VCLXAccessibleList::SetIndexInParent (sal_Int32 nIndex) { - m_nIndexInParent = nIndex; + m_nIndexInParent = nIndex; } // ----------------------------------------------------------------------------- @@ -119,7 +119,7 @@ void SAL_CALL VCLXAccessibleList::disposing (void) { VCLXAccessibleComponent::disposing(); - // Dispose all items in the list. + // Dispose all items in the list. clearItems(); delete m_pListBoxHelper; @@ -133,7 +133,7 @@ void VCLXAccessibleList::clearItems() // for (ListItems::iterator aIter = m_aAccessibleChildren.begin(); aIter != aEnd; ++aIter) // ::comphelper::disposeComponent(*aIter); - // Clear the list itself and delete all the rest. + // Clear the list itself and delete all the rest. ListItems().swap(m_aAccessibleChildren); // clear and minimize } // ----------------------------------------------------------------------------- @@ -144,8 +144,8 @@ void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); // check if our list should be visible - if ( m_pListBoxHelper - && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN + if ( m_pListBoxHelper + && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN && !m_pListBoxHelper->IsInDropDown() ) { rStateSet.RemoveState (AccessibleStateType::VISIBLE); @@ -153,16 +153,16 @@ void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& m_bVisible = false; } - // Both the combo box and list box are handled identical in the - // following but for some reason they don't have a common interface for - // the methods used. + // Both the combo box and list box are handled identical in the + // following but for some reason they don't have a common interface for + // the methods used. if ( m_pListBoxHelper ) { - if ( m_pListBoxHelper->IsMultiSelectionEnabled() ) - rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); + if ( m_pListBoxHelper->IsMultiSelectionEnabled() ) + rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE); rStateSet.AddState (AccessibleStateType::FOCUSABLE); - // All children are transient. - rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS); + // All children are transient. + rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS); } } // ----------------------------------------------------------------------------- @@ -177,7 +177,7 @@ void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew ) ListItems::iterator aIter = m_aAccessibleChildren.begin(); ListItems::iterator aEnd = m_aAccessibleChildren.end(); - UpdateVisibleLineCount(); + UpdateVisibleLineCount(); // adjust the index inside the VCLXAccessibleListItem for (;aIter != aEnd ; ++aIter) { @@ -188,29 +188,29 @@ void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew ) sal_uInt16 nTopEntry = 0; if ( m_pListBoxHelper ) nTopEntry = m_pListBoxHelper->GetTopEntry(); - sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin()); + sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin()); sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) ); pItem->SetVisible( m_bVisible && bVisible ); } - + } } // ----------------------------------------------------------------------------- void VCLXAccessibleList::UpdateSelection_Acc (::rtl::OUString sTextOfSelectedItem, bool b_IsDropDownList) { - if ( m_aBoxType == COMBOBOX ) - { - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); - if ( pBox != NULL ) - { + if ( m_aBoxType == COMBOBOX ) + { + ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + if ( pBox != NULL ) + { // Find the index of the selected item inside the VCL control... sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem)); // ...and then find the associated accessibility object. if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) nIndex = 0; UpdateSelection_Impl_Acc(b_IsDropDownList); - } - } + } + } } // ----------------------------------------------------------------------------- @@ -218,11 +218,11 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList) { uno::Any aOldValue, aNewValue; VCLXAccessibleListItem* pCurItem =NULL; - + { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - Reference< XAccessible > xNewAcc; + Reference< XAccessible > xNewAcc; if ( m_pListBoxHelper ) { sal_uInt16 i=0; @@ -238,7 +238,7 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList) sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i); if (bNowSelected) m_nCurSelectedPos = i; - + if ( bNowSelected && !pItem->IsSelected() ) { xNewAcc = *aIter; @@ -306,19 +306,19 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool b_IsDropDownList) AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - + NotifyListItem(aNewValue); } } } else if (m_aBoxType == LISTBOX && !b_IsDropDownList) { - //VCLXAccessibleListBox, xText = NULL. + //VCLXAccessibleListBox, xText = NULL. if ( aNewValue.hasValue()) { - NotifyListItem(aNewValue); + NotifyListItem(aNewValue); } } } @@ -333,17 +333,17 @@ void VCLXAccessibleList::NotifyListItem(::com::sun::star::uno::Any& val) { pCurItem->NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED,Any(),Any()); } - } + } } void VCLXAccessibleList::UpdateFocus_Impl_Acc (sal_uInt16 nPos ,bool b_IsDropDownList) -{ +{ if (!(m_aBoxType == LISTBOX && !b_IsDropDownList)) { return ; } - Reference<XAccessible> xChild= CreateChild(nPos); + Reference<XAccessible> xChild= CreateChild(nPos); if ( !xChild.is() ) { return ; @@ -351,7 +351,7 @@ void VCLXAccessibleList::UpdateFocus_Impl_Acc (sal_uInt16 nPos ,bool b_IsDropDow m_nCurSelectedPos = nPos; uno::Any aOldValue, aNewValue; aNewValue <<= xChild; - + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, @@ -359,10 +359,10 @@ void VCLXAccessibleList::UpdateFocus_Impl_Acc (sal_uInt16 nPos ,bool b_IsDropDow } // ----------------------------------------------------------------------------- -void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList) +void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList) { switch ( rVclWindowEvent.GetId() ) - { + { case VCLEVENT_DROPDOWN_SELECT: case VCLEVENT_LISTBOX_SELECT: if ( !m_bDisableProcessEvent ) @@ -379,7 +379,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); if (m_aBoxType == COMBOBOX && b_IsDropDownList) { - //VCLXAccessibleDropDownComboBox + //VCLXAccessibleDropDownComboBox } else if (m_aBoxType == LISTBOX && b_IsDropDownList) { @@ -388,7 +388,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve { if ( m_pListBoxHelper ) { - uno::Any aOldValue, + uno::Any aOldValue, aNewValue; sal_uInt16 nPos = m_nCurSelectedPos; //m_pListBoxHelper->GetSelectEntryPos(); @@ -405,18 +405,18 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve break; default: break; - } + } } // ----------------------------------------------------------------------------- void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) { - // Create a reference to this object to prevent an early release of the - // listbox (VCLEVENT_OBJECT_DYING). + // Create a reference to this object to prevent an early release of the + // listbox (VCLEVENT_OBJECT_DYING). Reference< XAccessible > xTemp = this; switch ( rVclWindowEvent.GetId() ) - { + { case VCLEVENT_DROPDOWN_OPEN: notifyVisibleStates(sal_True); break; @@ -430,31 +430,31 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve // The selection events VCLEVENT_COMBOBOX_SELECT and // VCLEVENT_COMBOBOX_DESELECT are not handled here because here we - // have no access to the edit field. Its text is necessary to + // have no access to the edit field. Its text is necessary to // identify the currently selected item. case VCLEVENT_OBJECT_DYING: { - dispose(); + dispose(); - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); - break; + VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); + break; } - case VCLEVENT_LISTBOX_ITEMREMOVED: - case VCLEVENT_COMBOBOX_ITEMREMOVED: - HandleChangedItemList (false, reinterpret_cast<sal_IntPtr>( - rVclWindowEvent.GetData())); - break; - - case VCLEVENT_LISTBOX_ITEMADDED: - case VCLEVENT_COMBOBOX_ITEMADDED: - HandleChangedItemList (true, reinterpret_cast<sal_IntPtr>( - rVclWindowEvent.GetData())); - break; + case VCLEVENT_LISTBOX_ITEMREMOVED: + case VCLEVENT_COMBOBOX_ITEMREMOVED: + HandleChangedItemList (false, reinterpret_cast<sal_IntPtr>( + rVclWindowEvent.GetData())); + break; + + case VCLEVENT_LISTBOX_ITEMADDED: + case VCLEVENT_COMBOBOX_ITEMADDED: + HandleChangedItemList (true, reinterpret_cast<sal_IntPtr>( + rVclWindowEvent.GetData())); + break; case VCLEVENT_CONTROL_GETFOCUS: { - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); + VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); // Added by IBM Symphony Acc team to handle the list item focus when List control get focus sal_Bool b_IsDropDownList = sal_True; if (m_pListBoxHelper) @@ -463,9 +463,9 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve { if ( m_pListBoxHelper ) { - uno::Any aOldValue, + uno::Any aOldValue, aNewValue; - sal_uInt16 nPos = m_nCurSelectedPos; + sal_uInt16 nPos = m_nCurSelectedPos; if ( nPos == LISTBOX_ENTRY_NOTFOUND ) nPos = m_pListBoxHelper->GetTopEntry(); @@ -479,15 +479,15 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve } break; - default: - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); - } + default: + VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); + } } void VCLXAccessibleList::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) { ListBox* pBox = static_cast<ListBox*>(GetWindow()); - if( m_aBoxType == LISTBOX ) + if( m_aBoxType == LISTBOX ) { if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN) { @@ -498,30 +498,30 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve } else { - VCLXAccessibleComponent::FillAccessibleRelationSet(rRelationSet); + VCLXAccessibleComponent::FillAccessibleRelationSet(rRelationSet); } } // ----------------------------------------------------------------------------- /** To find out which item is currently selected and to update the SELECTED - state of the associated accessibility objects accordingly we exploit the - fact that the + state of the associated accessibility objects accordingly we exploit the + fact that the */ void VCLXAccessibleList::UpdateSelection (::rtl::OUString sTextOfSelectedItem) { - if ( m_aBoxType == COMBOBOX ) - { - ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); - if ( pBox != NULL ) - { - // Find the index of the selected item inside the VCL control... - sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem)); - // ...and then find the associated accessibility object. + if ( m_aBoxType == COMBOBOX ) + { + ComboBox* pBox = static_cast<ComboBox*>(GetWindow()); + if ( pBox != NULL ) + { + // Find the index of the selected item inside the VCL control... + sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem)); + // ...and then find the associated accessibility object. if ( nIndex == LISTBOX_ENTRY_NOTFOUND ) nIndex = 0; UpdateSelection_Impl(nIndex); - } - } + } + } } // ----------------------------------------------------------------------------- @@ -542,7 +542,7 @@ void VCLXAccessibleList::adjustEntriesIndexInParent(ListItems::iterator& _aBegin Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i) { - Reference<XAccessible> xChild; + Reference<XAccessible> xChild; sal_uInt16 nPos = static_cast<sal_uInt16>(i); if ( nPos >= m_aAccessibleChildren.size() ) @@ -564,36 +564,36 @@ Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i) } } - if ( xChild.is() ) - { + if ( xChild.is() ) + { // Just add the SELECTED state. sal_Bool bNowSelected = sal_False; if ( m_pListBoxHelper ) bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i); if (bNowSelected) m_nCurSelectedPos = sal_uInt16(i); - VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get()); - pItem->SetSelected( bNowSelected ); + VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get()); + pItem->SetSelected( bNowSelected ); // Set the child's VISIBLE state. - UpdateVisibleLineCount(); + UpdateVisibleLineCount(); sal_uInt16 nTopEntry = 0; if ( m_pListBoxHelper ) nTopEntry = m_pListBoxHelper->GetTopEntry(); sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) ); pItem->SetVisible( m_bVisible && bVisible ); - } + } - return xChild; + return xChild; } // ----------------------------------------------------------------------------- void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex) { - clearItems(); - NotifyAccessibleEvent ( - AccessibleEventId::INVALIDATE_ALL_CHILDREN, - Any(), Any()); + clearItems(); + NotifyAccessibleEvent ( + AccessibleEventId::INVALIDATE_ALL_CHILDREN, + Any(), Any()); } // ----------------------------------------------------------------------------- @@ -603,8 +603,8 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VC //===== XAccessible ========================================================= Reference<XAccessibleContext> SAL_CALL - VCLXAccessibleList::getAccessibleContext (void) - throw (RuntimeException) + VCLXAccessibleList::getAccessibleContext (void) + throw (RuntimeException) { return this; } @@ -613,7 +613,7 @@ Reference<XAccessibleContext> SAL_CALL //===== XAccessibleContext ================================================== sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void) - throw (RuntimeException) + throw (RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -622,12 +622,12 @@ sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void) if ( m_pListBoxHelper ) nCount = m_pListBoxHelper->GetEntryCount(); - return nCount; + return nCount; } // ----------------------------------------------------------------------------- Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i) - throw (IndexOutOfBoundsException, RuntimeException) + throw (IndexOutOfBoundsException, RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -635,8 +635,8 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int3 if ( i < 0 || i >= getAccessibleChildCount() ) throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - // search for the child + Reference< XAccessible > xChild; + // search for the child if ( i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) ) xChild = CreateChild (i); else @@ -646,7 +646,7 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int3 xChild = CreateChild (i); } OSL_ENSURE( xChild.is(), "VCLXAccessibleList::getAccessibleChild: returning empty child!" ); - return xChild; + return xChild; } // ----------------------------------------------------------------------------- @@ -660,19 +660,19 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent( ) // ----------------------------------------------------------------------------- sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent (void) - throw (::com::sun::star::uno::RuntimeException) + throw (::com::sun::star::uno::RuntimeException) { - if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) - return m_nIndexInParent; - else - return VCLXAccessibleComponent::getAccessibleIndexInParent(); + if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT) + return m_nIndexInParent; + else + return VCLXAccessibleComponent::getAccessibleIndexInParent(); } // ----------------------------------------------------------------------------- sal_Int16 SAL_CALL VCLXAccessibleList::getAccessibleRole (void) - throw (RuntimeException) + throw (RuntimeException) { - return AccessibleRole::LIST; + return AccessibleRole::LIST; } // ----------------------------------------------------------------------------- @@ -685,8 +685,8 @@ sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw sal_Bool bInside = sal_False; - Window* pListBox = GetWindow(); - if ( pListBox ) + Window* pListBox = GetWindow(); + if ( pListBox ) { Rectangle aRect( Point(0,0), pListBox->GetSizePixel() ); bInside = aRect.IsInside( VCLPoint( rPoint ) ); @@ -697,7 +697,7 @@ sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw // ----------------------------------------------------------------------------- Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt::Point& rPoint ) - throw (RuntimeException) + throw (RuntimeException) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); @@ -705,7 +705,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt Reference< XAccessible > xChild; if ( m_pListBoxHelper ) { - UpdateVisibleLineCount(); + UpdateVisibleLineCount(); if ( contains( rPoint ) && m_nVisibleLineCount > 0 ) { Point aPos = VCLPoint( rPoint ); @@ -721,21 +721,21 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt } } - return xChild; + return xChild; } // ----------------------------------------------------------------------------- //===== XServiceInfo ========================================================== ::rtl::OUString VCLXAccessibleList::getImplementationName (void) - throw (RuntimeException) + throw (RuntimeException) { return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleList")); } // ----------------------------------------------------------------------------- Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void) - throw (RuntimeException) + throw (RuntimeException) { Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames(); sal_Int32 nLength = aNames.getLength(); @@ -747,7 +747,7 @@ Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void) void VCLXAccessibleList::UpdateVisibleLineCount() { - if ( m_pListBoxHelper ) + if ( m_pListBoxHelper ) { if ( (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) m_nVisibleLineCount = m_pListBoxHelper->GetDisplayLineCount(); @@ -773,7 +773,7 @@ void VCLXAccessibleList::UpdateEntryRange_Impl() nTop = m_pListBoxHelper->GetTopEntry(); if ( nTop != m_nLastTopEntry ) { - UpdateVisibleLineCount(); + UpdateVisibleLineCount(); sal_Int32 nBegin = Min( m_nLastTopEntry, nTop ); sal_Int32 nEnd = Max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount ); for (sal_uInt16 i = static_cast<sal_uInt16>(nBegin); (i <= static_cast<sal_uInt16>(nEnd)); ++i) @@ -817,7 +817,7 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - Reference< XAccessible > xNewAcc; + Reference< XAccessible > xNewAcc; if ( m_pListBoxHelper ) { @@ -904,7 +904,7 @@ void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex ) } if ( bNotify ) - UpdateSelection_Impl(); + UpdateSelection_Impl(); } // ----------------------------------------------------------------------------- sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) @@ -912,14 +912,14 @@ sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChil vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - sal_Bool bRet = sal_False; + sal_Bool bRet = sal_False; if ( m_pListBoxHelper ) { checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False); - bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex ); + bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex ); } - return bRet; + return bRet; } // ----------------------------------------------------------------------------- void SAL_CALL VCLXAccessibleList::clearAccessibleSelection( ) throw (RuntimeException) @@ -932,13 +932,13 @@ void SAL_CALL VCLXAccessibleList::clearAccessibleSelection( ) throw (RuntimeExc if ( m_pListBoxHelper ) { - m_pListBoxHelper->SetNoSelection(); + m_pListBoxHelper->SetNoSelection(); bNotify = sal_True; } } if ( bNotify ) - UpdateSelection_Impl(); + UpdateSelection_Impl(); } // ----------------------------------------------------------------------------- void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( ) throw (RuntimeException) @@ -951,9 +951,9 @@ void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( ) throw (Runtime if ( m_pListBoxHelper ) { - sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); - for ( sal_uInt16 i = 0; i < nCount; ++i ) - m_pListBoxHelper->SelectEntryPos( i, sal_True ); + sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount(); + for ( sal_uInt16 i = 0; i < nCount; ++i ) + m_pListBoxHelper->SelectEntryPos( i, sal_True ); // call the select handler, don't handle events in this time m_bDisableProcessEvent = true; m_pListBoxHelper->Select(); @@ -963,7 +963,7 @@ void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( ) throw (Runtime } if ( bNotify ) - UpdateSelection_Impl(); + UpdateSelection_Impl(); } // ----------------------------------------------------------------------------- sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( ) throw (RuntimeException) @@ -971,10 +971,10 @@ sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( ) throw vos::OGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - sal_Int32 nCount = 0; + sal_Int32 nCount = 0; if ( m_pListBoxHelper ) - nCount = m_pListBoxHelper->GetSelectEntryCount(); - return nCount; + nCount = m_pListBoxHelper->GetSelectEntryCount(); + return nCount; } // ----------------------------------------------------------------------------- Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) @@ -1013,14 +1013,14 @@ void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedCh } if ( bNotify ) - UpdateSelection_Impl(); + UpdateSelection_Impl(); } // ----------------------------------------------------------------------------- // accessibility::XAccessibleComponent awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException) { awt::Rectangle aBounds ( 0, 0, 0, 0 ); - if ( m_pListBoxHelper + if ( m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) { if ( m_pListBoxHelper->IsInDropDown() ) @@ -1053,7 +1053,7 @@ awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeExcept ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); awt::Point aPos; - if ( m_pListBoxHelper + if ( m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) { if ( m_pListBoxHelper->IsInDropDown() ) @@ -1074,7 +1074,7 @@ awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeExcept return aPos; } // ----------------------------------------------------------------------------- -sal_Bool VCLXAccessibleList::IsInDropDown() +sal_Bool VCLXAccessibleList::IsInDropDown() { return m_pListBoxHelper->IsInDropDown(); }