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 uno::Any SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleKeyBinding()
112 throw (uno::RuntimeException
)
117 void SAL_CALL
SvxShowCharSetVirtualAcc::grabFocus()
118 throw (uno::RuntimeException
, std::exception
)
120 OExternalLockGuard
aGuard( this );
122 mpParent
->GrabFocus();
127 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleChild( sal_Int32 i
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
129 OExternalLockGuard
aGuard( this );
131 if ( mpParent
->getScrollBar()->IsVisible() && i
== 0 )
132 return mpParent
->getScrollBar()->GetAccessible();
137 m_pTable
= new SvxShowCharSetAcc(this);
142 throw IndexOutOfBoundsException();
146 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleParent( ) throw (RuntimeException
, std::exception
)
148 OExternalLockGuard
aGuard( this );
150 Window
* pParent
= mpParent
->GetParent();
151 uno::Reference
< css::accessibility::XAccessible
> xRet
;
154 xRet
= pParent
->GetAccessible();
159 ::com::sun::star::awt::Rectangle
SvxShowCharSetVirtualAcc::implGetBounds( ) throw (RuntimeException
)
161 ::com::sun::star::awt::Rectangle
aBounds ( 0, 0, 0, 0 );
162 Window
* pWindow
= mpParent
;
165 Rectangle aRect
= pWindow
->GetWindowExtentsRelative( NULL
);
166 aBounds
= AWTRectangle( aRect
);
167 Window
* pParent
= pWindow
->GetAccessibleParentWindow();
170 Rectangle aParentRect
= pParent
->GetWindowExtentsRelative( NULL
);
171 ::com::sun::star::awt::Point aParentScreenLoc
= AWTPoint( aParentRect
.TopLeft() );
172 aBounds
.X
-= aParentScreenLoc
.X
;
173 aBounds
.Y
-= aParentScreenLoc
.Y
;
179 sal_Int16 SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleRole( ) throw (RuntimeException
, std::exception
)
181 return css::accessibility::AccessibleRole::SCROLL_PANE
;
184 OUString SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleDescription( ) throw (RuntimeException
, std::exception
)
186 OExternalLockGuard
aGuard( this );
187 return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION
);
190 OUString SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleName( ) throw (RuntimeException
, std::exception
)
192 OExternalLockGuard
aGuard( this );
193 return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC
);
196 Reference
< XAccessibleRelationSet
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleRelationSet( ) throw (RuntimeException
, std::exception
)
198 return Reference
< XAccessibleRelationSet
>();
201 Reference
< XAccessibleStateSet
> SAL_CALL
SvxShowCharSetVirtualAcc::getAccessibleStateSet( ) throw (RuntimeException
, std::exception
)
203 OExternalLockGuard
aGuard( this );
205 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
210 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
211 if ( mpParent
->HasFocus() )
212 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
213 if ( mpParent
->IsActive() )
214 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
215 if ( mpParent
->IsEnabled() )
217 pStateSet
->AddState( AccessibleStateType::ENABLED
);
218 pStateSet
->AddState( AccessibleStateType::SENSITIVE
);
220 if ( mpParent
->IsReallyVisible() )
221 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
227 void SAL_CALL
SvxShowCharSetVirtualAcc::disposing()
229 OAccessibleContextHelper::disposing();
236 // - SvxShowCharSetItem -
239 SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet
& rParent
,SvxShowCharSetAcc
* _pParent
,sal_uInt16 _nPos
) :
248 SvxShowCharSetItem::~SvxShowCharSetItem()
252 m_pItem
->ParentDestroyed();
259 uno::Reference
< css::accessibility::XAccessible
> SvxShowCharSetItem::GetAccessible()
263 m_pItem
= new SvxShowCharSetItemAcc( this );
272 void SvxShowCharSetItem::ClearAccessible()
283 // - SvxShowCharSetAcc -
286 SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc
* _pParent
) : OAccessibleSelectionHelper(new VCLExternalSolarLock())
287 ,m_pParent( _pParent
)
289 osl_atomic_increment(&m_refCount
);
293 osl_atomic_decrement(&m_refCount
);
298 SvxShowCharSetAcc::~SvxShowCharSetAcc()
301 delete getExternalLock();
304 void SAL_CALL
SvxShowCharSetAcc::disposing()
306 OAccessibleSelectionHelper::disposing();
307 ::std::vector
< Reference
< XAccessible
> >::iterator aIter
= m_aChildren
.begin();
308 ::std::vector
< Reference
< XAccessible
> >::iterator aEnd
= m_aChildren
.end();
309 for (;aIter
!= aEnd
; ++aIter
)
310 ::comphelper::disposeComponent(*aIter
);
317 IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetAcc
, OAccessibleSelectionHelper
, OAccessibleHelper_Base
)
318 IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc
, OAccessibleSelectionHelper
, OAccessibleHelper_Base
)
320 bool SvxShowCharSetAcc::implIsSelected( sal_Int32 nAccessibleChildIndex
) throw (RuntimeException
)
322 return m_pParent
&& m_pParent
->getCharSetControl()->IsSelected(
323 sal::static_int_cast
<sal_uInt16
>(nAccessibleChildIndex
));
326 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
327 void SvxShowCharSetAcc::implSelect( sal_Int32 nAccessibleChildIndex
, sal_Bool bSelect
) throw (IndexOutOfBoundsException
, RuntimeException
)
332 m_pParent
->getCharSetControl()->SelectIndex(nAccessibleChildIndex
, true);
334 m_pParent
->getCharSetControl()->DeSelect();
338 ::com::sun::star::awt::Rectangle
SvxShowCharSetAcc::implGetBounds( ) throw (RuntimeException
)
340 const Point aOutPos
;//( m_pParent->getCharSetControl()->GetPosPixel() );
341 Size
aOutSize( m_pParent
->getCharSetControl()->GetOutputSizePixel());
342 if ( m_pParent
->getCharSetControl()->getScrollBar()->IsVisible() )
344 const Size aScrollBar
= m_pParent
->getCharSetControl()->getScrollBar()->GetOutputSizePixel();
345 aOutSize
.Width() -= aScrollBar
.Width();
350 aRet
.X
= aOutPos
.X();
351 aRet
.Y
= aOutPos
.Y();
352 aRet
.Width
= aOutSize
.Width();
353 aRet
.Height
= aOutSize
.Height();
358 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleChildCount()
359 throw (uno::RuntimeException
, std::exception
)
361 OExternalLockGuard
aGuard( this );
363 return m_pParent
->getCharSetControl()->getMaxCharCount();
368 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i
)
369 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
, std::exception
)
371 OExternalLockGuard
aGuard( this );
373 uno::Reference
< css::accessibility::XAccessible
> xRet
;
374 SvxShowCharSetItem
* pItem
= m_pParent
->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16
>( i
) );
378 pItem
->m_pParent
= this;
379 xRet
= pItem
->GetAccessible();
380 m_aChildren
.push_back(xRet
);
383 throw lang::IndexOutOfBoundsException();
390 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleParent()
391 throw (uno::RuntimeException
, std::exception
)
393 OExternalLockGuard
aGuard( this );
400 sal_Int16 SAL_CALL
SvxShowCharSetAcc::getAccessibleRole()
401 throw (uno::RuntimeException
, std::exception
)
403 return css::accessibility::AccessibleRole::TABLE
;
408 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleDescription()
409 throw (uno::RuntimeException
, std::exception
)
411 OExternalLockGuard
aGuard( this );
412 return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION
);
417 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleName()
418 throw (uno::RuntimeException
, std::exception
)
420 OExternalLockGuard
aGuard( this );
422 return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC
);
427 uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
SvxShowCharSetAcc::getAccessibleRelationSet()
428 throw (uno::RuntimeException
, std::exception
)
430 return uno::Reference
< css::accessibility::XAccessibleRelationSet
>();
435 uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
SvxShowCharSetAcc::getAccessibleStateSet()
436 throw (uno::RuntimeException
, std::exception
)
438 OExternalLockGuard
aGuard( this );
440 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
442 if( m_pParent
->getCharSetControl() )
445 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
446 if ( m_pParent
->getCharSetControl()->HasFocus() )
447 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
448 if ( m_pParent
->getCharSetControl()->IsActive() )
449 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
450 if ( m_pParent
->getCharSetControl()->IsEnabled() )
452 pStateSet
->AddState( AccessibleStateType::ENABLED
);
453 pStateSet
->AddState( AccessibleStateType::SENSITIVE
);
455 if ( m_pParent
->getCharSetControl()->IsReallyVisible() )
456 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
458 pStateSet
->AddState( AccessibleStateType::MANAGES_DESCENDANTS
);
465 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleAtPoint( const awt::Point
& aPoint
)
466 throw (uno::RuntimeException
, std::exception
)
468 OExternalLockGuard
aGuard( this );
471 uno::Reference
< css::accessibility::XAccessible
> xRet
;
472 const sal_uInt16 nItemId
= sal::static_int_cast
<sal_uInt16
>(
473 m_pParent
->getCharSetControl()->PixelToMapIndex( Point( aPoint
.X
, aPoint
.Y
) ));
475 if( sal_uInt16(-1) != nItemId
)
477 SvxShowCharSetItem
* pItem
= m_pParent
->getCharSetControl()->ImplGetItem( nItemId
);
478 xRet
= pItem
->GetAccessible();
486 void SAL_CALL
SvxShowCharSetAcc::grabFocus()
487 throw (uno::RuntimeException
, std::exception
)
489 OExternalLockGuard
aGuard( this );
491 m_pParent
->getCharSetControl()->GrabFocus();
496 uno::Any SAL_CALL
SvxShowCharSetAcc::getAccessibleKeyBinding()
497 throw (uno::RuntimeException
)
502 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleRowCount( ) throw (RuntimeException
, std::exception
)
504 return ((getAccessibleChildCount()-1) / COLUMN_COUNT
) + 1;
507 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnCount( ) throw (RuntimeException
, std::exception
)
512 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleRowDescription( sal_Int32
/*nRow*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
517 OUString SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnDescription( sal_Int32
/*nColumn*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
522 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleRowExtentAt( sal_Int32
/*nRow*/, sal_Int32
/*nColumn*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
527 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnExtentAt( sal_Int32
/*nRow*/, sal_Int32
/*nColumn*/ ) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
532 Reference
< XAccessibleTable
> SAL_CALL
SvxShowCharSetAcc::getAccessibleRowHeaders( ) throw (RuntimeException
, std::exception
)
534 return Reference
< XAccessibleTable
>();
537 Reference
< XAccessibleTable
> SAL_CALL
SvxShowCharSetAcc::getAccessibleColumnHeaders( ) throw (RuntimeException
, std::exception
)
539 return Reference
< XAccessibleTable
>();
542 Sequence
< sal_Int32
> SAL_CALL
SvxShowCharSetAcc::getSelectedAccessibleRows( ) throw (RuntimeException
, std::exception
)
544 OExternalLockGuard
aGuard( this );
546 Sequence
< sal_Int32
> aSel(1);
547 aSel
[0] = m_pParent
->getCharSetControl()->GetRowPos(m_pParent
->getCharSetControl()->GetSelectIndexId());
551 Sequence
< sal_Int32
> SAL_CALL
SvxShowCharSetAcc::getSelectedAccessibleColumns( ) throw (RuntimeException
, std::exception
)
553 OExternalLockGuard
aGuard( this );
555 Sequence
< sal_Int32
> aSel(1);
556 aSel
[0] = m_pParent
->getCharSetControl()->GetColumnPos(m_pParent
->getCharSetControl()->GetSelectIndexId());
560 sal_Bool SAL_CALL
SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
562 OExternalLockGuard
aGuard( this );
564 return m_pParent
->getCharSetControl()->GetRowPos(m_pParent
->getCharSetControl()->GetSelectIndexId()) == nRow
;
567 sal_Bool SAL_CALL
SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
569 OExternalLockGuard
aGuard( this );
571 return m_pParent
->getCharSetControl()->GetColumnPos(m_pParent
->getCharSetControl()->GetSelectIndexId()) == nColumn
;
574 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
576 OExternalLockGuard
aGuard( this );
578 ::svx::SvxShowCharSetItem
* pItem
= m_pParent
->getCharSetControl()->ImplGetItem(
579 sal::static_int_cast
<sal_uInt16
>(getAccessibleIndex(nRow
,nColumn
) ));
581 throw IndexOutOfBoundsException();
582 return pItem
->GetAccessible();
585 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleCaption( ) throw (RuntimeException
, std::exception
)
587 return Reference
< XAccessible
>();
590 Reference
< XAccessible
> SAL_CALL
SvxShowCharSetAcc::getAccessibleSummary( ) throw (RuntimeException
, std::exception
)
592 return Reference
< XAccessible
>();
595 sal_Bool SAL_CALL
SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
597 OExternalLockGuard
aGuard( this );
599 return m_pParent
->getCharSetControl()->GetSelectIndexId() == getAccessibleIndex(nRow
,nColumn
);
602 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
604 return (nRow
*COLUMN_COUNT
) + nColumn
;
607 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleRow( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
609 OExternalLockGuard
aGuard( this );
611 return m_pParent
->getCharSetControl()->GetRowPos(sal::static_int_cast
<sal_uInt16
>(nChildIndex
));
614 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getAccessibleColumn( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
616 OExternalLockGuard
aGuard( this );
618 return m_pParent
->getCharSetControl()->GetColumnPos(sal::static_int_cast
<sal_uInt16
>(nChildIndex
));
624 // - SvxShowCharSetItemAcc -
627 SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem
* pParent
) : OAccessibleComponentHelper(new VCLExternalSolarLock())
630 OSL_ENSURE(pParent
,"NO parent supplied!");
631 osl_atomic_increment(&m_refCount
);
635 osl_atomic_decrement(&m_refCount
);
640 SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
643 delete getExternalLock();
646 IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc
, OAccessibleComponentHelper
, OAccessibleHelper_Base_2
)
647 IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc
, OAccessibleComponentHelper
, OAccessibleHelper_Base_2
)
650 void SvxShowCharSetItemAcc::ParentDestroyed()
652 const ::osl::MutexGuard
aGuard( GetMutex() );
658 sal_Int32 SAL_CALL
SvxShowCharSetItemAcc::getAccessibleChildCount()
659 throw (uno::RuntimeException
, std::exception
)
666 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleChild( sal_Int32
/*i*/ )
667 throw (lang::IndexOutOfBoundsException
, uno::RuntimeException
, std::exception
)
669 throw lang::IndexOutOfBoundsException();
674 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleParent()
675 throw (uno::RuntimeException
, std::exception
)
677 OExternalLockGuard
aGuard( this );
679 return mpParent
->m_pParent
;
684 sal_Int16 SAL_CALL
SvxShowCharSetItemAcc::getAccessibleRole()
685 throw (uno::RuntimeException
, std::exception
)
687 return css::accessibility::AccessibleRole::TABLE_CELL
;
692 OUString SAL_CALL
SvxShowCharSetItemAcc::getAccessibleDescription()
693 throw (uno::RuntimeException
, std::exception
)
695 OExternalLockGuard
aGuard( this );
697 OUString sDescription
= SVX_RESSTR( RID_SVXSTR_CHARACTER_CODE
);
699 const OUString
aCharStr( mpParent
->maText
);
700 sal_Int32 nStrIndex
= 0;
701 const sal_UCS4 c
= aCharStr
.iterateCodePoints( &nStrIndex
);
702 const int tmp_len
= (c
< 0x10000) ? 4 : 6;
703 char buf
[16] = "0x0000";
704 sal_UCS4 c_Shifted
= c
;
705 for( int i
= 0; i
< tmp_len
; ++i
)
707 char h
= (char)(c_Shifted
& 0x0F);
708 buf
[tmp_len
+1-i
] = (h
> 9) ? (h
- 10 + 'A') : (h
+ '0');
712 snprintf( buf
+6, 10, " (%" SAL_PRIuUINT32
")", c
);
713 sDescription
+= " " + OUString(buf
, strlen(buf
), RTL_TEXTENCODING_ASCII_US
);
720 OUString SAL_CALL
SvxShowCharSetItemAcc::getAccessibleName()
721 throw (uno::RuntimeException
, std::exception
)
723 OExternalLockGuard
aGuard( this );
729 aRet
= mpParent
->maText
;
732 aRet
= getAccessibleDescription();
740 uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleRelationSet()
741 throw (uno::RuntimeException
, std::exception
)
743 return uno::Reference
< css::accessibility::XAccessibleRelationSet
>();
748 uno::Reference
< css::accessibility::XAccessibleStateSet
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleStateSet()
749 throw (uno::RuntimeException
, std::exception
)
751 OExternalLockGuard
aGuard( this );
754 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
758 if (mpParent
->mrParent
.IsEnabled())
760 pStateSet
->AddState( css::accessibility::AccessibleStateType::ENABLED
);
762 pStateSet
->AddState( css::accessibility::AccessibleStateType::SELECTABLE
);
763 pStateSet
->AddState( css::accessibility::AccessibleStateType::FOCUSABLE
);
767 if( mpParent
->mrParent
.GetSelectIndexId() == mpParent
->mnId
)
769 pStateSet
->AddState( css::accessibility::AccessibleStateType::SELECTED
);
770 pStateSet
->AddState( css::accessibility::AccessibleStateType::FOCUSED
);
772 if ( mpParent
->mnId
>= mpParent
->mrParent
.FirstInView() && mpParent
->mnId
<= mpParent
->mrParent
.LastInView() )
774 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
775 pStateSet
->AddState( AccessibleStateType::SHOWING
);
777 pStateSet
->AddState( AccessibleStateType::TRANSIENT
);
784 void SAL_CALL
SvxShowCharSetItemAcc::grabFocus()
785 throw (uno::RuntimeException
, std::exception
)
792 uno::Any SAL_CALL
SvxShowCharSetItemAcc::getAccessibleKeyBinding()
793 throw (uno::RuntimeException
)
798 awt::Rectangle
SvxShowCharSetItemAcc::implGetBounds( ) throw (RuntimeException
)
804 Rectangle
aRect( mpParent
->maRect
);
806 Rectangle
aParentRect( aOrigin
, mpParent
->mrParent
.GetOutputSizePixel() );
808 aRect
.Intersection( aParentRect
);
810 aRet
.X
= aRect
.Left();
811 aRet
.Y
= aRect
.Top();
812 aRet
.Width
= aRect
.GetWidth();
813 aRet
.Height
= aRect
.GetHeight();
819 uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
SvxShowCharSetItemAcc::getAccessibleAtPoint( const awt::Point
& /*aPoint*/ )
820 throw (uno::RuntimeException
, std::exception
)
822 return uno::Reference
< css::accessibility::XAccessible
>();
825 sal_Int32 SAL_CALL
SvxShowCharSetVirtualAcc::getForeground( ) throw (RuntimeException
, std::exception
)
827 OExternalLockGuard
aGuard( this );
829 sal_Int32 nColor
= 0;
832 if ( mpParent
->IsControlForeground() )
833 nColor
= mpParent
->GetControlForeground().GetColor();
837 if ( mpParent
->IsControlFont() )
838 aFont
= mpParent
->GetControlFont();
840 aFont
= mpParent
->GetFont();
841 nColor
= aFont
.GetColor().GetColor();
848 sal_Int32 SAL_CALL
SvxShowCharSetVirtualAcc::getBackground( ) throw (RuntimeException
, std::exception
)
850 OExternalLockGuard
aGuard( this );
851 sal_Int32 nColor
= 0;
854 if ( mpParent
->IsControlBackground() )
855 nColor
= mpParent
->GetControlBackground().GetColor();
857 nColor
= mpParent
->GetBackground().GetColor().GetColor();
863 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getForeground( ) throw (RuntimeException
, std::exception
)
865 OExternalLockGuard
aGuard( this );
867 sal_Int32 nColor
= 0;
869 nColor
= m_pParent
->getForeground();
873 sal_Int32 SAL_CALL
SvxShowCharSetAcc::getBackground( ) throw (RuntimeException
, std::exception
)
875 OExternalLockGuard
aGuard( this );
876 sal_Int32 nColor
= 0;
878 nColor
= m_pParent
->getBackground();
888 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */