Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 : : *
5 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
6 : : *
7 : : * OpenOffice.org - a multi-platform office productivity suite
8 : : *
9 : : * This file is part of OpenOffice.org.
10 : : *
11 : : * OpenOffice.org is free software: you can redistribute it and/or modify
12 : : * it under the terms of the GNU Lesser General Public License version 3
13 : : * only, as published by the Free Software Foundation.
14 : : *
15 : : * OpenOffice.org is distributed in the hope that it will be useful,
16 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : : * GNU Lesser General Public License version 3 for more details
19 : : * (a copy is included in the LICENSE file that accompanied this code).
20 : : *
21 : : * You should have received a copy of the GNU Lesser General Public License
22 : : * version 3 along with OpenOffice.org. If not, see
23 : : * <http://www.openoffice.org/license.html>
24 : : * for a copy of the LGPLv3 License.
25 : : *
26 : : ************************************************************************/
27 : :
28 : :
29 : : #include "accessibility/extended/AccessibleToolPanelDeckTabBar.hxx"
30 : : #include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx"
31 : : #include "accessibility/helper/accresmgr.hxx"
32 : : #include "accessibility/helper/accessiblestrings.hrc"
33 : :
34 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
35 : : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
36 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
37 : : #include <com/sun/star/lang/DisposedException.hpp>
38 : :
39 : : #include <svtools/toolpanel/toolpaneldeck.hxx>
40 : : #include <svtools/toolpanel/paneltabbar.hxx>
41 : : #include <unotools/accessiblestatesethelper.hxx>
42 : : #include <toolkit/awt/vclxwindow.hxx>
43 : : #include <toolkit/helper/vclunohelper.hxx>
44 : : #include <vcl/svapp.hxx>
45 : : #include <vcl/button.hxx>
46 : : #include <osl/mutex.hxx>
47 : : #include <tools/diagnose_ex.h>
48 : :
49 : : #include <vector>
50 : :
51 : : //......................................................................................................................
52 : : namespace accessibility
53 : : {
54 : : //......................................................................................................................
55 : :
56 : : /** === begin UNO using === **/
57 : : using ::com::sun::star::uno::Reference;
58 : : using ::com::sun::star::uno::XInterface;
59 : : using ::com::sun::star::uno::UNO_QUERY;
60 : : using ::com::sun::star::uno::UNO_QUERY_THROW;
61 : : using ::com::sun::star::uno::UNO_SET_THROW;
62 : : using ::com::sun::star::uno::Exception;
63 : : using ::com::sun::star::uno::RuntimeException;
64 : : using ::com::sun::star::uno::Any;
65 : : using ::com::sun::star::uno::makeAny;
66 : : using ::com::sun::star::uno::Sequence;
67 : : using ::com::sun::star::uno::Type;
68 : : using ::com::sun::star::accessibility::XAccessible;
69 : : using ::com::sun::star::lang::DisposedException;
70 : : using ::com::sun::star::lang::IndexOutOfBoundsException;
71 : : using ::com::sun::star::accessibility::XAccessibleContext;
72 : : /** === end UNO using === **/
73 : :
74 : : namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
75 : : namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
76 : : namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
77 : :
78 : : typedef ::com::sun::star::awt::Point UnoPoint;
79 : :
80 : : //==================================================================================================================
81 : : //= AccessibleWrapper
82 : : //==================================================================================================================
83 : : typedef ::cppu::WeakImplHelper1< XAccessible > AccessibleWrapper_Base;
84 [ # # ]: 0 : class AccessibleWrapper : public AccessibleWrapper_Base
85 : : {
86 : : public:
87 : 0 : AccessibleWrapper( const Reference< XAccessibleContext >& i_rContext )
88 : 0 : :m_xContext( i_rContext )
89 : : {
90 : 0 : }
91 : :
92 : : // XAccessible
93 : 0 : virtual Reference< XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (RuntimeException)
94 : : {
95 : 0 : return m_xContext;
96 : : }
97 : :
98 : : private:
99 : : const Reference< XAccessibleContext > m_xContext;
100 : : };
101 : :
102 : : //==================================================================================================================
103 : : //= AccessibleToolPanelTabBar_Impl
104 : : //==================================================================================================================
105 : : class AccessibleToolPanelTabBar_Impl :public ::boost::noncopyable
106 : : ,public ::svt::IToolPanelDeckListener
107 : : {
108 : : public:
109 : : AccessibleToolPanelTabBar_Impl(
110 : : AccessibleToolPanelTabBar& i_rAntiImpl,
111 : : const Reference< XAccessible >& i_rAccessibleParent,
112 : : ::svt::IToolPanelDeck& i_rPanelDeck,
113 : : ::svt::PanelTabBar& i_rTabBar
114 : : );
115 : : virtual ~AccessibleToolPanelTabBar_Impl();
116 : :
117 : : void checkDisposed();
118 : 0 : bool isDisposed() const { return m_pPanelDeck == NULL; }
119 : : void dispose();
120 : :
121 : 0 : ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; }
122 : 0 : ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; }
123 : 0 : const Reference< XAccessible >& getAccessibleParent() const { return m_xAccessibleParent; }
124 : : Reference< XAccessible > getAccessiblePanelItem( size_t i_nPosition );
125 : : Reference< XAccessible > getOwnAccessible() const;
126 : :
127 : : protected:
128 : : // IToolPanelDeckListener
129 : : virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
130 : : virtual void PanelRemoved( const size_t i_nPosition );
131 : : virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
132 : : virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
133 : : virtual void Dying();
134 : :
135 : : DECL_LINK( OnWindowEvent, const VclSimpleEvent* );
136 : :
137 : : private:
138 : : AccessibleToolPanelTabBar& m_rAntiImpl;
139 : : Reference< XAccessible > m_xAccessibleParent;
140 : : ::svt::IToolPanelDeck* m_pPanelDeck;
141 : : ::svt::PanelTabBar* m_pTabBar;
142 : : ::std::vector< Reference< XAccessible > > m_aChildren;
143 : : };
144 : :
145 : : //------------------------------------------------------------------------------------------------------------------
146 : 0 : AccessibleToolPanelTabBar_Impl::AccessibleToolPanelTabBar_Impl( AccessibleToolPanelTabBar& i_rAntiImpl,
147 : : const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar )
148 : : :m_rAntiImpl( i_rAntiImpl )
149 : : ,m_xAccessibleParent( i_rAccessibleParent )
150 : : ,m_pPanelDeck( &i_rPanelDeck )
151 : : ,m_pTabBar( &i_rTabBar )
152 [ # # ]: 0 : ,m_aChildren()
153 : : {
154 [ # # ]: 0 : m_pPanelDeck->AddListener( *this );
155 [ # # ][ # # ]: 0 : m_aChildren.resize( m_pPanelDeck->GetPanelCount() );
156 : :
157 [ # # ][ # # ]: 0 : const String sAccessibleDescription( TK_RES_STRING( RID_STR_ACC_DESC_PANELDECL_TABBAR ) );
158 [ # # ]: 0 : i_rTabBar.SetAccessibleName( sAccessibleDescription );
159 [ # # ]: 0 : i_rTabBar.SetAccessibleDescription( sAccessibleDescription );
160 : :
161 [ # # ][ # # ]: 0 : i_rTabBar.GetScrollButton( true ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
[ # # ]
162 [ # # ][ # # ]: 0 : i_rTabBar.GetScrollButton( false ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
[ # # ][ # # ]
163 : 0 : }
164 : :
165 : : //------------------------------------------------------------------------------------------------------------------
166 : 0 : void AccessibleToolPanelTabBar_Impl::checkDisposed()
167 : : {
168 [ # # ]: 0 : if ( isDisposed() )
169 [ # # ][ # # ]: 0 : throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl );
170 : 0 : }
171 : :
172 : : //------------------------------------------------------------------------------------------------------------------
173 : 0 : AccessibleToolPanelTabBar_Impl::~AccessibleToolPanelTabBar_Impl()
174 : : {
175 [ # # ]: 0 : if ( !isDisposed() )
176 [ # # ]: 0 : dispose();
177 [ # # ]: 0 : }
178 : :
179 : : //------------------------------------------------------------------------------------------------------------------
180 : 0 : void AccessibleToolPanelTabBar_Impl::dispose()
181 : : {
182 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" );
183 : 0 : m_pPanelDeck->RemoveListener( *this );
184 : 0 : m_pPanelDeck = NULL;
185 : :
186 [ # # ][ # # ]: 0 : m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
187 [ # # ][ # # ]: 0 : m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
188 : 0 : m_pTabBar = NULL;
189 : :
190 : 0 : m_xAccessibleParent.clear();
191 : : }
192 : :
193 : : //------------------------------------------------------------------------------------------------------------------
194 : 0 : Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem( size_t i_nPosition )
195 : : {
196 [ # # ]: 0 : ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: already disposed!", NULL );
197 [ # # ]: 0 : ENSURE_OR_RETURN( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: invalid index!", NULL );
198 : :
199 : 0 : Reference< XAccessible >& rAccessibleChild( m_aChildren[ i_nPosition ] );
200 [ # # ]: 0 : if ( !rAccessibleChild.is() )
201 : : {
202 : : ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pAccesibleItemContext( new AccessibleToolPanelDeckTabBarItem(
203 [ # # ][ # # ]: 0 : getOwnAccessible(), *m_pPanelDeck, *m_pTabBar, i_nPosition ) );
204 [ # # ][ # # ]: 0 : rAccessibleChild.set( new AccessibleWrapper( pAccesibleItemContext.get() ) );
[ # # ][ # # ]
[ # # ]
205 [ # # ]: 0 : pAccesibleItemContext->lateInit( rAccessibleChild );
206 : : }
207 : 0 : return rAccessibleChild;
208 : : }
209 : :
210 : : //------------------------------------------------------------------------------------------------------------------
211 : 0 : Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getOwnAccessible() const
212 : : {
213 [ # # ]: 0 : Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) );
214 : : OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ),
215 : : "AccessibleToolPanelTabBar_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" );
216 : 0 : return xOwnAccessible;
217 : : }
218 : :
219 : : //------------------------------------------------------------------------------------------------------------------
220 : 0 : void AccessibleToolPanelTabBar_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
221 : : {
222 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( i_nPosition <= m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" );
223 : : (void)i_pPanel;
224 [ # # ][ # # ]: 0 : m_aChildren.insert( m_aChildren.begin() + i_nPosition, NULL );
225 [ # # ][ # # ]: 0 : m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getAccessiblePanelItem( i_nPosition ) ) );
226 : : }
227 : :
228 : : //------------------------------------------------------------------------------------------------------------------
229 : 0 : void AccessibleToolPanelTabBar_Impl::PanelRemoved( const size_t i_nPosition )
230 : : {
231 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" );
232 : :
233 [ # # ]: 0 : const Reference< XAccessible > xOldChild( getAccessiblePanelItem( i_nPosition ) );
234 [ # # ][ # # ]: 0 : m_aChildren.erase( m_aChildren.begin() + i_nPosition );
235 [ # # ][ # # ]: 0 : m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xOldChild ), Any() );
236 : : }
237 : :
238 : : //------------------------------------------------------------------------------------------------------------------
239 : 0 : void AccessibleToolPanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
240 : : {
241 : : (void)i_rOldActive;
242 : : (void)i_rNewActive;
243 : 0 : }
244 : :
245 : : //------------------------------------------------------------------------------------------------------------------
246 : 0 : void AccessibleToolPanelTabBar_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
247 : : {
248 : : (void)i_rNewLayouter;
249 : 0 : m_rAntiImpl.dispose();
250 : 0 : }
251 : :
252 : : //------------------------------------------------------------------------------------------------------------------
253 : 0 : void AccessibleToolPanelTabBar_Impl::Dying()
254 : : {
255 : 0 : m_rAntiImpl.dispose();
256 : 0 : }
257 : :
258 : : //------------------------------------------------------------------------------------------------------------------
259 : 0 : IMPL_LINK( AccessibleToolPanelTabBar_Impl, OnWindowEvent, const VclSimpleEvent*, i_pEvent )
260 : : {
261 [ # # ]: 0 : ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!", 0L );
262 : :
263 [ # # ]: 0 : const VclWindowEvent* pWindowEvent( dynamic_cast< const VclWindowEvent* >( i_pEvent ) );
264 [ # # ]: 0 : if ( !pWindowEvent )
265 : 0 : return 0L;
266 : :
267 [ # # ]: 0 : const bool bForwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( true ) );
268 [ # # ]: 0 : const bool bBackwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( false ) );
269 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?", 0L );
270 : :
271 : 0 : const bool bShow = ( i_pEvent->GetId() == VCLEVENT_WINDOW_SHOW );
272 : 0 : const bool bHide = ( i_pEvent->GetId() == VCLEVENT_WINDOW_HIDE );
273 [ # # ][ # # ]: 0 : if ( !bShow && !bHide )
274 : : // not interested in events other than visibility changes
275 : 0 : return 0L;
276 : :
277 [ # # ][ # # ]: 0 : const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() );
278 [ # # ][ # # ]: 0 : const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() );
279 [ # # ][ # # ]: 0 : const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() );
280 [ # # ]: 0 : m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild );
281 : :
282 : 0 : return 1L;
283 : : }
284 : :
285 : : //==================================================================================================================
286 : : //= MethodGuard
287 : : //==================================================================================================================
288 : : namespace
289 : : {
290 : : class MethodGuard
291 : : {
292 : : public:
293 : 0 : MethodGuard( AccessibleToolPanelTabBar_Impl& i_rImpl )
294 : 0 : :m_aGuard()
295 : : {
296 [ # # ]: 0 : i_rImpl.checkDisposed();
297 : 0 : }
298 : 0 : ~MethodGuard()
299 : 0 : {
300 : 0 : }
301 : :
302 : : private:
303 : : SolarMutexGuard m_aGuard;
304 : : };
305 : : }
306 : :
307 : : //==================================================================================================================
308 : : //= AccessibleToolPanelTabBar
309 : : //==================================================================================================================
310 : : //------------------------------------------------------------------------------------------------------------------
311 : 0 : AccessibleToolPanelTabBar::AccessibleToolPanelTabBar( const Reference< XAccessible >& i_rAccessibleParent,
312 : : ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar )
313 : : :AccessibleToolPanelTabBar_Base( i_rTabBar.GetWindowPeer() )
314 [ # # ][ # # ]: 0 : ,m_pImpl( new AccessibleToolPanelTabBar_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar ) )
315 : : {
316 : 0 : }
317 : :
318 : : //------------------------------------------------------------------------------------------------------------------
319 [ # # ]: 0 : AccessibleToolPanelTabBar::~AccessibleToolPanelTabBar()
320 : : {
321 [ # # ]: 0 : }
322 : :
323 : : //------------------------------------------------------------------------------------------------------------------
324 : 0 : sal_Int32 SAL_CALL AccessibleToolPanelTabBar::getAccessibleChildCount( ) throw (RuntimeException)
325 : : {
326 [ # # ]: 0 : MethodGuard aGuard( *m_pImpl );
327 : :
328 [ # # ][ # # ]: 0 : const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible();
329 [ # # ][ # # ]: 0 : const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible();
330 : :
331 [ # # ]: 0 : return m_pImpl->getPanelDeck()->GetPanelCount()
332 : : + ( bHasScrollBack ? 1 : 0 )
333 [ # # ][ # # ]: 0 : + ( bHasScrollForward ? 1 : 0 );
[ # # ]
334 : : }
335 : :
336 : : //------------------------------------------------------------------------------------------------------------------
337 : 0 : Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
338 : : {
339 [ # # ]: 0 : MethodGuard aGuard( *m_pImpl );
340 : :
341 [ # # ][ # # ]: 0 : const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible();
342 [ # # ][ # # ]: 0 : const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible();
343 : :
344 [ # # ][ # # ]: 0 : const bool bScrollBackRequested = ( bHasScrollBack && ( i_nIndex == 0 ) );
345 [ # # ][ # # ]: 0 : const bool bScrollForwardRequested = ( bHasScrollForward && ( i_nIndex == getAccessibleChildCount() - 1 ) );
[ # # ]
346 : : OSL_ENSURE( !( bScrollBackRequested && bScrollForwardRequested ), "AccessibleToolPanelTabBar::getAccessibleChild: ouch!" );
347 : :
348 [ # # ][ # # ]: 0 : if ( bScrollBackRequested || bScrollForwardRequested )
349 : : {
350 [ # # ][ # # ]: 0 : Reference< XAccessible > xScrollButtonAccessible( m_pImpl->getTabBar()->GetScrollButton( bScrollForwardRequested ).GetAccessible() );
351 [ # # ][ # # ]: 0 : ENSURE_OR_RETURN( xScrollButtonAccessible.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible!", NULL );
352 : : #if OSL_DEBUG_LEVEL > 0
353 : : Reference< XAccessibleContext > xScrollButtonContext( xScrollButtonAccessible->getAccessibleContext() );
354 : : ENSURE_OR_RETURN( xScrollButtonContext.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible context!", xScrollButtonAccessible );
355 : : OSL_ENSURE( xScrollButtonContext->getAccessibleParent() == m_pImpl->getOwnAccessible(),
356 : : "AccessibleToolPanelTabBar::getAccessibleChild: wrong parent at the button's accesible!" );
357 : : #endif
358 : 0 : return xScrollButtonAccessible;
359 : : }
360 : :
361 [ # # ][ # # ]: 0 : return m_pImpl->getAccessiblePanelItem( i_nIndex - ( bHasScrollBack ? 1 : 0 ) );
[ # # ]
362 : : }
363 : :
364 : : //------------------------------------------------------------------------------------------------------------------
365 : 0 : Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleParent( ) throw (RuntimeException)
366 : : {
367 [ # # ]: 0 : MethodGuard aGuard( *m_pImpl );
368 [ # # ]: 0 : return m_pImpl->getAccessibleParent();
369 : : }
370 : :
371 : : //------------------------------------------------------------------------------------------------------------------
372 : 0 : sal_Int16 SAL_CALL AccessibleToolPanelTabBar::getAccessibleRole( ) throw (RuntimeException)
373 : : {
374 [ # # ]: 0 : MethodGuard aGuard( *m_pImpl );
375 [ # # ]: 0 : return AccessibleRole::PAGE_TAB_LIST;
376 : : }
377 : :
378 : : //------------------------------------------------------------------------------------------------------------------
379 : : namespace
380 : : {
381 : 0 : bool lcl_covers( const ::Window& i_rWindow, const ::Point& i_rPoint )
382 : : {
383 [ # # ][ # # ]: 0 : const Rectangle aWindowBounds( i_rWindow.GetWindowExtentsRelative( i_rWindow.GetParent() ) );
384 [ # # ]: 0 : return aWindowBounds.IsInside( i_rPoint );
385 : : }
386 : : }
387 : :
388 : : //------------------------------------------------------------------------------------------------------------------
389 : 0 : Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException)
390 : : {
391 [ # # ]: 0 : MethodGuard aGuard( *m_pImpl );
392 : :
393 : : // check the tab items
394 [ # # ]: 0 : const UnoPoint aOwnScreenPos( getLocationOnScreen() );
395 : 0 : const ::Point aRequestedScreenPoint( i_rPoint.X + aOwnScreenPos.X, i_rPoint.Y + aOwnScreenPos.Y );
396 : :
397 [ # # ][ # # ]: 0 : for ( size_t i=0; i<m_pImpl->getPanelDeck()->GetPanelCount(); ++i )
398 : : {
399 [ # # ]: 0 : const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect(i) );
400 [ # # ][ # # ]: 0 : if ( aItemScreenRect.IsInside( aRequestedScreenPoint ) )
401 [ # # ]: 0 : return m_pImpl->getAccessiblePanelItem(i);
402 : : }
403 : :
404 : : // check the scroll buttons
405 [ # # ]: 0 : const ::Point aRequestedClientPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) );
406 : :
407 [ # # ][ # # ]: 0 : const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible();
408 [ # # ][ # # ]: 0 : if ( bHasScrollBack && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( false ), aRequestedClientPoint ) )
[ # # ][ # # ]
[ # # ]
409 [ # # ][ # # ]: 0 : return m_pImpl->getTabBar()->GetScrollButton( false ).GetAccessible();
410 : :
411 [ # # ][ # # ]: 0 : const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible();
412 [ # # ][ # # ]: 0 : if ( bHasScrollForward && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( true ), aRequestedClientPoint ) )
[ # # ][ # # ]
[ # # ]
413 [ # # ][ # # ]: 0 : return m_pImpl->getTabBar()->GetScrollButton( true ).GetAccessible();
414 : :
415 : : // no hit
416 [ # # ][ # # ]: 0 : return NULL;
417 : : }
418 : :
419 : : //------------------------------------------------------------------------------------------------------------------
420 : 0 : void SAL_CALL AccessibleToolPanelTabBar::disposing()
421 : : {
422 : 0 : AccessibleToolPanelTabBar_Base::disposing();
423 : 0 : m_pImpl->dispose();
424 : 0 : }
425 : :
426 : : //------------------------------------------------------------------------------------------------------------------
427 : 0 : Reference< XAccessible > AccessibleToolPanelTabBar::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent )
428 : : {
429 : : // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those
430 : : // A11Y events ourself
431 : : (void)i_rVclWindowEvent;
432 : 0 : return NULL;
433 : : }
434 : :
435 : : //------------------------------------------------------------------------------------------------------------------
436 : 0 : void AccessibleToolPanelTabBar::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet )
437 : : {
438 : 0 : AccessibleToolPanelTabBar_Base::FillAccessibleStateSet( i_rStateSet );
439 : 0 : i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
440 : :
441 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( !m_pImpl->isDisposed(), "AccessibleToolPanelTabBar::FillAccessibleStateSet: already disposed!" );
442 [ # # ]: 0 : if ( m_pImpl->getTabBar()->IsVertical() )
443 : 0 : i_rStateSet.AddState( AccessibleStateType::VERTICAL );
444 : : else
445 : 0 : i_rStateSet.AddState( AccessibleStateType::HORIZONTAL );
446 : : }
447 : :
448 : : //......................................................................................................................
449 : : } // namespace accessibility
450 : : //......................................................................................................................
451 : :
452 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|