vclxaccessibletabcontrol.cxx (4d7c9de0) | vclxaccessibletabcontrol.cxx (15466770) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 2 * |
3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_accessibility.hxx" 26#include <accessibility/standard/vclxaccessibletabcontrol.hxx> 27#include <accessibility/standard/vclxaccessibletabpage.hxx> --- 66 unchanged lines hidden (view full) --- 94 } 95 } 96} 97 98// ----------------------------------------------------------------------------- 99 100void VCLXAccessibleTabControl::UpdatePageText( sal_Int32 i ) 101{ | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_accessibility.hxx" 26#include <accessibility/standard/vclxaccessibletabcontrol.hxx> 27#include <accessibility/standard/vclxaccessibletabpage.hxx> --- 66 unchanged lines hidden (view full) --- 94 } 95 } 96} 97 98// ----------------------------------------------------------------------------- 99 100void VCLXAccessibleTabControl::UpdatePageText( sal_Int32 i ) 101{ |
102 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) 103 { 104 Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); 105 if ( xChild.is() ) 106 { 107 VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); 108 if ( pVCLXAccessibleTabPage ) 109 pVCLXAccessibleTabPage->SetPageText( pVCLXAccessibleTabPage->GetPageText() ); 110 } 111 } | 102 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) 103 { 104 Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); 105 if ( xChild.is() ) 106 { 107 VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); 108 if ( pVCLXAccessibleTabPage ) 109 pVCLXAccessibleTabPage->SetPageText( pVCLXAccessibleTabPage->GetPageText() ); 110 } 111 } |
112} 113 114// ----------------------------------------------------------------------------- 115 116void VCLXAccessibleTabControl::UpdateTabPage( sal_Int32 i, bool bNew ) 117{ 118 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) 119 { --- 52 unchanged lines hidden (view full) --- 172 } 173 } 174} 175 176// ----------------------------------------------------------------------------- 177 178void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) 179{ | 112} 113 114// ----------------------------------------------------------------------------- 115 116void VCLXAccessibleTabControl::UpdateTabPage( sal_Int32 i, bool bNew ) 117{ 118 if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() ) 119 { --- 52 unchanged lines hidden (view full) --- 172 } 173 } 174} 175 176// ----------------------------------------------------------------------------- 177 178void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) 179{ |
180 switch ( rVclWindowEvent.GetId() ) 181 { | 180 switch ( rVclWindowEvent.GetId() ) 181 { |
182 case VCLEVENT_TABPAGE_ACTIVATE: 183 case VCLEVENT_TABPAGE_DEACTIVATE: | 182 case VCLEVENT_TABPAGE_ACTIVATE: 183 case VCLEVENT_TABPAGE_DEACTIVATE: |
184 { | 184 { |
185 if ( m_pTabControl ) 186 { | 185 if ( m_pTabControl ) 186 { |
187 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); | 187 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); |
188 sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); | 188 sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); |
189 UpdateFocused(); | 189 UpdateFocused(); |
190 UpdateSelected( nPagePos, rVclWindowEvent.GetId() == VCLEVENT_TABPAGE_ACTIVATE ); 191 } | 190 UpdateSelected( nPagePos, rVclWindowEvent.GetId() == VCLEVENT_TABPAGE_ACTIVATE ); 191 } |
192 } 193 break; | 192 } 193 break; |
194 case VCLEVENT_TABPAGE_PAGETEXTCHANGED: | 194 case VCLEVENT_TABPAGE_PAGETEXTCHANGED: |
195 { | 195 { |
196 if ( m_pTabControl ) 197 { | 196 if ( m_pTabControl ) 197 { |
198 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); | 198 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); |
199 sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); 200 UpdatePageText( nPagePos ); 201 } | 199 sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); 200 UpdatePageText( nPagePos ); 201 } |
202 } 203 break; | 202 } 203 break; |
204 case VCLEVENT_TABPAGE_INSERTED: | 204 case VCLEVENT_TABPAGE_INSERTED: |
205 { | 205 { |
206 if ( m_pTabControl ) 207 { | 206 if ( m_pTabControl ) 207 { |
208 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); | 208 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); |
209 sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); 210 InsertChild( nPagePos ); 211 } | 209 sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId ); 210 InsertChild( nPagePos ); 211 } |
212 } 213 break; | 212 } 213 break; |
214 case VCLEVENT_TABPAGE_REMOVED: | 214 case VCLEVENT_TABPAGE_REMOVED: |
215 { | 215 { |
216 if ( m_pTabControl ) 217 { | 216 if ( m_pTabControl ) 217 { |
218 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); | 218 sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData(); |
219 for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) 220 { 221 Reference< XAccessible > xChild( getAccessibleChild( i ) ); 222 if ( xChild.is() ) 223 { 224 VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); 225 if ( pVCLXAccessibleTabPage && pVCLXAccessibleTabPage->GetPageId() == nPageId ) 226 { 227 RemoveChild( i ); 228 break; 229 } 230 } 231 } 232 } | 219 for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i ) 220 { 221 Reference< XAccessible > xChild( getAccessibleChild( i ) ); 222 if ( xChild.is() ) 223 { 224 VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() ); 225 if ( pVCLXAccessibleTabPage && pVCLXAccessibleTabPage->GetPageId() == nPageId ) 226 { 227 RemoveChild( i ); 228 break; 229 } 230 } 231 } 232 } |
233 } 234 break; | 233 } 234 break; |
235 case VCLEVENT_TABPAGE_REMOVEDALL: | 235 case VCLEVENT_TABPAGE_REMOVEDALL: |
236 { | 236 { |
237 for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) 238 RemoveChild( i ); | 237 for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i ) 238 RemoveChild( i ); |
239 } 240 break; | 239 } 240 break; |
241 case VCLEVENT_WINDOW_GETFOCUS: 242 case VCLEVENT_WINDOW_LOSEFOCUS: | 241 case VCLEVENT_WINDOW_GETFOCUS: 242 case VCLEVENT_WINDOW_LOSEFOCUS: |
243 { 244 UpdateFocused(); 245 } 246 break; | 243 { 244 UpdateFocused(); 245 } 246 break; |
247 case VCLEVENT_OBJECT_DYING: | 247 case VCLEVENT_OBJECT_DYING: |
248 { | 248 { |
249 if ( m_pTabControl ) 250 { 251 m_pTabControl = NULL; 252 253 // dispose all tab pages 254 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) 255 { 256 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); 257 if ( xComponent.is() ) 258 xComponent->dispose(); 259 } | 249 if ( m_pTabControl ) 250 { 251 m_pTabControl = NULL; 252 253 // dispose all tab pages 254 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) 255 { 256 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); 257 if ( xComponent.is() ) 258 xComponent->dispose(); 259 } |
260 m_aAccessibleChildren.clear(); | 260 m_aAccessibleChildren.clear(); |
261 } 262 263 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); | 261 } 262 263 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); |
264 } 265 break; | 264 } 265 break; |
266 default: 267 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); | 266 default: 267 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent ); |
268 } | 268 } |
269} 270 271// ----------------------------------------------------------------------------- 272 273void VCLXAccessibleTabControl::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) 274{ 275 switch ( rVclWindowEvent.GetId() ) 276 { 277 case VCLEVENT_WINDOW_SHOW: | 269} 270 271// ----------------------------------------------------------------------------- 272 273void VCLXAccessibleTabControl::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) 274{ 275 switch ( rVclWindowEvent.GetId() ) 276 { 277 case VCLEVENT_WINDOW_SHOW: |
278 case VCLEVENT_WINDOW_HIDE: 279 { 280 if ( m_pTabControl ) 281 { 282 Window* pChild = static_cast< Window* >( rVclWindowEvent.GetData() ); 283 if ( pChild && pChild->GetType() == WINDOW_TABPAGE ) 284 { 285 for ( sal_Int32 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i ) 286 { 287 sal_uInt16 nPageId = m_pTabControl->GetPageId( (sal_uInt16)i ); 288 TabPage* pTabPage = m_pTabControl->GetTabPage( nPageId ); 289 if ( pTabPage == (TabPage*) pChild ) 290 UpdateTabPage( i, rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW ); 291 } 292 } 293 } 294 } 295 break; | 278 case VCLEVENT_WINDOW_HIDE: 279 { 280 if ( m_pTabControl ) 281 { 282 Window* pChild = static_cast< Window* >( rVclWindowEvent.GetData() ); 283 if ( pChild && pChild->GetType() == WINDOW_TABPAGE ) 284 { 285 for ( sal_Int32 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i ) 286 { 287 sal_uInt16 nPageId = m_pTabControl->GetPageId( (sal_uInt16)i ); 288 TabPage* pTabPage = m_pTabControl->GetTabPage( nPageId ); 289 if ( pTabPage == (TabPage*) pChild ) 290 UpdateTabPage( i, rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW ); 291 } 292 } 293 } 294 } 295 break; |
296 default: 297 VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); 298 } 299} 300 301 302// ----------------------------------------------------------------------------- 303 --- 31 unchanged lines hidden (view full) --- 335 336 // dispose all tab pages 337 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) 338 { 339 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); 340 if ( xComponent.is() ) 341 xComponent->dispose(); 342 } | 296 default: 297 VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent ); 298 } 299} 300 301 302// ----------------------------------------------------------------------------- 303 --- 31 unchanged lines hidden (view full) --- 335 336 // dispose all tab pages 337 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) 338 { 339 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); 340 if ( xComponent.is() ) 341 xComponent->dispose(); 342 } |
343 m_aAccessibleChildren.clear(); | 343 m_aAccessibleChildren.clear(); |
344 } 345} 346 347// ----------------------------------------------------------------------------- 348// XServiceInfo 349// ----------------------------------------------------------------------------- 350 351::rtl::OUString VCLXAccessibleTabControl::getImplementationName() throw (RuntimeException) --- 13 unchanged lines hidden (view full) --- 365// ----------------------------------------------------------------------------- 366// XAccessibleContext 367// ----------------------------------------------------------------------------- 368 369sal_Int32 VCLXAccessibleTabControl::getAccessibleChildCount() throw (RuntimeException) 370{ 371 OExternalLockGuard aGuard( this ); 372 | 344 } 345} 346 347// ----------------------------------------------------------------------------- 348// XServiceInfo 349// ----------------------------------------------------------------------------- 350 351::rtl::OUString VCLXAccessibleTabControl::getImplementationName() throw (RuntimeException) --- 13 unchanged lines hidden (view full) --- 365// ----------------------------------------------------------------------------- 366// XAccessibleContext 367// ----------------------------------------------------------------------------- 368 369sal_Int32 VCLXAccessibleTabControl::getAccessibleChildCount() throw (RuntimeException) 370{ 371 OExternalLockGuard aGuard( this ); 372 |
373 return m_aAccessibleChildren.size(); | 373 return m_aAccessibleChildren.size(); |
374} 375 376// ----------------------------------------------------------------------------- 377 378Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) 379{ 380 OExternalLockGuard aGuard( this ); 381 --- 9 unchanged lines hidden (view full) --- 391 392 xChild = new VCLXAccessibleTabPage( m_pTabControl, nPageId ); 393 394 // insert into tab page list 395 m_aAccessibleChildren[i] = xChild; 396 } 397 } 398 | 374} 375 376// ----------------------------------------------------------------------------- 377 378Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) 379{ 380 OExternalLockGuard aGuard( this ); 381 --- 9 unchanged lines hidden (view full) --- 391 392 xChild = new VCLXAccessibleTabPage( m_pTabControl, nPageId ); 393 394 // insert into tab page list 395 m_aAccessibleChildren[i] = xChild; 396 } 397 } 398 |
399 return xChild; | 399 return xChild; |
400} 401 402// ----------------------------------------------------------------------------- 403 404sal_Int16 VCLXAccessibleTabControl::getAccessibleRole( ) throw (RuntimeException) 405{ 406 OExternalLockGuard aGuard( this ); 407 --- 22 unchanged lines hidden (view full) --- 430 431 if ( m_pTabControl ) 432 m_pTabControl->SelectTabPage( m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) ); 433} 434 435// ----------------------------------------------------------------------------- 436 437sal_Bool VCLXAccessibleTabControl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) | 400} 401 402// ----------------------------------------------------------------------------- 403 404sal_Int16 VCLXAccessibleTabControl::getAccessibleRole( ) throw (RuntimeException) 405{ 406 OExternalLockGuard aGuard( this ); 407 --- 22 unchanged lines hidden (view full) --- 430 431 if ( m_pTabControl ) 432 m_pTabControl->SelectTabPage( m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) ); 433} 434 435// ----------------------------------------------------------------------------- 436 437sal_Bool VCLXAccessibleTabControl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) |
438{ 439 OExternalLockGuard aGuard( this ); | 438{ 439 OExternalLockGuard aGuard( this ); |
440 | 440 |
441 if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) 442 throw IndexOutOfBoundsException(); | 441 if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) 442 throw IndexOutOfBoundsException(); |
443 | 443 |
444 sal_Bool bSelected = sal_False; 445 if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) ) 446 bSelected = sal_True; | 444 sal_Bool bSelected = sal_False; 445 if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) ) 446 bSelected = sal_True; |
447 | 447 |
448 return bSelected; | 448 return bSelected; |
449} 450 451// ----------------------------------------------------------------------------- 452 453void VCLXAccessibleTabControl::clearAccessibleSelection( ) throw (RuntimeException) 454{ 455 // This method makes no sense in a tab control, and so does nothing. 456} --- 23 unchanged lines hidden (view full) --- 480 OExternalLockGuard aGuard( this ); 481 482 if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) 483 throw IndexOutOfBoundsException(); 484 485 Reference< XAccessible > xChild; 486 487 for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) | 449} 450 451// ----------------------------------------------------------------------------- 452 453void VCLXAccessibleTabControl::clearAccessibleSelection( ) throw (RuntimeException) 454{ 455 // This method makes no sense in a tab control, and so does nothing. 456} --- 23 unchanged lines hidden (view full) --- 480 OExternalLockGuard aGuard( this ); 481 482 if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) 483 throw IndexOutOfBoundsException(); 484 485 Reference< XAccessible > xChild; 486 487 for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) |
488 { | 488 { |
489 if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) 490 { 491 xChild = getAccessibleChild( i ); 492 break; 493 } 494 } 495 496 return xChild; --- 15 unchanged lines hidden --- | 489 if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) 490 { 491 xChild = getAccessibleChild( i ); 492 break; 493 } 494 } 495 496 return xChild; --- 15 unchanged lines hidden --- |