1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <unotools/accessiblestatesethelper.hxx>
21 #include <vcl/svapp.hxx>
23 #include <svx/charmap.hxx>
24 #include "charmapacc.hxx"
25 #include <com/sun/star/accessibility/AccessibleRole.hpp>
26 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
27 #include <toolkit/helper/externallock.hxx>
28 #include <toolkit/helper/convert.hxx>
29 #include <osl/interlck.h>
30 #include <svx/dialmgr.hxx>
31 #include "accessibility.hrc"
32 #include <comphelper/types.hxx>
36 using namespace comphelper
;
37 using namespace ::com::sun::star
;
38 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::lang
;
40 using namespace ::com::sun::star::accessibility
;
43 // - SvxShowCharSetVirtualAcc -
45 SvxShowCharSetVirtualAcc::SvxShowCharSetVirtualAcc( SvxShowCharSet
* pParent
) : OAccessibleComponentHelper(new VCLExternalSolarLock())
49 osl_atomic_increment(&m_refCount
);
53 osl_atomic_decrement(&m_refCount
);
58 SvxShowCharSetVirtualAcc::~SvxShowCharSetVirtualAcc()
61 delete getExternalLock();
64 IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetVirtualAcc
, OAccessibleComponentHelper
, OAccessibleHelper_Base_2
)
65 IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetVirtualAcc
, OAccessibleComponentHelper
, OAccessibleHelper_Base_2
)
67 void SAL_CALL
SvxShowCharSetVirtualAcc::fireEvent(
68 const sal_Int16 _nEventId
,
69 const ::com::sun::star::uno::Any
& _rOldValue
,
70 const ::com::sun::star::uno::Any
& _rNewValue
74 m_pTable
->fireEvent(_nEventId
,_rOldValue
,_rNewValue
);
77 sal_Int32 SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleChildCount( ) throw (RuntimeException
, std::exception
)
79 OExternalLockGuard
aGuard( this );
81 return ( mpParent
->getScrollBar().IsVisible() ) ? 2 : 1;
84 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleAtPoint( const awt::Point
& aPoint
)
85 throw (uno::RuntimeException
, std::exception
)
87 OExternalLockGuard
aGuard( this );
90 uno::Reference
< css::accessibility::XAccessible
> xRet
;
91 const sal_uInt16 nItemId
= sal::static_int_cast
<sal_uInt16
>(mpParent
->PixelToMapIndex( Point( aPoint
.X
, aPoint
.Y
) ));
93 if( sal_uInt16(-1) != nItemId
)
96 m_pTable
= new SvxShowCharSetAcc(this);
99 else if ( mpParent
->getScrollBar().IsVisible() )
101 const Point
aOutPos( mpParent
->getScrollBar().GetPosPixel() );
102 const Size aScrollBar
= mpParent
->getScrollBar().GetOutputSizePixel();
103 Rectangle
aRect(aOutPos
,aScrollBar
);
105 if ( aRect
.IsInside(VCLPoint(aPoint
)) )
106 xRet
= mpParent
->getScrollBar().GetAccessible();
111 void SAL_CALL
SvxShowCharSetVirtualAcc::grabFocus()
112 throw (uno::RuntimeException
, std::exception
)
114 OExternalLockGuard
aGuard( this );
116 mpParent
->GrabFocus();
119 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleChild( sal_Int32 i
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
121 OExternalLockGuard
aGuard( this );
123 if ( mpParent
->getScrollBar().IsVisible() && i
== 0 )
124 return mpParent
->getScrollBar().GetAccessible();
129 m_pTable
= new SvxShowCharSetAcc(this);
134 throw IndexOutOfBoundsException();
138 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleParent( ) throw (RuntimeException
, std::exception
)
140 OExternalLockGuard
aGuard( this );
142 vcl::Window
* pParent
= mpParent
->GetParent();
143 uno::Reference
< css::accessibility::XAccessible
> xRet
;
146 xRet
= pParent
->GetAccessible();
151 ::com::sun::star::awt::Rectangle
SvxShowCharSetVirtualAcc::implGetBounds( ) throw (RuntimeException
)
153 ::com::sun::star::awt::Rectangle
aBounds ( 0, 0, 0, 0 );
154 vcl::Window
* pWindow
= mpParent
;
157 Rectangle aRect
= pWindow
->GetWindowExtentsRelative( NULL
);
158 aBounds
= AWTRectangle( aRect
);
159 vcl::Window
* pParent
= pWindow
->GetAccessibleParentWindow();
162 Rectangle aParentRect
= pParent
->GetWindowExtentsRelative( NULL
);
163 ::com::sun::star::awt::Point aParentScreenLoc
= AWTPoint( aParentRect
.TopLeft() );
164 aBounds
.X
-= aParentScreenLoc
.X
;
165 aBounds
.Y
-= aParentScreenLoc
.Y
;
171 sal_Int16 SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleRole( ) throw (RuntimeException
, std::exception
)
173 return css::accessibility::AccessibleRole::SCROLL_PANE
;
176 OUString SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleDescription( ) throw (RuntimeException
, std::exception
)
178 OExternalLockGuard
aGuard( this );
179 return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION
);
182 OUString SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleName( ) throw (RuntimeException
, std::exception
)
184 OExternalLockGuard
aGuard( this );
185 return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC
);
188 Reference
< XAccessibleRelationSet
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleRelationSet( ) throw (RuntimeException
, std::exception
)
190 return Reference
< XAccessibleRelationSet
>();
193 Reference
< XAccessibleStateSet
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleStateSet( ) throw (RuntimeException
, std::exception
)
195 OExternalLockGuard
aGuard( this );
197 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
202 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
203 if ( mpParent
->HasFocus() )
204 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
205 if ( mpParent
->IsActive() )
206 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
207 if ( mpParent
->IsEnabled() )
209 pStateSet
->AddState( AccessibleStateType::ENABLED
);
210 pStateSet
->AddState( AccessibleStateType::SENSITIVE
);
212 if ( mpParent
->IsReallyVisible() )
213 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
219 void SAL_CALL
SvxShowCharSetVirtualAcc::disposing()
221 OAccessibleContextHelper::disposing();
228 // - SvxShowCharSetItem -
231 SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet
& rParent
,SvxShowCharSetAcc
* _pParent
,sal_uInt16 _nPos
) :
240 SvxShowCharSetItem::~SvxShowCharSetItem()
244 m_pItem
->ParentDestroyed();
251 uno::Reference
< css::accessibility::XAccessible
> SvxShowCharSetItem::GetAccessible()
255 m_pItem
= new SvxShowCharSetItemAcc( this );
264 void SvxShowCharSetItem::ClearAccessible()
275 // - SvxShowCharSetAcc -
278 SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc
* _pParent
) : OAccessibleSelectionHelper(new VCLExternalSolarLock())
279 ,m_pParent( _pParent
)
281 osl_atomic_increment(&m_refCount
);
285 osl_atomic_decrement(&m_refCount
);
290 SvxShowCharSetAcc::~SvxShowCharSetAcc()
293 delete getExternalLock();
296 void SAL_CALL
SvxShowCharSetAcc::disposing()
298 OAccessibleSelectionHelper::disposing();
299 ::std::vector
< Reference
< XAccessible
> >::iterator aIter
= m_aChildren
.begin();
300 ::std::vector
< Reference
< XAccessible
> >::iterator aEnd
= m_aChildren
.end();
301 for (;aIter
!= aEnd
; ++aIter
)
302 ::comphelper::disposeComponent(*aIter
);
309 IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetAcc
, OAccessibleSelectionHelper
, OAccessibleHelper_Base
)
310 IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc
, OAccessibleSelectionHelper
, OAccessibleHelper_Base
)
312 bool SvxShowCharSetAcc::implIsSelected( sal_Int32 nAccessibleChildIndex
) throw (RuntimeException
)
314 return m_pParent
&& m_pParent
->getCharSetControl()->IsSelected(
315 sal::static_int_cast
<sal_uInt16
>(nAccessibleChildIndex
));
318 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
319 void SvxShowCharSetAcc::implSelect(sal_Int32 nAccessibleChildIndex
, bool bSelect
)
320 throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
325 m_pParent
->getCharSetControl()->SelectIndex(nAccessibleChildIndex
, true);
327 m_pParent
->getCharSetControl()->DeSelect();
331 ::com::sun::star::awt::Rectangle
SvxShowCharSetAcc::implGetBounds( ) throw (RuntimeException
)
333 const Point aOutPos
;//( m_pParent->getCharSetControl()->GetPosPixel() );
334 Size
aOutSize( m_pParent
->getCharSetControl()->GetOutputSizePixel());
335 if ( m_pParent
->getCharSetControl()->getScrollBar().IsVisible() )
337 const Size aScrollBar
= m_pParent
->getCharSetControl()->getScrollBar().GetOutputSizePixel();
338 aOutSize
.Width() -= aScrollBar
.Width();
343 aRet
.X
= aOutPos
.X();
344 aRet
.Y
= aOutPos
.Y();
345 aRet
.Width
= aOutSize
.Width();
346 aRet
.Height
= aOutSize
.Height();
351 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleChildCount()
352 throw (uno::RuntimeException
, std::exception
)
354 OExternalLockGuard
aGuard( this );
356 return m_pParent
->getCharSetControl()->getMaxCharCount();
361 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i
)
362 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
, std::exception
)
364 OExternalLockGuard
aGuard( this );
366 uno::Reference
< css::accessibility::XAccessible
> xRet
;
367 SvxShowCharSetItem
* pItem
= m_pParent
->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16
>( i
) );
371 pItem
->m_pParent
= this;
372 xRet
= pItem
->GetAccessible();
373 m_aChildren
.push_back(xRet
);
376 throw lang::IndexOutOfBoundsException();
383 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleParent()
384 throw (uno::RuntimeException
, std::exception
)
386 OExternalLockGuard
aGuard( this );
393 sal_Int16 SAL_CALL
SvxShowCharSetAcc::getAccessibleRole()
394 throw (uno::RuntimeException
, std::exception
)
396 return css::accessibility::AccessibleRole::TABLE
;
401 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleDescription()
402 throw (uno::RuntimeException
, std::exception
)
404 OExternalLockGuard
aGuard( this );
405 return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION
);
410 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleName()
411 throw (uno::RuntimeException
, std::exception
)
413 OExternalLockGuard
aGuard( this );
415 return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC
);
420 uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
SvxShowCharSetAcc::getAccessibleRelationSet()
421 throw (uno::RuntimeException
, std::exception
)
423 return uno::Reference
< css::accessibility::XAccessibleRelationSet
>();
428 uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
SvxShowCharSetAcc::getAccessibleStateSet()
429 throw (uno::RuntimeException
, std::exception
)
431 OExternalLockGuard
aGuard( this );
433 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
435 if( m_pParent
->getCharSetControl() )
438 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
439 if ( m_pParent
->getCharSetControl()->HasFocus() )
440 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
441 if ( m_pParent
->getCharSetControl()->IsActive() )
442 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
443 if ( m_pParent
->getCharSetControl()->IsEnabled() )
445 pStateSet
->AddState( AccessibleStateType::ENABLED
);
446 pStateSet
->AddState( AccessibleStateType::SENSITIVE
);
448 if ( m_pParent
->getCharSetControl()->IsReallyVisible() )
449 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
451 pStateSet
->AddState( AccessibleStateType::MANAGES_DESCENDANTS
);
458 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleAtPoint( const awt::Point
& aPoint
)
459 throw (uno::RuntimeException
, std::exception
)
461 OExternalLockGuard
aGuard( this );
464 uno::Reference
< css::accessibility::XAccessible
> xRet
;
465 const sal_uInt16 nItemId
= sal::static_int_cast
<sal_uInt16
>(
466 m_pParent
->getCharSetControl()->PixelToMapIndex( Point( aPoint
.X
, aPoint
.Y
) ));
468 if( sal_uInt16(-1) != nItemId
)
470 SvxShowCharSetItem
* pItem
= m_pParent
->getCharSetControl()->ImplGetItem( nItemId
);
471 xRet
= pItem
->GetAccessible();
476 void SAL_CALL
SvxShowCharSetAcc::grabFocus()
477 throw (uno::RuntimeException
, std::exception
)
479 OExternalLockGuard
aGuard( this );
481 m_pParent
->getCharSetControl()->GrabFocus();
484 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleRowCount( ) throw (RuntimeException
, std::exception
)
486 return ((getAccessibleChildCount()-1) / COLUMN_COUNT
) + 1;
489 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnCount( ) throw (RuntimeException
, std::exception
)
494 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleRowDescription( sal_Int32
/*nRow*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
499 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnDescription( sal_Int32
/*nColumn*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
504 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleRowExtentAt( sal_Int32
/*nRow*/, sal_Int32
/*nColumn*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
509 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnExtentAt( sal_Int32
/*nRow*/, sal_Int32
/*nColumn*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
514 Reference
< XAccessibleTable
> SAL_CALL
SvxShowCharSetAcc::getAccessibleRowHeaders( ) throw (RuntimeException
, std::exception
)
516 return Reference
< XAccessibleTable
>();
519 Reference
< XAccessibleTable
> SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnHeaders( ) throw (RuntimeException
, std::exception
)
521 return Reference
< XAccessibleTable
>();
524 Sequence
< sal_Int32
> SAL_CALL
SvxShowCharSetAcc::getSelectedAccessibleRows( ) throw (RuntimeException
, std::exception
)
526 OExternalLockGuard
aGuard( this );
528 Sequence
< sal_Int32
> aSel(1);
529 aSel
[0] = SvxShowCharSet::GetRowPos(m_pParent
->getCharSetControl()->GetSelectIndexId());
533 Sequence
< sal_Int32
> SAL_CALL
SvxShowCharSetAcc::getSelectedAccessibleColumns( ) throw (RuntimeException
, std::exception
)
535 OExternalLockGuard
aGuard( this );
537 Sequence
< sal_Int32
> aSel(1);
538 aSel
[0] = SvxShowCharSet::GetColumnPos(m_pParent
->getCharSetControl()->GetSelectIndexId());
542 sal_Bool SAL_CALL
SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
544 OExternalLockGuard
aGuard( this );
546 return SvxShowCharSet::GetRowPos(m_pParent
->getCharSetControl()->GetSelectIndexId()) == nRow
;
549 sal_Bool SAL_CALL
SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
551 OExternalLockGuard
aGuard( this );
553 return SvxShowCharSet::GetColumnPos(m_pParent
->getCharSetControl()->GetSelectIndexId()) == nColumn
;
556 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
558 OExternalLockGuard
aGuard( this );
560 svx::SvxShowCharSetItem
* pItem
= m_pParent
->getCharSetControl()->ImplGetItem(
561 sal::static_int_cast
<sal_uInt16
>(getAccessibleIndex(nRow
,nColumn
) ));
563 throw IndexOutOfBoundsException();
564 return pItem
->GetAccessible();
567 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleCaption( ) throw (RuntimeException
, std::exception
)
569 return Reference
< XAccessible
>();
572 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleSummary( ) throw (RuntimeException
, std::exception
)
574 return Reference
< XAccessible
>();
577 sal_Bool SAL_CALL
SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
579 OExternalLockGuard
aGuard( this );
581 return m_pParent
->getCharSetControl()->GetSelectIndexId() == getAccessibleIndex(nRow
,nColumn
);
584 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
586 return (nRow
*COLUMN_COUNT
) + nColumn
;
589 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleRow( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
591 OExternalLockGuard
aGuard( this );
593 return SvxShowCharSet::GetRowPos(sal::static_int_cast
<sal_uInt16
>(nChildIndex
));
596 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleColumn( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
598 OExternalLockGuard
aGuard( this );
600 return SvxShowCharSet::GetColumnPos(sal::static_int_cast
<sal_uInt16
>(nChildIndex
));
606 // - SvxShowCharSetItemAcc -
609 SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem
* pParent
) : OAccessibleComponentHelper(new VCLExternalSolarLock())
612 OSL_ENSURE(pParent
,"NO parent supplied!");
613 osl_atomic_increment(&m_refCount
);
617 osl_atomic_decrement(&m_refCount
);
622 SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
625 delete getExternalLock();
628 IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc
, OAccessibleComponentHelper
, OAccessibleHelper_Base_2
)
629 IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc
, OAccessibleComponentHelper
, OAccessibleHelper_Base_2
)
632 void SvxShowCharSetItemAcc::ParentDestroyed()
634 const ::osl::MutexGuard
aGuard( GetMutex() );
640 sal_Int32 SAL_CALL
SvxShowCharSetItemAcc::getAccessibleChildCount()
641 throw (uno::RuntimeException
, std::exception
)
648 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleChild( sal_Int32
/*i*/ )
649 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
, std::exception
)
651 throw lang::IndexOutOfBoundsException();
656 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleParent()
657 throw (uno::RuntimeException
, std::exception
)
659 OExternalLockGuard
aGuard( this );
661 return mpParent
->m_pParent
;
666 sal_Int16 SAL_CALL
SvxShowCharSetItemAcc::getAccessibleRole()
667 throw (uno::RuntimeException
, std::exception
)
669 return css::accessibility::AccessibleRole::TABLE_CELL
;
674 OUString SAL_CALL
SvxShowCharSetItemAcc::getAccessibleDescription()
675 throw (uno::RuntimeException
, std::exception
)
677 OExternalLockGuard
aGuard( this );
679 OUString sDescription
= SVX_RESSTR( RID_SVXSTR_CHARACTER_CODE
);
681 const OUString
aCharStr( mpParent
->maText
);
682 sal_Int32 nStrIndex
= 0;
683 const sal_UCS4 c
= aCharStr
.iterateCodePoints( &nStrIndex
);
684 const int tmp_len
= (c
< 0x10000) ? 4 : 6;
685 char buf
[16] = "0x0000";
686 sal_UCS4 c_Shifted
= c
;
687 for( int i
= 0; i
< tmp_len
; ++i
)
689 char h
= (char)(c_Shifted
& 0x0F);
690 buf
[tmp_len
+1-i
] = (h
> 9) ? (h
- 10 + 'A') : (h
+ '0');
694 snprintf( buf
+6, 10, " (%" SAL_PRIuUINT32
")", c
);
695 sDescription
+= " " + OUString(buf
, strlen(buf
), RTL_TEXTENCODING_ASCII_US
);
702 OUString SAL_CALL
SvxShowCharSetItemAcc::getAccessibleName()
703 throw (uno::RuntimeException
, std::exception
)
705 OExternalLockGuard
aGuard( this );
711 aRet
= mpParent
->maText
;
714 aRet
= getAccessibleDescription();
722 uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleRelationSet()
723 throw (uno::RuntimeException
, std::exception
)
725 return uno::Reference
< css::accessibility::XAccessibleRelationSet
>();
730 uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleStateSet()
731 throw (uno::RuntimeException
, std::exception
)
733 OExternalLockGuard
aGuard( this );
736 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
740 if (mpParent
->mrParent
.IsEnabled())
742 pStateSet
->AddState( css::accessibility::AccessibleStateType::ENABLED
);
744 pStateSet
->AddState( css::accessibility::AccessibleStateType::SELECTABLE
);
745 pStateSet
->AddState( css::accessibility::AccessibleStateType::FOCUSABLE
);
749 if( mpParent
->mrParent
.GetSelectIndexId() == mpParent
->mnId
)
751 pStateSet
->AddState( css::accessibility::AccessibleStateType::SELECTED
);
752 pStateSet
->AddState( css::accessibility::AccessibleStateType::FOCUSED
);
754 if ( mpParent
->mnId
>= mpParent
->mrParent
.FirstInView() && mpParent
->mnId
<= mpParent
->mrParent
.LastInView() )
756 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
757 pStateSet
->AddState( AccessibleStateType::SHOWING
);
759 pStateSet
->AddState( AccessibleStateType::TRANSIENT
);
765 void SAL_CALL
SvxShowCharSetItemAcc::grabFocus()
766 throw (uno::RuntimeException
, std::exception
)
771 awt::Rectangle
SvxShowCharSetItemAcc::implGetBounds( ) throw (RuntimeException
)
777 Rectangle
aRect( mpParent
->maRect
);
779 Rectangle
aParentRect( aOrigin
, mpParent
->mrParent
.GetOutputSizePixel() );
781 aRect
.Intersection( aParentRect
);
783 aRet
.X
= aRect
.Left();
784 aRet
.Y
= aRect
.Top();
785 aRet
.Width
= aRect
.GetWidth();
786 aRet
.Height
= aRect
.GetHeight();
792 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleAtPoint( const awt::Point
& /*aPoint*/ )
793 throw (uno::RuntimeException
, std::exception
)
795 return uno::Reference
< css::accessibility::XAccessible
>();
798 sal_Int32 SAL_CALL
SvxShowCharSetVirtualAcc::getForeground( ) throw (RuntimeException
, std::exception
)
800 OExternalLockGuard
aGuard( this );
802 sal_Int32 nColor
= 0;
805 if ( mpParent
->IsControlForeground() )
806 nColor
= mpParent
->GetControlForeground().GetColor();
810 if ( mpParent
->IsControlFont() )
811 aFont
= mpParent
->GetControlFont();
813 aFont
= mpParent
->GetFont();
814 nColor
= aFont
.GetColor().GetColor();
821 sal_Int32 SAL_CALL
SvxShowCharSetVirtualAcc::getBackground( ) throw (RuntimeException
, std::exception
)
823 OExternalLockGuard
aGuard( this );
824 sal_Int32 nColor
= 0;
827 if ( mpParent
->IsControlBackground() )
828 nColor
= mpParent
->GetControlBackground().GetColor();
830 nColor
= mpParent
->GetBackground().GetColor().GetColor();
836 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getForeground( ) throw (RuntimeException
, std::exception
)
838 OExternalLockGuard
aGuard( this );
840 sal_Int32 nColor
= 0;
842 nColor
= m_pParent
->getForeground();
846 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getBackground( ) throw (RuntimeException
, std::exception
)
848 OExternalLockGuard
aGuard( this );
849 sal_Int32 nColor
= 0;
851 nColor
= m_pParent
->getBackground();
861 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */