1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22f6e50924SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #define _SVX_CHARMAP_CXX_
28cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx>
29cdf0e10cSrcweir #include <vcl/svapp.hxx>
30cdf0e10cSrcweir #include <stdio.h>
31cdf0e10cSrcweir #include <svx/charmap.hxx>
32cdf0e10cSrcweir #include "charmapacc.hxx"
33cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
34cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp>
35cdf0e10cSrcweir #include <toolkit/helper/externallock.hxx>
36cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
37cdf0e10cSrcweir #include <osl/interlck.h>
38cdf0e10cSrcweir #include <svx/dialmgr.hxx>
39cdf0e10cSrcweir #include "accessibility.hrc"
40cdf0e10cSrcweir #include <comphelper/types.hxx>
41cdf0e10cSrcweir
42cdf0e10cSrcweir namespace svx
43cdf0e10cSrcweir {
44cdf0e10cSrcweir using namespace comphelper;
45cdf0e10cSrcweir using namespace ::com::sun::star;
46cdf0e10cSrcweir using namespace ::com::sun::star::uno;
47cdf0e10cSrcweir using namespace ::com::sun::star::lang;
48cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
49cdf0e10cSrcweir
50cdf0e10cSrcweir // ----------------
51cdf0e10cSrcweir // - SvxShowCharSetVirtualAcc -
52cdf0e10cSrcweir // ----------------
SvxShowCharSetVirtualAcc(SvxShowCharSet * pParent)53cdf0e10cSrcweir SvxShowCharSetVirtualAcc::SvxShowCharSetVirtualAcc( SvxShowCharSet* pParent ) : OAccessibleComponentHelper(new VCLExternalSolarLock())
54cdf0e10cSrcweir ,mpParent( pParent )
55cdf0e10cSrcweir ,m_pTable(NULL)
56cdf0e10cSrcweir {
57cdf0e10cSrcweir osl_incrementInterlockedCount(&m_refCount);
58cdf0e10cSrcweir { // #b6211265 #
59cdf0e10cSrcweir lateInit(this);
60cdf0e10cSrcweir }
61cdf0e10cSrcweir osl_decrementInterlockedCount(&m_refCount);
62cdf0e10cSrcweir }
63cdf0e10cSrcweir
64cdf0e10cSrcweir // -----------------------------------------------------------------------------
65cdf0e10cSrcweir
~SvxShowCharSetVirtualAcc()66cdf0e10cSrcweir SvxShowCharSetVirtualAcc::~SvxShowCharSetVirtualAcc()
67cdf0e10cSrcweir {
68cdf0e10cSrcweir ensureDisposed();
69cdf0e10cSrcweir delete getExternalLock();
70cdf0e10cSrcweir }
71cdf0e10cSrcweir // -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(SvxShowCharSetVirtualAcc,OAccessibleComponentHelper,OAccessibleHelper_Base_2)72cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetVirtualAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
73cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetVirtualAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
74cdf0e10cSrcweir
75cdf0e10cSrcweir void SAL_CALL SvxShowCharSetVirtualAcc::fireEvent(
76cdf0e10cSrcweir const sal_Int16 _nEventId,
77cdf0e10cSrcweir const ::com::sun::star::uno::Any& _rOldValue,
78cdf0e10cSrcweir const ::com::sun::star::uno::Any& _rNewValue
79cdf0e10cSrcweir )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir if ( m_pTable )
82cdf0e10cSrcweir m_pTable->fireEvent(_nEventId,_rOldValue,_rNewValue);
83cdf0e10cSrcweir }
84cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleChildCount()85cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChildCount( ) throw (RuntimeException)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir OExternalLockGuard aGuard( this );
88cdf0e10cSrcweir ensureAlive();
89cdf0e10cSrcweir return ( mpParent->getScrollBar()->IsVisible() ) ? 2 : 1;
90cdf0e10cSrcweir }
91cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleAtPoint(const awt::Point & aPoint)92cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleAtPoint( const awt::Point& aPoint )
93cdf0e10cSrcweir throw (uno::RuntimeException)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir OExternalLockGuard aGuard( this );
96cdf0e10cSrcweir ensureAlive();
97cdf0e10cSrcweir
98cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
99cdf0e10cSrcweir const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(mpParent->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
100cdf0e10cSrcweir
101cdf0e10cSrcweir if( sal_uInt16(-1) != nItemId )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir if ( !m_pTable )
104cdf0e10cSrcweir m_pTable = new SvxShowCharSetAcc(this);
105cdf0e10cSrcweir xRet = m_pTable;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir else if ( mpParent->getScrollBar()->IsVisible() )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir const Point aOutPos( mpParent->getScrollBar()->GetPosPixel() );
110cdf0e10cSrcweir const Size aScrollBar = mpParent->getScrollBar()->GetOutputSizePixel();
111cdf0e10cSrcweir Rectangle aRect(aOutPos,aScrollBar);
112cdf0e10cSrcweir
113cdf0e10cSrcweir if ( aRect.IsInside(VCLPoint(aPoint)) )
114cdf0e10cSrcweir xRet = mpParent->getScrollBar()->GetAccessible();
115cdf0e10cSrcweir }
116cdf0e10cSrcweir return xRet;
117cdf0e10cSrcweir }
118cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleKeyBinding()119cdf0e10cSrcweir uno::Any SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleKeyBinding()
120cdf0e10cSrcweir throw (uno::RuntimeException)
121cdf0e10cSrcweir {
122cdf0e10cSrcweir return uno::Any();
123cdf0e10cSrcweir }
124cdf0e10cSrcweir // -----------------------------------------------------------------------------
grabFocus()125cdf0e10cSrcweir void SAL_CALL SvxShowCharSetVirtualAcc::grabFocus()
126cdf0e10cSrcweir throw (uno::RuntimeException)
127cdf0e10cSrcweir {
128cdf0e10cSrcweir OExternalLockGuard aGuard( this );
129cdf0e10cSrcweir ensureAlive();
130cdf0e10cSrcweir mpParent->GrabFocus();
131cdf0e10cSrcweir }
132cdf0e10cSrcweir
133cdf0e10cSrcweir
134cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleChild(sal_Int32 i)135cdf0e10cSrcweir Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir OExternalLockGuard aGuard( this );
138cdf0e10cSrcweir ensureAlive();
139cdf0e10cSrcweir if ( mpParent->getScrollBar()->IsVisible() && i == 0 )
140cdf0e10cSrcweir return mpParent->getScrollBar()->GetAccessible();
141cdf0e10cSrcweir else if ( i == 1 )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir if ( !m_xAcc.is() )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir m_pTable = new SvxShowCharSetAcc(this);
146cdf0e10cSrcweir m_xAcc = m_pTable;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir }
149cdf0e10cSrcweir else
150cdf0e10cSrcweir throw IndexOutOfBoundsException();
151cdf0e10cSrcweir return m_xAcc;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleParent()154cdf0e10cSrcweir Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleParent( ) throw (RuntimeException)
155cdf0e10cSrcweir {
156cdf0e10cSrcweir OExternalLockGuard aGuard( this );
157cdf0e10cSrcweir ensureAlive();
158cdf0e10cSrcweir Window* pParent = mpParent->GetParent();
159cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
160cdf0e10cSrcweir
161cdf0e10cSrcweir if ( pParent )
162cdf0e10cSrcweir xRet = pParent->GetAccessible();
163cdf0e10cSrcweir
164cdf0e10cSrcweir return xRet;
165cdf0e10cSrcweir }
166cdf0e10cSrcweir // -----------------------------------------------------------------------------
implGetBounds()167cdf0e10cSrcweir ::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetVirtualAcc::implGetBounds( ) throw (RuntimeException)
168cdf0e10cSrcweir {
1699b8096d0SSteve Yin ::com::sun::star::awt::Rectangle aBounds ( 0, 0, 0, 0 );
1709b8096d0SSteve Yin Window* pWindow = mpParent;
1719b8096d0SSteve Yin if ( pWindow )
1729b8096d0SSteve Yin {
1739b8096d0SSteve Yin Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
1749b8096d0SSteve Yin aBounds = AWTRectangle( aRect );
1759b8096d0SSteve Yin Window* pParent = pWindow->GetAccessibleParentWindow();
1769b8096d0SSteve Yin if ( pParent )
1779b8096d0SSteve Yin {
1789b8096d0SSteve Yin Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL );
1799b8096d0SSteve Yin ::com::sun::star::awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
1809b8096d0SSteve Yin aBounds.X -= aParentScreenLoc.X;
1819b8096d0SSteve Yin aBounds.Y -= aParentScreenLoc.Y;
1829b8096d0SSteve Yin }
1839b8096d0SSteve Yin }
1849b8096d0SSteve Yin return aBounds;
185cdf0e10cSrcweir }
186cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRole()187cdf0e10cSrcweir sal_Int16 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRole( ) throw (RuntimeException)
188cdf0e10cSrcweir {
189cdf0e10cSrcweir return accessibility::AccessibleRole::SCROLL_PANE;
190cdf0e10cSrcweir }
191cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleDescription()192cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleDescription( ) throw (RuntimeException)
193cdf0e10cSrcweir {
194cdf0e10cSrcweir OExternalLockGuard aGuard( this );
195cdf0e10cSrcweir return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION);
196cdf0e10cSrcweir }
197cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleName()198cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleName( ) throw (RuntimeException)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir OExternalLockGuard aGuard( this );
201cdf0e10cSrcweir return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC);
202cdf0e10cSrcweir }
203cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRelationSet()204cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRelationSet( ) throw (RuntimeException)
205cdf0e10cSrcweir {
206cdf0e10cSrcweir return Reference< XAccessibleRelationSet >();
207cdf0e10cSrcweir }
208cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleStateSet()209cdf0e10cSrcweir Reference< XAccessibleStateSet > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleStateSet( ) throw (RuntimeException)
210cdf0e10cSrcweir {
211cdf0e10cSrcweir OExternalLockGuard aGuard( this );
212cdf0e10cSrcweir
213cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
214cdf0e10cSrcweir
215cdf0e10cSrcweir if( mpParent )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir // SELECTABLE
218cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::FOCUSABLE );
219cdf0e10cSrcweir if ( mpParent->HasFocus() )
220cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::FOCUSED );
221cdf0e10cSrcweir if ( mpParent->IsActive() )
222cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ACTIVE );
223cdf0e10cSrcweir if ( mpParent->IsEnabled() )
224cdf0e10cSrcweir {
225cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ENABLED );
226cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::SENSITIVE );
227cdf0e10cSrcweir }
228cdf0e10cSrcweir if ( mpParent->IsReallyVisible() )
229cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::VISIBLE );
230cdf0e10cSrcweir }
231cdf0e10cSrcweir
232cdf0e10cSrcweir return pStateSet;
233cdf0e10cSrcweir }
234cdf0e10cSrcweir // -----------------------------------------------------------------------------
disposing()235cdf0e10cSrcweir void SAL_CALL SvxShowCharSetVirtualAcc::disposing()
236cdf0e10cSrcweir {
237cdf0e10cSrcweir OAccessibleContextHelper::disposing();
238cdf0e10cSrcweir if ( m_pTable )
239cdf0e10cSrcweir m_pTable->dispose();
240cdf0e10cSrcweir m_pTable = NULL;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir // -----------------------------------------------------------------------------
243cdf0e10cSrcweir // ----------------
244cdf0e10cSrcweir // - SvxShowCharSetItem -
245cdf0e10cSrcweir // ----------------
246cdf0e10cSrcweir
SvxShowCharSetItem(SvxShowCharSet & rParent,SvxShowCharSetAcc * _pParent,sal_uInt16 _nPos)247cdf0e10cSrcweir SvxShowCharSetItem::SvxShowCharSetItem( SvxShowCharSet& rParent,SvxShowCharSetAcc* _pParent,sal_uInt16 _nPos ) :
248cdf0e10cSrcweir mrParent( rParent )
249cdf0e10cSrcweir ,mnId( _nPos )
250cdf0e10cSrcweir ,m_pItem(NULL)
251cdf0e10cSrcweir ,m_pParent(_pParent)
252cdf0e10cSrcweir {
253cdf0e10cSrcweir }
254cdf0e10cSrcweir // -----------------------------------------------------------------------
255cdf0e10cSrcweir
~SvxShowCharSetItem()256cdf0e10cSrcweir SvxShowCharSetItem::~SvxShowCharSetItem()
257cdf0e10cSrcweir {
258cdf0e10cSrcweir if ( m_xAcc.is() )
259cdf0e10cSrcweir {
260cdf0e10cSrcweir m_pItem->ParentDestroyed();
261cdf0e10cSrcweir ClearAccessible();
262cdf0e10cSrcweir }
263cdf0e10cSrcweir }
264cdf0e10cSrcweir
265cdf0e10cSrcweir // -----------------------------------------------------------------------
266cdf0e10cSrcweir
GetAccessible()267cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SvxShowCharSetItem::GetAccessible()
268cdf0e10cSrcweir {
269cdf0e10cSrcweir if( !m_xAcc.is() )
270cdf0e10cSrcweir {
271cdf0e10cSrcweir m_pItem = new SvxShowCharSetItemAcc( this );
272cdf0e10cSrcweir m_xAcc = m_pItem;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
275cdf0e10cSrcweir return m_xAcc;
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
278cdf0e10cSrcweir // -----------------------------------------------------------------------
279cdf0e10cSrcweir
ClearAccessible()280cdf0e10cSrcweir void SvxShowCharSetItem::ClearAccessible()
281cdf0e10cSrcweir {
282cdf0e10cSrcweir if ( m_xAcc.is() )
283cdf0e10cSrcweir {
284cdf0e10cSrcweir m_pItem = NULL;
285cdf0e10cSrcweir m_xAcc = NULL;
286cdf0e10cSrcweir }
287cdf0e10cSrcweir }
288cdf0e10cSrcweir
289cdf0e10cSrcweir
290cdf0e10cSrcweir // ---------------
291cdf0e10cSrcweir // - SvxShowCharSetAcc -
292cdf0e10cSrcweir // ---------------
293cdf0e10cSrcweir
SvxShowCharSetAcc(SvxShowCharSetVirtualAcc * _pParent)294cdf0e10cSrcweir SvxShowCharSetAcc::SvxShowCharSetAcc( SvxShowCharSetVirtualAcc* _pParent ) : OAccessibleSelectionHelper(new VCLExternalSolarLock())
295cdf0e10cSrcweir ,m_pParent( _pParent )
296cdf0e10cSrcweir {
297cdf0e10cSrcweir osl_incrementInterlockedCount(&m_refCount);
298cdf0e10cSrcweir { // #b6211265 #
299cdf0e10cSrcweir lateInit(this);
300cdf0e10cSrcweir }
301cdf0e10cSrcweir osl_decrementInterlockedCount(&m_refCount);
302cdf0e10cSrcweir }
303cdf0e10cSrcweir
304cdf0e10cSrcweir // -----------------------------------------------------------------------------
305cdf0e10cSrcweir
~SvxShowCharSetAcc()306cdf0e10cSrcweir SvxShowCharSetAcc::~SvxShowCharSetAcc()
307cdf0e10cSrcweir {
308cdf0e10cSrcweir ensureDisposed();
309cdf0e10cSrcweir delete getExternalLock();
310cdf0e10cSrcweir }
311cdf0e10cSrcweir // -----------------------------------------------------------------------------
disposing()312cdf0e10cSrcweir void SAL_CALL SvxShowCharSetAcc::disposing()
313cdf0e10cSrcweir {
314cdf0e10cSrcweir OAccessibleSelectionHelper::disposing();
315cdf0e10cSrcweir ::std::vector< Reference< XAccessible > >::iterator aIter = m_aChildren.begin();
316cdf0e10cSrcweir ::std::vector< Reference< XAccessible > >::iterator aEnd = m_aChildren.end();
317cdf0e10cSrcweir for (;aIter != aEnd ; ++aIter)
318cdf0e10cSrcweir ::comphelper::disposeComponent(*aIter);
319cdf0e10cSrcweir
320cdf0e10cSrcweir m_aChildren.clear();
321cdf0e10cSrcweir m_pParent = NULL;
322cdf0e10cSrcweir }
323cdf0e10cSrcweir
324cdf0e10cSrcweir // -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(SvxShowCharSetAcc,OAccessibleSelectionHelper,OAccessibleHelper_Base)325cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base )
326cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetAcc, OAccessibleSelectionHelper, OAccessibleHelper_Base )
327cdf0e10cSrcweir // -----------------------------------------------------------------------
328cdf0e10cSrcweir sal_Bool SvxShowCharSetAcc::implIsSelected( sal_Int32 nAccessibleChildIndex ) throw (RuntimeException)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir return m_pParent && m_pParent->getCharSetControl()->IsSelected(
331cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>(nAccessibleChildIndex));
332cdf0e10cSrcweir }
333cdf0e10cSrcweir // -----------------------------------------------------------------------------
334cdf0e10cSrcweir // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
implSelect(sal_Int32 nAccessibleChildIndex,sal_Bool bSelect)335cdf0e10cSrcweir void SvxShowCharSetAcc::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) throw (IndexOutOfBoundsException, RuntimeException)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir if ( m_pParent )
338cdf0e10cSrcweir {
339cdf0e10cSrcweir if ( bSelect )
340cdf0e10cSrcweir m_pParent->getCharSetControl()->SelectIndex(nAccessibleChildIndex,sal_True);
341cdf0e10cSrcweir else
342cdf0e10cSrcweir m_pParent->getCharSetControl()->DeSelect();
343cdf0e10cSrcweir }
344cdf0e10cSrcweir }
345cdf0e10cSrcweir // -----------------------------------------------------------------------------
implGetBounds()346cdf0e10cSrcweir ::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetAcc::implGetBounds( ) throw (RuntimeException)
347cdf0e10cSrcweir {
3489b8096d0SSteve Yin const Point aOutPos;//( m_pParent->getCharSetControl()->GetPosPixel() );
349cdf0e10cSrcweir Size aOutSize( m_pParent->getCharSetControl()->GetOutputSizePixel());
350cdf0e10cSrcweir if ( m_pParent->getCharSetControl()->getScrollBar()->IsVisible() )
351cdf0e10cSrcweir {
352cdf0e10cSrcweir const Size aScrollBar = m_pParent->getCharSetControl()->getScrollBar()->GetOutputSizePixel();
353cdf0e10cSrcweir aOutSize.Width() -= aScrollBar.Width();
3549b8096d0SSteve Yin //aOutSize.Height() -= aScrollBar.Height();
355cdf0e10cSrcweir }
356cdf0e10cSrcweir
357cdf0e10cSrcweir awt::Rectangle aRet;
358cdf0e10cSrcweir
359cdf0e10cSrcweir aRet.X = aOutPos.X();
360cdf0e10cSrcweir aRet.Y = aOutPos.Y();
361cdf0e10cSrcweir aRet.Width = aOutSize.Width();
362cdf0e10cSrcweir aRet.Height = aOutSize.Height();
363cdf0e10cSrcweir
364cdf0e10cSrcweir return aRet;
365cdf0e10cSrcweir }
366cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleChildCount()367cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleChildCount()
368cdf0e10cSrcweir throw (uno::RuntimeException)
369cdf0e10cSrcweir {
370cdf0e10cSrcweir OExternalLockGuard aGuard( this );
371cdf0e10cSrcweir ensureAlive();
372cdf0e10cSrcweir return m_pParent->getCharSetControl()->getMaxCharCount();
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
375cdf0e10cSrcweir // -----------------------------------------------------------------------------
376cdf0e10cSrcweir
getAccessibleChild(sal_Int32 i)377cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i )
378cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
379cdf0e10cSrcweir {
380cdf0e10cSrcweir OExternalLockGuard aGuard( this );
381cdf0e10cSrcweir ensureAlive();
382cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
383cdf0e10cSrcweir SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16 >( i ) );
384cdf0e10cSrcweir
385cdf0e10cSrcweir if( pItem )
386cdf0e10cSrcweir {
387cdf0e10cSrcweir pItem->m_pParent = this;
388cdf0e10cSrcweir xRet = pItem->GetAccessible();
389cdf0e10cSrcweir m_aChildren.push_back(xRet);
390cdf0e10cSrcweir }
391cdf0e10cSrcweir else
392cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
393cdf0e10cSrcweir
394cdf0e10cSrcweir return xRet;
395cdf0e10cSrcweir }
396cdf0e10cSrcweir
397cdf0e10cSrcweir // -----------------------------------------------------------------------------
398cdf0e10cSrcweir
getAccessibleParent()399cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleParent()
400cdf0e10cSrcweir throw (uno::RuntimeException)
401cdf0e10cSrcweir {
402cdf0e10cSrcweir OExternalLockGuard aGuard( this );
403cdf0e10cSrcweir ensureAlive();
404cdf0e10cSrcweir return m_pParent;
405cdf0e10cSrcweir }
406cdf0e10cSrcweir
407cdf0e10cSrcweir // -----------------------------------------------------------------------------
408cdf0e10cSrcweir
getAccessibleRole()409cdf0e10cSrcweir sal_Int16 SAL_CALL SvxShowCharSetAcc::getAccessibleRole()
410cdf0e10cSrcweir throw (uno::RuntimeException)
411cdf0e10cSrcweir {
412cdf0e10cSrcweir return accessibility::AccessibleRole::TABLE;
413cdf0e10cSrcweir }
414cdf0e10cSrcweir
415cdf0e10cSrcweir // -----------------------------------------------------------------------------
416cdf0e10cSrcweir
getAccessibleDescription()417cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleDescription()
418cdf0e10cSrcweir throw (uno::RuntimeException)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir OExternalLockGuard aGuard( this );
421cdf0e10cSrcweir return SVX_RESSTR( RID_SVXSTR_CHARACTER_SELECTION );
422cdf0e10cSrcweir }
423cdf0e10cSrcweir
424cdf0e10cSrcweir // -----------------------------------------------------------------------------
425cdf0e10cSrcweir
getAccessibleName()426cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleName()
427cdf0e10cSrcweir throw (uno::RuntimeException)
428cdf0e10cSrcweir {
429cdf0e10cSrcweir OExternalLockGuard aGuard( this );
430cdf0e10cSrcweir ensureAlive();
431cdf0e10cSrcweir return SVX_RESSTR( RID_SVXSTR_CHAR_SEL_DESC );
432cdf0e10cSrcweir }
433cdf0e10cSrcweir
434cdf0e10cSrcweir // -----------------------------------------------------------------------------
435cdf0e10cSrcweir
getAccessibleRelationSet()436cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetAcc::getAccessibleRelationSet()
437cdf0e10cSrcweir throw (uno::RuntimeException)
438cdf0e10cSrcweir {
439cdf0e10cSrcweir return uno::Reference< accessibility::XAccessibleRelationSet >();
440cdf0e10cSrcweir }
441cdf0e10cSrcweir
442cdf0e10cSrcweir // -----------------------------------------------------------------------------
443cdf0e10cSrcweir
getAccessibleStateSet()444cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetAcc::getAccessibleStateSet()
445cdf0e10cSrcweir throw (uno::RuntimeException)
446cdf0e10cSrcweir {
447cdf0e10cSrcweir OExternalLockGuard aGuard( this );
448cdf0e10cSrcweir
449cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
450cdf0e10cSrcweir
451cdf0e10cSrcweir if( m_pParent->getCharSetControl() )
452cdf0e10cSrcweir {
453cdf0e10cSrcweir // SELECTABLE
454cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::FOCUSABLE );
455cdf0e10cSrcweir if ( m_pParent->getCharSetControl()->HasFocus() )
456cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::FOCUSED );
457cdf0e10cSrcweir if ( m_pParent->getCharSetControl()->IsActive() )
458cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ACTIVE );
459cdf0e10cSrcweir if ( m_pParent->getCharSetControl()->IsEnabled() )
460cdf0e10cSrcweir {
461cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ENABLED );
462cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::SENSITIVE );
463cdf0e10cSrcweir }
464cdf0e10cSrcweir if ( m_pParent->getCharSetControl()->IsReallyVisible() )
465cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::VISIBLE );
466cdf0e10cSrcweir
467cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::MANAGES_DESCENDANTS );
468cdf0e10cSrcweir }
469cdf0e10cSrcweir
470cdf0e10cSrcweir return pStateSet;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir // -----------------------------------------------------------------------------
473cdf0e10cSrcweir
getAccessibleAtPoint(const awt::Point & aPoint)474cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
475cdf0e10cSrcweir throw (uno::RuntimeException)
476cdf0e10cSrcweir {
477cdf0e10cSrcweir OExternalLockGuard aGuard( this );
478cdf0e10cSrcweir ensureAlive();
479cdf0e10cSrcweir
480cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > xRet;
481cdf0e10cSrcweir const sal_uInt16 nItemId = sal::static_int_cast<sal_uInt16>(
482cdf0e10cSrcweir m_pParent->getCharSetControl()->PixelToMapIndex( Point( aPoint.X, aPoint.Y ) ));
483cdf0e10cSrcweir
484cdf0e10cSrcweir if( sal_uInt16(-1) != nItemId )
485cdf0e10cSrcweir {
486cdf0e10cSrcweir SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( nItemId );
487cdf0e10cSrcweir xRet = pItem->GetAccessible();
488cdf0e10cSrcweir }
489cdf0e10cSrcweir return xRet;
490cdf0e10cSrcweir }
491cdf0e10cSrcweir
492cdf0e10cSrcweir // -----------------------------------------------------------------------------
493cdf0e10cSrcweir // -----------------------------------------------------------------------------
494cdf0e10cSrcweir
grabFocus()495cdf0e10cSrcweir void SAL_CALL SvxShowCharSetAcc::grabFocus()
496cdf0e10cSrcweir throw (uno::RuntimeException)
497cdf0e10cSrcweir {
498cdf0e10cSrcweir OExternalLockGuard aGuard( this );
499cdf0e10cSrcweir ensureAlive();
500cdf0e10cSrcweir m_pParent->getCharSetControl()->GrabFocus();
501cdf0e10cSrcweir }
502cdf0e10cSrcweir
503cdf0e10cSrcweir // -----------------------------------------------------------------------------
504cdf0e10cSrcweir
getAccessibleKeyBinding()505cdf0e10cSrcweir uno::Any SAL_CALL SvxShowCharSetAcc::getAccessibleKeyBinding()
506cdf0e10cSrcweir throw (uno::RuntimeException)
507cdf0e10cSrcweir {
508cdf0e10cSrcweir return uno::Any();
509cdf0e10cSrcweir }
510cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRowCount()511cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowCount( ) throw (RuntimeException)
512cdf0e10cSrcweir {
513cdf0e10cSrcweir return ((getAccessibleChildCount()-1) / COLUMN_COUNT) + 1;
514cdf0e10cSrcweir }
515cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleColumnCount()516cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnCount( ) throw (RuntimeException)
517cdf0e10cSrcweir {
518cdf0e10cSrcweir return COLUMN_COUNT;
519cdf0e10cSrcweir }
520cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRowDescription(sal_Int32)521cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleRowDescription( sal_Int32 /*nRow*/ ) throw (IndexOutOfBoundsException, RuntimeException)
522cdf0e10cSrcweir {
523cdf0e10cSrcweir return ::rtl::OUString();
524cdf0e10cSrcweir }
525cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleColumnDescription(sal_Int32)526cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetAcc::getAccessibleColumnDescription( sal_Int32 /*nColumn*/ ) throw (IndexOutOfBoundsException, RuntimeException)
527cdf0e10cSrcweir {
528cdf0e10cSrcweir return ::rtl::OUString();
529cdf0e10cSrcweir }
530cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRowExtentAt(sal_Int32,sal_Int32)531cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRowExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) throw (IndexOutOfBoundsException, RuntimeException)
532cdf0e10cSrcweir {
533cdf0e10cSrcweir return 1;
534cdf0e10cSrcweir }
535cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleColumnExtentAt(sal_Int32,sal_Int32)536cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumnExtentAt( sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ ) throw (IndexOutOfBoundsException, RuntimeException)
537cdf0e10cSrcweir {
538cdf0e10cSrcweir return 1;
539cdf0e10cSrcweir }
540cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRowHeaders()541cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleRowHeaders( ) throw (RuntimeException)
542cdf0e10cSrcweir {
543cdf0e10cSrcweir return Reference< XAccessibleTable >();
544cdf0e10cSrcweir }
545cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleColumnHeaders()546cdf0e10cSrcweir Reference< XAccessibleTable > SAL_CALL SvxShowCharSetAcc::getAccessibleColumnHeaders( ) throw (RuntimeException)
547cdf0e10cSrcweir {
548cdf0e10cSrcweir return Reference< XAccessibleTable >();
549cdf0e10cSrcweir }
550cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSelectedAccessibleRows()551cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleRows( ) throw (RuntimeException)
552cdf0e10cSrcweir {
553cdf0e10cSrcweir OExternalLockGuard aGuard( this );
554cdf0e10cSrcweir ensureAlive();
555cdf0e10cSrcweir Sequence< sal_Int32 > aSel(1);
556cdf0e10cSrcweir aSel[0] = m_pParent->getCharSetControl()->GetRowPos(m_pParent->getCharSetControl()->GetSelectIndexId());
557cdf0e10cSrcweir return aSel;
558cdf0e10cSrcweir }
559cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSelectedAccessibleColumns()560cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL SvxShowCharSetAcc::getSelectedAccessibleColumns( ) throw (RuntimeException)
561cdf0e10cSrcweir {
562cdf0e10cSrcweir OExternalLockGuard aGuard( this );
563cdf0e10cSrcweir ensureAlive();
564cdf0e10cSrcweir Sequence< sal_Int32 > aSel(1);
565cdf0e10cSrcweir aSel[0] = m_pParent->getCharSetControl()->GetColumnPos(m_pParent->getCharSetControl()->GetSelectIndexId());
566cdf0e10cSrcweir return aSel;
567cdf0e10cSrcweir }
568cdf0e10cSrcweir // -----------------------------------------------------------------------------
isAccessibleRowSelected(sal_Int32 nRow)569cdf0e10cSrcweir sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
570cdf0e10cSrcweir {
571cdf0e10cSrcweir OExternalLockGuard aGuard( this );
572cdf0e10cSrcweir ensureAlive();
573cdf0e10cSrcweir return m_pParent->getCharSetControl()->GetRowPos(m_pParent->getCharSetControl()->GetSelectIndexId()) == nRow;
574cdf0e10cSrcweir }
575cdf0e10cSrcweir // -----------------------------------------------------------------------------
isAccessibleColumnSelected(sal_Int32 nColumn)576cdf0e10cSrcweir sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
577cdf0e10cSrcweir {
578cdf0e10cSrcweir OExternalLockGuard aGuard( this );
579cdf0e10cSrcweir ensureAlive();
580cdf0e10cSrcweir return m_pParent->getCharSetControl()->GetColumnPos(m_pParent->getCharSetControl()->GetSelectIndexId()) == nColumn;
581cdf0e10cSrcweir }
582cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleCellAt(sal_Int32 nRow,sal_Int32 nColumn)583cdf0e10cSrcweir Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
584cdf0e10cSrcweir {
585cdf0e10cSrcweir OExternalLockGuard aGuard( this );
586cdf0e10cSrcweir ensureAlive();
587cdf0e10cSrcweir ::svx::SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem(
588cdf0e10cSrcweir sal::static_int_cast<sal_uInt16>(getAccessibleIndex(nRow,nColumn) ));
589cdf0e10cSrcweir if ( !pItem )
590cdf0e10cSrcweir throw IndexOutOfBoundsException();
591cdf0e10cSrcweir return pItem->GetAccessible();
592cdf0e10cSrcweir }
593cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleCaption()594cdf0e10cSrcweir Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleCaption( ) throw (RuntimeException)
595cdf0e10cSrcweir {
596cdf0e10cSrcweir return Reference< XAccessible >();
597cdf0e10cSrcweir }
598cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleSummary()599cdf0e10cSrcweir Reference< XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleSummary( ) throw (RuntimeException)
600cdf0e10cSrcweir {
601cdf0e10cSrcweir return Reference< XAccessible >();
602cdf0e10cSrcweir }
603cdf0e10cSrcweir // -----------------------------------------------------------------------------
isAccessibleSelected(sal_Int32 nRow,sal_Int32 nColumn)604cdf0e10cSrcweir sal_Bool SAL_CALL SvxShowCharSetAcc::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
605cdf0e10cSrcweir {
606cdf0e10cSrcweir OExternalLockGuard aGuard( this );
607cdf0e10cSrcweir ensureAlive();
608cdf0e10cSrcweir return m_pParent->getCharSetControl()->GetSelectIndexId() == getAccessibleIndex(nRow,nColumn);
609cdf0e10cSrcweir }
610cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleIndex(sal_Int32 nRow,sal_Int32 nColumn)611cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
612cdf0e10cSrcweir {
613cdf0e10cSrcweir return (nRow*COLUMN_COUNT) + nColumn;
614cdf0e10cSrcweir }
615cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleRow(sal_Int32 nChildIndex)616cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
617cdf0e10cSrcweir {
618cdf0e10cSrcweir OExternalLockGuard aGuard( this );
619cdf0e10cSrcweir ensureAlive();
620cdf0e10cSrcweir return m_pParent->getCharSetControl()->GetRowPos(sal::static_int_cast<sal_uInt16>(nChildIndex));
621cdf0e10cSrcweir }
622cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleColumn(sal_Int32 nChildIndex)623cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
624cdf0e10cSrcweir {
625cdf0e10cSrcweir OExternalLockGuard aGuard( this );
626cdf0e10cSrcweir ensureAlive();
627cdf0e10cSrcweir return m_pParent->getCharSetControl()->GetColumnPos(sal::static_int_cast<sal_uInt16>(nChildIndex));
628cdf0e10cSrcweir }
629cdf0e10cSrcweir // -----------------------------------------------------------------------------
630cdf0e10cSrcweir
631cdf0e10cSrcweir // -----------------------------------------------------------------------------
632cdf0e10cSrcweir // ----------------
633cdf0e10cSrcweir // - SvxShowCharSetItemAcc -
634cdf0e10cSrcweir // ----------------
635cdf0e10cSrcweir
SvxShowCharSetItemAcc(SvxShowCharSetItem * pParent)636cdf0e10cSrcweir SvxShowCharSetItemAcc::SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ) : OAccessibleComponentHelper(new VCLExternalSolarLock())
637cdf0e10cSrcweir ,mpParent( pParent )
638cdf0e10cSrcweir {
639cdf0e10cSrcweir OSL_ENSURE(pParent,"NO parent supplied!");
640cdf0e10cSrcweir osl_incrementInterlockedCount(&m_refCount);
641cdf0e10cSrcweir { // #b6211265 #
642cdf0e10cSrcweir lateInit(this);
643cdf0e10cSrcweir }
644cdf0e10cSrcweir osl_decrementInterlockedCount(&m_refCount);
645cdf0e10cSrcweir }
646cdf0e10cSrcweir
647cdf0e10cSrcweir // -----------------------------------------------------------------------------
648cdf0e10cSrcweir
~SvxShowCharSetItemAcc()649cdf0e10cSrcweir SvxShowCharSetItemAcc::~SvxShowCharSetItemAcc()
650cdf0e10cSrcweir {
651cdf0e10cSrcweir ensureDisposed();
652cdf0e10cSrcweir delete getExternalLock();
653cdf0e10cSrcweir }
654cdf0e10cSrcweir // -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2(SvxShowCharSetItemAcc,OAccessibleComponentHelper,OAccessibleHelper_Base_2)655cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
656cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxShowCharSetItemAcc, OAccessibleComponentHelper, OAccessibleHelper_Base_2 )
657cdf0e10cSrcweir // -----------------------------------------------------------------------------
658cdf0e10cSrcweir
659cdf0e10cSrcweir void SvxShowCharSetItemAcc::ParentDestroyed()
660cdf0e10cSrcweir {
661cdf0e10cSrcweir const ::osl::MutexGuard aGuard( GetMutex() );
662cdf0e10cSrcweir mpParent = NULL;
663cdf0e10cSrcweir }
664cdf0e10cSrcweir
665cdf0e10cSrcweir // -----------------------------------------------------------------------------
666cdf0e10cSrcweir
getAccessibleChildCount()667cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetItemAcc::getAccessibleChildCount()
668cdf0e10cSrcweir throw (uno::RuntimeException)
669cdf0e10cSrcweir {
670cdf0e10cSrcweir return 0;
671cdf0e10cSrcweir }
672cdf0e10cSrcweir
673cdf0e10cSrcweir // -----------------------------------------------------------------------------
674cdf0e10cSrcweir
getAccessibleChild(sal_Int32)675cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleChild( sal_Int32 /*i*/ )
676cdf0e10cSrcweir throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
677cdf0e10cSrcweir {
678cdf0e10cSrcweir throw lang::IndexOutOfBoundsException();
679cdf0e10cSrcweir }
680cdf0e10cSrcweir
681cdf0e10cSrcweir // -----------------------------------------------------------------------------
682cdf0e10cSrcweir
getAccessibleParent()683cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleParent()
684cdf0e10cSrcweir throw (uno::RuntimeException)
685cdf0e10cSrcweir {
686cdf0e10cSrcweir OExternalLockGuard aGuard( this );
687cdf0e10cSrcweir ensureAlive();
688cdf0e10cSrcweir return mpParent->m_pParent;
689cdf0e10cSrcweir }
690cdf0e10cSrcweir
691cdf0e10cSrcweir // -----------------------------------------------------------------------------
692cdf0e10cSrcweir
getAccessibleRole()693cdf0e10cSrcweir sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole()
694cdf0e10cSrcweir throw (uno::RuntimeException)
695cdf0e10cSrcweir {
6969b8096d0SSteve Yin return accessibility::AccessibleRole::TABLE_CELL;
697cdf0e10cSrcweir }
698cdf0e10cSrcweir
699cdf0e10cSrcweir // -----------------------------------------------------------------------------
700cdf0e10cSrcweir
getAccessibleDescription()701cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleDescription()
702cdf0e10cSrcweir throw (uno::RuntimeException)
703cdf0e10cSrcweir {
704cdf0e10cSrcweir OExternalLockGuard aGuard( this );
705cdf0e10cSrcweir ensureAlive();
706cdf0e10cSrcweir String sDescription = SVX_RESSTR( RID_SVXSTR_CHARACTER_CODE );
707cdf0e10cSrcweir
708*2ace5f27SHerbert Dürr const rtl::OUString aCharStr( mpParent->maText);
709*2ace5f27SHerbert Dürr sal_Int32 nStrIndex = 0;
710*2ace5f27SHerbert Dürr const sal_UCS4 c = aCharStr.iterateCodePoints( &nStrIndex );
711*2ace5f27SHerbert Dürr const int tmp_len = (c < 0x10000) ? 4 : 6;
712cdf0e10cSrcweir char buf[16] = "0x0000";
713*2ace5f27SHerbert Dürr sal_UCS4 c_Shifted = c;
7149b8096d0SSteve Yin for( int i = 0; i < tmp_len; ++i )
7159b8096d0SSteve Yin {
7169b8096d0SSteve Yin char h = c_Shifted & 0x0F;
7179b8096d0SSteve Yin buf[tmp_len+1-i] = (h > 9) ? (h - 10 + 'A') : (h + '0');
7189b8096d0SSteve Yin c_Shifted >>= 4;
7199b8096d0SSteve Yin }
720cdf0e10cSrcweir if( c < 256 )
721cdf0e10cSrcweir snprintf( buf+6, 10, " (%d)", c );
7229b8096d0SSteve Yin sDescription.AppendAscii(" ");
723cdf0e10cSrcweir sDescription.AppendAscii(buf);
724cdf0e10cSrcweir
725cdf0e10cSrcweir return sDescription;
726cdf0e10cSrcweir }
727cdf0e10cSrcweir
728cdf0e10cSrcweir // -----------------------------------------------------------------------------
729cdf0e10cSrcweir
getAccessibleName()730cdf0e10cSrcweir ::rtl::OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleName()
731cdf0e10cSrcweir throw (uno::RuntimeException)
732cdf0e10cSrcweir {
733cdf0e10cSrcweir OExternalLockGuard aGuard( this );
734cdf0e10cSrcweir ensureAlive();
735cdf0e10cSrcweir String aRet;
736cdf0e10cSrcweir
737cdf0e10cSrcweir if( mpParent )
738cdf0e10cSrcweir {
739cdf0e10cSrcweir aRet = mpParent->maText;
740cdf0e10cSrcweir
741cdf0e10cSrcweir if( !aRet.Len() )
742cdf0e10cSrcweir aRet = getAccessibleDescription();
743cdf0e10cSrcweir }
744cdf0e10cSrcweir
745cdf0e10cSrcweir return aRet;
746cdf0e10cSrcweir }
747cdf0e10cSrcweir
748cdf0e10cSrcweir // -----------------------------------------------------------------------------
749cdf0e10cSrcweir
getAccessibleRelationSet()750cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleRelationSet()
751cdf0e10cSrcweir throw (uno::RuntimeException)
752cdf0e10cSrcweir {
753cdf0e10cSrcweir return uno::Reference< accessibility::XAccessibleRelationSet >();
754cdf0e10cSrcweir }
755cdf0e10cSrcweir
756cdf0e10cSrcweir // -----------------------------------------------------------------------------
757cdf0e10cSrcweir
getAccessibleStateSet()758cdf0e10cSrcweir uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetItemAcc::getAccessibleStateSet()
759cdf0e10cSrcweir throw (uno::RuntimeException)
760cdf0e10cSrcweir {
761cdf0e10cSrcweir OExternalLockGuard aGuard( this );
762cdf0e10cSrcweir ensureAlive();
763cdf0e10cSrcweir
764cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper;
765cdf0e10cSrcweir
766cdf0e10cSrcweir if( mpParent )
767cdf0e10cSrcweir {
7689b8096d0SSteve Yin if(mpParent->mrParent.IsEnabled())
7699b8096d0SSteve Yin {
7709b8096d0SSteve Yin pStateSet->AddState( accessibility::AccessibleStateType::ENABLED );
771cdf0e10cSrcweir // SELECTABLE
772cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
773cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
7749b8096d0SSteve Yin }
775cdf0e10cSrcweir
776cdf0e10cSrcweir // SELECTED
777cdf0e10cSrcweir if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId )
778cdf0e10cSrcweir {
779cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
780cdf0e10cSrcweir pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
781cdf0e10cSrcweir }
782cdf0e10cSrcweir if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() )
7839b8096d0SSteve Yin {
784cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::VISIBLE );
7859b8096d0SSteve Yin pStateSet->AddState( AccessibleStateType::SHOWING );
7869b8096d0SSteve Yin }
787cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::TRANSIENT );
788cdf0e10cSrcweir }
789cdf0e10cSrcweir
790cdf0e10cSrcweir return pStateSet;
791cdf0e10cSrcweir }
792cdf0e10cSrcweir
793cdf0e10cSrcweir // -----------------------------------------------------------------------------
grabFocus()794cdf0e10cSrcweir void SAL_CALL SvxShowCharSetItemAcc::grabFocus()
795cdf0e10cSrcweir throw (uno::RuntimeException)
796cdf0e10cSrcweir {
797cdf0e10cSrcweir // nothing to do
798cdf0e10cSrcweir }
799cdf0e10cSrcweir
800cdf0e10cSrcweir // -----------------------------------------------------------------------------
801cdf0e10cSrcweir
getAccessibleKeyBinding()802cdf0e10cSrcweir uno::Any SAL_CALL SvxShowCharSetItemAcc::getAccessibleKeyBinding()
803cdf0e10cSrcweir throw (uno::RuntimeException)
804cdf0e10cSrcweir {
805cdf0e10cSrcweir return uno::Any();
806cdf0e10cSrcweir }
807cdf0e10cSrcweir // -----------------------------------------------------------------------------
implGetBounds()808cdf0e10cSrcweir awt::Rectangle SAL_CALL SvxShowCharSetItemAcc::implGetBounds( ) throw (RuntimeException)
809cdf0e10cSrcweir {
810cdf0e10cSrcweir awt::Rectangle aRet;
811cdf0e10cSrcweir
812cdf0e10cSrcweir if( mpParent )
813cdf0e10cSrcweir {
814cdf0e10cSrcweir Rectangle aRect( mpParent->maRect );
815cdf0e10cSrcweir Point aOrigin;
816cdf0e10cSrcweir Rectangle aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() );
817cdf0e10cSrcweir
818cdf0e10cSrcweir aRect.Intersection( aParentRect );
819cdf0e10cSrcweir
820cdf0e10cSrcweir aRet.X = aRect.Left();
821cdf0e10cSrcweir aRet.Y = aRect.Top();
822cdf0e10cSrcweir aRet.Width = aRect.GetWidth();
823cdf0e10cSrcweir aRet.Height = aRect.GetHeight();
824cdf0e10cSrcweir }
825cdf0e10cSrcweir
826cdf0e10cSrcweir return aRet;
827cdf0e10cSrcweir }
828cdf0e10cSrcweir // -----------------------------------------------------------------------------
getAccessibleAtPoint(const awt::Point &)829cdf0e10cSrcweir uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::getAccessibleAtPoint( const awt::Point& /*aPoint*/ )
830cdf0e10cSrcweir throw (uno::RuntimeException)
831cdf0e10cSrcweir {
832cdf0e10cSrcweir return uno::Reference< accessibility::XAccessible >();
833cdf0e10cSrcweir }
834cdf0e10cSrcweir // -----------------------------------------------------------------------------
getForeground()835cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getForeground( ) throw (RuntimeException)
836cdf0e10cSrcweir {
837cdf0e10cSrcweir OExternalLockGuard aGuard( this );
838cdf0e10cSrcweir
839cdf0e10cSrcweir sal_Int32 nColor = 0;
840cdf0e10cSrcweir if ( mpParent )
841cdf0e10cSrcweir {
842cdf0e10cSrcweir if ( mpParent->IsControlForeground() )
843cdf0e10cSrcweir nColor = mpParent->GetControlForeground().GetColor();
844cdf0e10cSrcweir else
845cdf0e10cSrcweir {
846cdf0e10cSrcweir Font aFont;
847cdf0e10cSrcweir if ( mpParent->IsControlFont() )
848cdf0e10cSrcweir aFont = mpParent->GetControlFont();
849cdf0e10cSrcweir else
850cdf0e10cSrcweir aFont = mpParent->GetFont();
851cdf0e10cSrcweir nColor = aFont.GetColor().GetColor();
852cdf0e10cSrcweir }
853cdf0e10cSrcweir }
854cdf0e10cSrcweir
855cdf0e10cSrcweir return nColor;
856cdf0e10cSrcweir }
857cdf0e10cSrcweir // -----------------------------------------------------------------------------
getBackground()858cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetVirtualAcc::getBackground( ) throw (RuntimeException)
859cdf0e10cSrcweir {
860cdf0e10cSrcweir OExternalLockGuard aGuard( this );
861cdf0e10cSrcweir sal_Int32 nColor = 0;
862cdf0e10cSrcweir if ( mpParent )
863cdf0e10cSrcweir {
864cdf0e10cSrcweir if ( mpParent->IsControlBackground() )
865cdf0e10cSrcweir nColor = mpParent->GetControlBackground().GetColor();
866cdf0e10cSrcweir else
867cdf0e10cSrcweir nColor = mpParent->GetBackground().GetColor().GetColor();
868cdf0e10cSrcweir }
869cdf0e10cSrcweir
870cdf0e10cSrcweir return nColor;
871cdf0e10cSrcweir }
872cdf0e10cSrcweir // -----------------------------------------------------------------------------
getForeground()873cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getForeground( ) throw (RuntimeException)
874cdf0e10cSrcweir {
875cdf0e10cSrcweir OExternalLockGuard aGuard( this );
876cdf0e10cSrcweir
877cdf0e10cSrcweir sal_Int32 nColor = 0;
878cdf0e10cSrcweir if ( m_pParent )
879cdf0e10cSrcweir nColor = m_pParent->getForeground();
880cdf0e10cSrcweir return nColor;
881cdf0e10cSrcweir }
882cdf0e10cSrcweir // -----------------------------------------------------------------------------
getBackground()883cdf0e10cSrcweir sal_Int32 SAL_CALL SvxShowCharSetAcc::getBackground( ) throw (RuntimeException)
884cdf0e10cSrcweir {
885cdf0e10cSrcweir OExternalLockGuard aGuard( this );
886cdf0e10cSrcweir sal_Int32 nColor = 0;
887cdf0e10cSrcweir if ( m_pParent )
888cdf0e10cSrcweir nColor = m_pParent->getBackground();
889cdf0e10cSrcweir return nColor;
890cdf0e10cSrcweir }
891cdf0e10cSrcweir // -----------------------------------------------------------------------------
892cdf0e10cSrcweir
893cdf0e10cSrcweir // -----------------------------------------------------------------------------
894cdf0e10cSrcweir } // namespace svx
895cdf0e10cSrcweir // -----------------------------------------------------------------------------
896cdf0e10cSrcweir
897cdf0e10cSrcweir
898