vclxaccessibletoolboxitem.cxx (144e4e62) vclxaccessibletoolboxitem.cxx (aa5a148e)
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/vclxaccessibletoolboxitem.hxx>
27#include <toolkit/helper/convert.hxx>

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

69 AccessibleTextHelper_BASE( new VCLExternalSolarLock() ),
70
71 m_pToolBox ( _pToolBox ),
72 m_nIndexInParent( _nPos ),
73 m_nRole ( AccessibleRole::PUSH_BUTTON ),
74 m_nItemId ( 0 ),
75 m_bHasFocus ( sal_False ),
76 m_bIsChecked ( sal_False ),
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_accessibility.hxx"
26#include <accessibility/standard/vclxaccessibletoolboxitem.hxx>
27#include <toolkit/helper/convert.hxx>

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

69 AccessibleTextHelper_BASE( new VCLExternalSolarLock() ),
70
71 m_pToolBox ( _pToolBox ),
72 m_nIndexInParent( _nPos ),
73 m_nRole ( AccessibleRole::PUSH_BUTTON ),
74 m_nItemId ( 0 ),
75 m_bHasFocus ( sal_False ),
76 m_bIsChecked ( sal_False ),
77 m_bIndeterminate( false )
77 m_bIndeterminate( false )
78
79{
80 DBG_CTOR( VCLXAccessibleToolBoxItem, NULL );
81
82 m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) );
83
84 DBG_ASSERT( m_pToolBox, "invalid toolbox" );
85 m_nItemId = m_pToolBox->GetItemId( (sal_uInt16)m_nIndexInParent );
86 m_sOldName = GetText( true );
78
79{
80 DBG_CTOR( VCLXAccessibleToolBoxItem, NULL );
81
82 m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) );
83
84 DBG_ASSERT( m_pToolBox, "invalid toolbox" );
85 m_nItemId = m_pToolBox->GetItemId( (sal_uInt16)m_nIndexInParent );
86 m_sOldName = GetText( true );
87 m_bIsChecked = m_pToolBox->IsItemChecked( m_nItemId );
88 m_bIndeterminate = ( m_pToolBox->GetItemState( m_nItemId ) == STATE_DONTKNOW );
87 m_bIsChecked = m_pToolBox->IsItemChecked( m_nItemId );
88 m_bIndeterminate = ( m_pToolBox->GetItemState( m_nItemId ) == STATE_DONTKNOW );
89 ToolBoxItemType eType = m_pToolBox->GetItemType( (sal_uInt16)m_nIndexInParent );
90 switch ( eType )
91 {
92 case TOOLBOXITEM_BUTTON :
93 {
89 ToolBoxItemType eType = m_pToolBox->GetItemType( (sal_uInt16)m_nIndexInParent );
90 switch ( eType )
91 {
92 case TOOLBOXITEM_BUTTON :
93 {
94 ToolBoxItemBits nBits = m_pToolBox->GetItemBits( m_nItemId );
95 if (( nBits & TIB_DROPDOWN ) == TIB_DROPDOWN)
94 ToolBoxItemBits nBits = m_pToolBox->GetItemBits( m_nItemId );
95 if (( nBits & TIB_DROPDOWN ) == TIB_DROPDOWN)
96 m_nRole = AccessibleRole::BUTTON_DROPDOWN;
97 else if (( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE ) ||
96 m_nRole = AccessibleRole::BUTTON_DROPDOWN;
97 else if (( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE ) ||
98 ( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK ) )
98 ( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK ) )
99 m_nRole = AccessibleRole::TOGGLE_BUTTON;
100 else if ( (nBits & TIB_DROPDOWN) == TIB_DROPDOWN )
101 {
102 m_nRole = AccessibleRole::BUTTON_DROPDOWN;
103 }
104 else if ( m_pToolBox->GetItemWindow( m_nItemId ) )
105 m_nRole = AccessibleRole::PANEL;
106 break;

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

143// if ( pItemWindow && pItemWindow->GetAccessible().is() &&
144// pItemWindow->GetAccessible()->getAccessibleContext().is() )
145// {
146// ::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
147// if ( ( sRet.getLength() > 0 ) && ( sWinText.getLength() > 0 ) )
148// sRet += String( RTL_CONSTASCII_USTRINGPARAM( " " ) );
149// sRet += sWinText;
150// }
99 m_nRole = AccessibleRole::TOGGLE_BUTTON;
100 else if ( (nBits & TIB_DROPDOWN) == TIB_DROPDOWN )
101 {
102 m_nRole = AccessibleRole::BUTTON_DROPDOWN;
103 }
104 else if ( m_pToolBox->GetItemWindow( m_nItemId ) )
105 m_nRole = AccessibleRole::PANEL;
106 break;

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

143// if ( pItemWindow && pItemWindow->GetAccessible().is() &&
144// pItemWindow->GetAccessible()->getAccessibleContext().is() )
145// {
146// ::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
147// if ( ( sRet.getLength() > 0 ) && ( sWinText.getLength() > 0 ) )
148// sRet += String( RTL_CONSTASCII_USTRINGPARAM( " " ) );
149// sRet += sWinText;
150// }
151 if ( sRet.isEmpty() )
151 if ( sRet.isEmpty() )
152 {
153 Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
154 if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() &&
155 pItemWindow->GetAccessible()->getAccessibleContext().is() )
156 {
157 ::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
158 if ( !sWinText.isEmpty() )
159 sRet = sWinText;

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

170 {
171 Any aOldValue;
172 Any aNewValue;
173 if ( m_bHasFocus )
174 aOldValue <<= AccessibleStateType::FOCUSED;
175 else
176 aNewValue <<= AccessibleStateType::FOCUSED;
177 m_bHasFocus = _bFocus;
152 {
153 Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
154 if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() &&
155 pItemWindow->GetAccessible()->getAccessibleContext().is() )
156 {
157 ::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
158 if ( !sWinText.isEmpty() )
159 sRet = sWinText;

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

170 {
171 Any aOldValue;
172 Any aNewValue;
173 if ( m_bHasFocus )
174 aOldValue <<= AccessibleStateType::FOCUSED;
175 else
176 aNewValue <<= AccessibleStateType::FOCUSED;
177 m_bHasFocus = _bFocus;
178 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
178 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
179 }
180}
181// -----------------------------------------------------------------------------
182void VCLXAccessibleToolBoxItem::SetChecked( sal_Bool _bCheck )
183{
184 if( m_nRole == AccessibleRole::PANEL)
185 return;
186 if ( m_bIsChecked != _bCheck )
187 {
188 Any aOldValue;
189 Any aNewValue;
190 if ( m_bIsChecked )
191 aOldValue <<= AccessibleStateType::CHECKED;
192 else
193 aNewValue <<= AccessibleStateType::CHECKED;
194 m_bIsChecked = _bCheck;
179 }
180}
181// -----------------------------------------------------------------------------
182void VCLXAccessibleToolBoxItem::SetChecked( sal_Bool _bCheck )
183{
184 if( m_nRole == AccessibleRole::PANEL)
185 return;
186 if ( m_bIsChecked != _bCheck )
187 {
188 Any aOldValue;
189 Any aNewValue;
190 if ( m_bIsChecked )
191 aOldValue <<= AccessibleStateType::CHECKED;
192 else
193 aNewValue <<= AccessibleStateType::CHECKED;
194 m_bIsChecked = _bCheck;
195 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
195 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
196 }
197}
198// -----------------------------------------------------------------------------
199void VCLXAccessibleToolBoxItem::SetIndeterminate( bool _bIndeterminate )
200{
201 if ( m_bIndeterminate != _bIndeterminate )
202 {
203 Any aOldValue, aNewValue;
204 if ( m_bIndeterminate )
205 aOldValue <<= AccessibleStateType::INDETERMINATE;
206 else
207 aNewValue <<= AccessibleStateType::INDETERMINATE;
208 m_bIndeterminate = _bIndeterminate;
196 }
197}
198// -----------------------------------------------------------------------------
199void VCLXAccessibleToolBoxItem::SetIndeterminate( bool _bIndeterminate )
200{
201 if ( m_bIndeterminate != _bIndeterminate )
202 {
203 Any aOldValue, aNewValue;
204 if ( m_bIndeterminate )
205 aOldValue <<= AccessibleStateType::INDETERMINATE;
206 else
207 aNewValue <<= AccessibleStateType::INDETERMINATE;
208 m_bIndeterminate = _bIndeterminate;
209 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
209 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
210 }
211}
212// -----------------------------------------------------------------------------
213void VCLXAccessibleToolBoxItem::NameChanged()
214{
215 ::rtl::OUString sNewName = implGetText();
216 if ( sNewName != m_sOldName )
217 {
218 Any aOldValue, aNewValue;
219 aOldValue <<= m_sOldName;
220 // save new name as old name for next change
221 m_sOldName = sNewName;
222 aNewValue <<= m_sOldName;
223 NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
224 }
225}
226// -----------------------------------------------------------------------------
227void VCLXAccessibleToolBoxItem::SetChild( const Reference< XAccessible >& _xChild )
228{
210 }
211}
212// -----------------------------------------------------------------------------
213void VCLXAccessibleToolBoxItem::NameChanged()
214{
215 ::rtl::OUString sNewName = implGetText();
216 if ( sNewName != m_sOldName )
217 {
218 Any aOldValue, aNewValue;
219 aOldValue <<= m_sOldName;
220 // save new name as old name for next change
221 m_sOldName = sNewName;
222 aNewValue <<= m_sOldName;
223 NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
224 }
225}
226// -----------------------------------------------------------------------------
227void VCLXAccessibleToolBoxItem::SetChild( const Reference< XAccessible >& _xChild )
228{
229 m_xChild = _xChild;
229 m_xChild = _xChild;
230}
231// -----------------------------------------------------------------------------
232void VCLXAccessibleToolBoxItem::NotifyChildEvent( const Reference< XAccessible >& _xChild, bool _bShow )
233{
230}
231// -----------------------------------------------------------------------------
232void VCLXAccessibleToolBoxItem::NotifyChildEvent( const Reference< XAccessible >& _xChild, bool _bShow )
233{
234 Any aOld = _bShow ? Any() : makeAny( _xChild );
235 Any aNew = _bShow ? makeAny( _xChild ) : Any();
236 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOld, aNew );
234 Any aOld = _bShow ? Any() : makeAny( _xChild );
235 Any aNew = _bShow ? makeAny( _xChild ) : Any();
236 NotifyAccessibleEvent( AccessibleEventId::CHILD, aOld, aNew );
237}
238// -----------------------------------------------------------------------------
239void VCLXAccessibleToolBoxItem::ToggleEnableState()
240{
237}
238// -----------------------------------------------------------------------------
239void VCLXAccessibleToolBoxItem::ToggleEnableState()
240{
241 Any aOldValue[2], aNewValue[2];
242 if ( m_pToolBox->IsItemEnabled( m_nItemId ) )
243 {
244 aNewValue[0] <<= AccessibleStateType::SENSITIVE;
245 aNewValue[1] <<= AccessibleStateType::ENABLED;
246 }
247 else
248 {
249 aOldValue[0] <<= AccessibleStateType::ENABLED;
250 aOldValue[1] <<= AccessibleStateType::SENSITIVE;
251 }
241 Any aOldValue[2], aNewValue[2];
242 if ( m_pToolBox->IsItemEnabled( m_nItemId ) )
243 {
244 aNewValue[0] <<= AccessibleStateType::SENSITIVE;
245 aNewValue[1] <<= AccessibleStateType::ENABLED;
246 }
247 else
248 {
249 aOldValue[0] <<= AccessibleStateType::ENABLED;
250 aOldValue[1] <<= AccessibleStateType::SENSITIVE;
251 }
252
252
253 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
254 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
253 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
254 NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
255}
256// -----------------------------------------------------------------------------
257awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::implGetBounds( ) throw (RuntimeException)
258{
259 awt::Rectangle aRect;
260 if ( m_pToolBox )
261 aRect = AWTRectangle( m_pToolBox->GetItemPosRect( (sal_uInt16)m_nIndexInParent ) );
262

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

362
363 return m_xChild;
364}
365// -----------------------------------------------------------------------------
366Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleParent( ) throw (RuntimeException)
367{
368 OContextEntryGuard aGuard( this );
369
255}
256// -----------------------------------------------------------------------------
257awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::implGetBounds( ) throw (RuntimeException)
258{
259 awt::Rectangle aRect;
260 if ( m_pToolBox )
261 aRect = AWTRectangle( m_pToolBox->GetItemPosRect( (sal_uInt16)m_nIndexInParent ) );
262

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

362
363 return m_xChild;
364}
365// -----------------------------------------------------------------------------
366Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleParent( ) throw (RuntimeException)
367{
368 OContextEntryGuard aGuard( this );
369
370 return m_pToolBox->GetAccessible();
370 return m_pToolBox->GetAccessible();
371}
372// -----------------------------------------------------------------------------
373sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleIndexInParent( ) throw (RuntimeException)
374{
375 OContextEntryGuard aGuard( this );
376
377 return m_nIndexInParent;
378}

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

383
384 return m_nRole;
385}
386// -----------------------------------------------------------------------------
387::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( ) throw (RuntimeException)
388{
389 OExternalLockGuard aGuard( this );
390
371}
372// -----------------------------------------------------------------------------
373sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleIndexInParent( ) throw (RuntimeException)
374{
375 OContextEntryGuard aGuard( this );
376
377 return m_nIndexInParent;
378}

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

383
384 return m_nRole;
385}
386// -----------------------------------------------------------------------------
387::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( ) throw (RuntimeException)
388{
389 OExternalLockGuard aGuard( this );
390
391
391
392 if(m_nRole == AccessibleRole::PANEL && getAccessibleChildCount() > 0 )
393 {
394 return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION ) );
395 }
396 else
397 {
398 ::rtl::OUString sDescription;
399 if ( m_pToolBox )

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

412}
413// -----------------------------------------------------------------------------
414Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRelationSet( ) throw (RuntimeException)
415{
416 OContextEntryGuard aGuard( this );
417
418 utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
419 Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
392 if(m_nRole == AccessibleRole::PANEL && getAccessibleChildCount() > 0 )
393 {
394 return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_PANEL_DESCRIPTION ) );
395 }
396 else
397 {
398 ::rtl::OUString sDescription;
399 if ( m_pToolBox )

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

412}
413// -----------------------------------------------------------------------------
414Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRelationSet( ) throw (RuntimeException)
415{
416 OContextEntryGuard aGuard( this );
417
418 utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
419 Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
420 return xSet;
420 return xSet;
421}
422// -----------------------------------------------------------------------------
423Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet( ) throw (RuntimeException)
424{
425 OExternalLockGuard aGuard( this );
426
421}
422// -----------------------------------------------------------------------------
423Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet( ) throw (RuntimeException)
424{
425 OExternalLockGuard aGuard( this );
426
427 utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
427 utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
428 Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
429
430 if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
431 {
428 Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
429
430 if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
431 {
432 pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
433 if ( m_bIsChecked && m_nRole != AccessibleRole::PANEL )
434 pStateSetHelper->AddState( AccessibleStateType::CHECKED );
435 if ( m_bIndeterminate )
436 pStateSetHelper->AddState( AccessibleStateType::INDETERMINATE );
437 if ( m_pToolBox->IsEnabled() && m_pToolBox->IsItemEnabled( m_nItemId ) )
438 {
439 pStateSetHelper->AddState( AccessibleStateType::ENABLED );
440 pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
441 }
432 pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
433 if ( m_bIsChecked && m_nRole != AccessibleRole::PANEL )
434 pStateSetHelper->AddState( AccessibleStateType::CHECKED );
435 if ( m_bIndeterminate )
436 pStateSetHelper->AddState( AccessibleStateType::INDETERMINATE );
437 if ( m_pToolBox->IsEnabled() && m_pToolBox->IsItemEnabled( m_nItemId ) )
438 {
439 pStateSetHelper->AddState( AccessibleStateType::ENABLED );
440 pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
441 }
442 if ( m_pToolBox->IsItemVisible( m_nItemId ) )
442 if ( m_pToolBox->IsItemVisible( m_nItemId ) )
443 pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
444 if ( m_pToolBox->IsItemReallyVisible( m_nItemId ) )
443 pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
444 if ( m_pToolBox->IsItemReallyVisible( m_nItemId ) )
445 pStateSetHelper->AddState( AccessibleStateType::SHOWING );
446 if ( m_bHasFocus )
445 pStateSetHelper->AddState( AccessibleStateType::SHOWING );
446 if ( m_bHasFocus )
447 pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
447 pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
448 }
449 else
448 }
449 else
450 pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
450 pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
451
451
452 return xStateSet;
452 return xStateSet;
453}
454// -----------------------------------------------------------------------------
455// XAccessibleText
456// -----------------------------------------------------------------------------
457sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition() throw (RuntimeException)
458{
459 return -1;
460}
461// -----------------------------------------------------------------------------
462sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
463{
464 OExternalLockGuard aGuard( this );
465
453}
454// -----------------------------------------------------------------------------
455// XAccessibleText
456// -----------------------------------------------------------------------------
457sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition() throw (RuntimeException)
458{
459 return -1;
460}
461// -----------------------------------------------------------------------------
462sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
463{
464 OExternalLockGuard aGuard( this );
465
466 if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
467 throw IndexOutOfBoundsException();
466 if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
467 throw IndexOutOfBoundsException();
468
469 return sal_False;
470}
471// -----------------------------------------------------------------------------
472Sequence< PropertyValue > SAL_CALL VCLXAccessibleToolBoxItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException)
473{
474 OExternalLockGuard aGuard( this );
475
476 ::rtl::OUString sText( implGetText() );
477
468
469 return sal_False;
470}
471// -----------------------------------------------------------------------------
472Sequence< PropertyValue > SAL_CALL VCLXAccessibleToolBoxItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException)
473{
474 OExternalLockGuard aGuard( this );
475
476 ::rtl::OUString sText( implGetText() );
477
478 if ( !implIsValidIndex( nIndex, sText.getLength() ) )
479 throw IndexOutOfBoundsException();
478 if ( !implIsValidIndex( nIndex, sText.getLength() ) )
479 throw IndexOutOfBoundsException();
480
481 return Sequence< PropertyValue >();
482}
483// -----------------------------------------------------------------------------
484awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
485{
486 OExternalLockGuard aGuard( this );
487
488 ::rtl::OUString sText( implGetText() );
489
480
481 return Sequence< PropertyValue >();
482}
483// -----------------------------------------------------------------------------
484awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
485{
486 OExternalLockGuard aGuard( this );
487
488 ::rtl::OUString sText( implGetText() );
489
490 if ( !implIsValidIndex( nIndex, sText.getLength() ) )
491 throw IndexOutOfBoundsException();
490 if ( !implIsValidIndex( nIndex, sText.getLength() ) )
491 throw IndexOutOfBoundsException();
492
493 awt::Rectangle aBounds( 0, 0, 0, 0 );
494 if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds
495 {
496 Rectangle aCharRect = m_pToolBox->GetCharacterBounds( m_nItemId, nIndex );
497 Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId );
498 aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
499 aBounds = AWTRectangle( aCharRect );

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

520
521 return nIndex;
522}
523// -----------------------------------------------------------------------------
524sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
525{
526 OExternalLockGuard aGuard( this );
527
492
493 awt::Rectangle aBounds( 0, 0, 0, 0 );
494 if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds
495 {
496 Rectangle aCharRect = m_pToolBox->GetCharacterBounds( m_nItemId, nIndex );
497 Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId );
498 aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
499 aBounds = AWTRectangle( aCharRect );

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

520
521 return nIndex;
522}
523// -----------------------------------------------------------------------------
524sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
525{
526 OExternalLockGuard aGuard( this );
527
528 if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
529 throw IndexOutOfBoundsException();
528 if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
529 throw IndexOutOfBoundsException();
530
531 return sal_False;
532}
533// -----------------------------------------------------------------------------
534sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
535{
536 OExternalLockGuard aGuard( this );
537
530
531 return sal_False;
532}
533// -----------------------------------------------------------------------------
534sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
535{
536 OExternalLockGuard aGuard( this );
537
538 if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
539 throw IndexOutOfBoundsException();
538 if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
539 throw IndexOutOfBoundsException();
540
541 sal_Bool bReturn = sal_False;
542
543 if ( m_pToolBox )
544 {
545 Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pToolBox->GetClipboard();
546 if ( xClipboard.is() )
547 {

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

568// -----------------------------------------------------------------------------
569Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
570{
571 return Reference< XAccessible >();
572}
573// -----------------------------------------------------------------------------
574void SAL_CALL VCLXAccessibleToolBoxItem::grabFocus( ) throw (RuntimeException)
575{
540
541 sal_Bool bReturn = sal_False;
542
543 if ( m_pToolBox )
544 {
545 Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pToolBox->GetClipboard();
546 if ( xClipboard.is() )
547 {

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

568// -----------------------------------------------------------------------------
569Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
570{
571 return Reference< XAccessible >();
572}
573// -----------------------------------------------------------------------------
574void SAL_CALL VCLXAccessibleToolBoxItem::grabFocus( ) throw (RuntimeException)
575{
576 Reference< XAccessible > xParent(getAccessibleParent());
577
578 if( xParent.is() )
579 {
580 Reference< XAccessibleSelection > rxAccessibleSelection(xParent->getAccessibleContext(), UNO_QUERY);
581
582 if ( rxAccessibleSelection.is() )
583 {
584 rxAccessibleSelection -> selectAccessibleChild ( getAccessibleIndexInParent() );
585 }
586 }
576 Reference< XAccessible > xParent(getAccessibleParent());
577
578 if( xParent.is() )
579 {
580 Reference< XAccessibleSelection > rxAccessibleSelection(xParent->getAccessibleContext(), UNO_QUERY);
581
582 if ( rxAccessibleSelection.is() )
583 {
584 rxAccessibleSelection -> selectAccessibleChild ( getAccessibleIndexInParent() );
585 }
586 }
587}
588// -----------------------------------------------------------------------------
589sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getForeground( ) throw (RuntimeException)
590{
591 OExternalLockGuard aGuard( this );
592
593 sal_Int32 nColor = 0;
594 if ( m_pToolBox )
587}
588// -----------------------------------------------------------------------------
589sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getForeground( ) throw (RuntimeException)
590{
591 OExternalLockGuard aGuard( this );
592
593 sal_Int32 nColor = 0;
594 if ( m_pToolBox )
595 nColor = m_pToolBox->GetControlForeground().GetColor();
595 nColor = m_pToolBox->GetControlForeground().GetColor();
596
597 return nColor;
598}
599// -----------------------------------------------------------------------------
600sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( ) throw (RuntimeException)
601{
602 OExternalLockGuard aGuard( this );
603
604 sal_Int32 nColor = 0;
605 if ( m_pToolBox )
596
597 return nColor;
598}
599// -----------------------------------------------------------------------------
600sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( ) throw (RuntimeException)
601{
602 OExternalLockGuard aGuard( this );
603
604 sal_Int32 nColor = 0;
605 if ( m_pToolBox )
606 nColor = m_pToolBox->GetControlBackground().GetColor();
606 nColor = m_pToolBox->GetControlBackground().GetColor();
607
608 return nColor;
609}
610// -----------------------------------------------------------------------------
611// XAccessibleExtendedComponent
612// -----------------------------------------------------------------------------
613Reference< awt::XFont > SAL_CALL VCLXAccessibleToolBoxItem::getFont( ) throw (RuntimeException)
614{

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

633// -----------------------------------------------------------------------------
634::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getToolTipText( ) throw (RuntimeException)
635{
636 OExternalLockGuard aGuard( this );
637
638 ::rtl::OUString sRet;
639 if ( m_pToolBox )
640 {
607
608 return nColor;
609}
610// -----------------------------------------------------------------------------
611// XAccessibleExtendedComponent
612// -----------------------------------------------------------------------------
613Reference< awt::XFont > SAL_CALL VCLXAccessibleToolBoxItem::getFont( ) throw (RuntimeException)
614{

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

633// -----------------------------------------------------------------------------
634::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getToolTipText( ) throw (RuntimeException)
635{
636 OExternalLockGuard aGuard( this );
637
638 ::rtl::OUString sRet;
639 if ( m_pToolBox )
640 {
641 if ( Help::IsExtHelpEnabled() )
642 sRet = m_pToolBox->GetHelpText( m_nItemId );
643 else
644 sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
641 if ( Help::IsExtHelpEnabled() )
642 sRet = m_pToolBox->GetHelpText( m_nItemId );
643 else
644 sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
645 if ( sRet.isEmpty() )
646 // no help text set, so use item text
647 sRet = m_pToolBox->GetItemText( m_nItemId );
648 }
649 return sRet;
650}
651// -----------------------------------------------------------------------------
652// XAccessibleAction

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

657 return 1;
658}
659// -----------------------------------------------------------------------------
660sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
661{
662 OExternalLockGuard aGuard( this );
663
664 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
645 if ( sRet.isEmpty() )
646 // no help text set, so use item text
647 sRet = m_pToolBox->GetItemText( m_nItemId );
648 }
649 return sRet;
650}
651// -----------------------------------------------------------------------------
652// XAccessibleAction

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

657 return 1;
658}
659// -----------------------------------------------------------------------------
660sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
661{
662 OExternalLockGuard aGuard( this );
663
664 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
665 throw IndexOutOfBoundsException();
665 throw IndexOutOfBoundsException();
666
667 if ( m_pToolBox )
668 m_pToolBox->TriggerItem( m_nItemId );
669
670 return sal_True;
671}
672// -----------------------------------------------------------------------------
673::rtl::OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
674{
675 OExternalLockGuard aGuard( this );
676
677 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
666
667 if ( m_pToolBox )
668 m_pToolBox->TriggerItem( m_nItemId );
669
670 return sal_True;
671}
672// -----------------------------------------------------------------------------
673::rtl::OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
674{
675 OExternalLockGuard aGuard( this );
676
677 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
678 throw IndexOutOfBoundsException();
678 throw IndexOutOfBoundsException();
679
680 return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
681}
682// -----------------------------------------------------------------------------
683Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
684{
685 OContextEntryGuard aGuard( this );
686
687 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
679
680 return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
681}
682// -----------------------------------------------------------------------------
683Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
684{
685 OContextEntryGuard aGuard( this );
686
687 if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
688 throw IndexOutOfBoundsException();
688 throw IndexOutOfBoundsException();
689
690 return Reference< XAccessibleKeyBinding >();
691}
692// -----------------------------------------------------------------------------
693// XAccessibleValue
694// -----------------------------------------------------------------------------
695Any VCLXAccessibleToolBoxItem::getCurrentValue( ) throw (RuntimeException)
696{

--- 46 unchanged lines hidden ---
689
690 return Reference< XAccessibleKeyBinding >();
691}
692// -----------------------------------------------------------------------------
693// XAccessibleValue
694// -----------------------------------------------------------------------------
695Any VCLXAccessibleToolBoxItem::getCurrentValue( ) throw (RuntimeException)
696{

--- 46 unchanged lines hidden ---