1*0841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0841af79SAndrew Rist * distributed with this work for additional information 6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance 9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10*0841af79SAndrew Rist * 11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*0841af79SAndrew Rist * 13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0841af79SAndrew Rist * software distributed under the License is distributed on an 15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the 17*0841af79SAndrew Rist * specific language governing permissions and limitations 18*0841af79SAndrew Rist * under the License. 19*0841af79SAndrew Rist * 20*0841af79SAndrew Rist *************************************************************/ 21*0841af79SAndrew Rist 22*0841af79SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "precompiled_accessibility.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir /** === begin UNO includes === **/ 29cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 30cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 32cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 33cdf0e10cSrcweir /** === end UNO includes === **/ 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <svtools/toolpanel/toolpaneldeck.hxx> 36cdf0e10cSrcweir #include <svtools/toolpanel/paneltabbar.hxx> 37cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx> 38cdf0e10cSrcweir #include <unotools/accessiblerelationsethelper.hxx> 39cdf0e10cSrcweir #include <tools/diagnose_ex.h> 40cdf0e10cSrcweir #include <vcl/svapp.hxx> 41cdf0e10cSrcweir #include <vos/mutex.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir //...................................................................................................................... 44cdf0e10cSrcweir namespace accessibility 45cdf0e10cSrcweir { 46cdf0e10cSrcweir //...................................................................................................................... 47cdf0e10cSrcweir 48cdf0e10cSrcweir typedef ::com::sun::star::awt::Rectangle UnoRectangle; 49cdf0e10cSrcweir typedef ::com::sun::star::awt::Point UnoPoint; 50cdf0e10cSrcweir 51cdf0e10cSrcweir /** === begin UNO using === **/ 52cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 53cdf0e10cSrcweir using ::com::sun::star::uno::XInterface; 54cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 55cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 56cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW; 57cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 58cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 59cdf0e10cSrcweir using ::com::sun::star::uno::Any; 60cdf0e10cSrcweir using ::com::sun::star::uno::makeAny; 61cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 62cdf0e10cSrcweir using ::com::sun::star::uno::Type; 63cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessible; 64cdf0e10cSrcweir using ::com::sun::star::lang::DisposedException; 65cdf0e10cSrcweir using ::com::sun::star::lang::IndexOutOfBoundsException; 66cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessibleRelationSet; 67cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessibleStateSet; 68cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessibleComponent; 69cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessibleExtendedComponent; 70cdf0e10cSrcweir using ::com::sun::star::awt::XFont; 71cdf0e10cSrcweir /** === end UNO using === **/ 72cdf0e10cSrcweir 73cdf0e10cSrcweir namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; 74cdf0e10cSrcweir namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; 75cdf0e10cSrcweir namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; 76cdf0e10cSrcweir 77cdf0e10cSrcweir //================================================================================================================== 78cdf0e10cSrcweir //= AccessibleToolPanelDeckTabBarItem_Impl 79cdf0e10cSrcweir //================================================================================================================== 80cdf0e10cSrcweir class AccessibleToolPanelDeckTabBarItem_Impl : public ::svt::IToolPanelDeckListener 81cdf0e10cSrcweir { 82cdf0e10cSrcweir public: 83cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem_Impl( 84cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, 85cdf0e10cSrcweir const Reference< XAccessible >& i_rAccessibleParent, 86cdf0e10cSrcweir ::svt::IToolPanelDeck& i_rPanelDeck, 87cdf0e10cSrcweir ::svt::PanelTabBar& i_rTabBar, 88cdf0e10cSrcweir const size_t i_nItemPos 89cdf0e10cSrcweir ); 90cdf0e10cSrcweir ~AccessibleToolPanelDeckTabBarItem_Impl(); 91cdf0e10cSrcweir getTabBar() const92cdf0e10cSrcweir ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } 93cdf0e10cSrcweir 94cdf0e10cSrcweir // IToolPanelDeckListener 95cdf0e10cSrcweir virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); 96cdf0e10cSrcweir virtual void PanelRemoved( const size_t i_nPosition ); 97cdf0e10cSrcweir virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); 98cdf0e10cSrcweir virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); 99cdf0e10cSrcweir virtual void Dying(); 100cdf0e10cSrcweir 101cdf0e10cSrcweir public: isDisposed() const102cdf0e10cSrcweir bool isDisposed() const { return m_pPanelDeck == NULL; } 103cdf0e10cSrcweir void checkDisposed() const; 104cdf0e10cSrcweir void dispose(); 105cdf0e10cSrcweir 106cdf0e10cSrcweir const Reference< XAccessible >& getAccessibleParent() const107cdf0e10cSrcweir getAccessibleParent() const { return m_xAccessibleParent; } getItemPos() const108cdf0e10cSrcweir size_t getItemPos() const { return m_nItemPos; } 109cdf0e10cSrcweir 110cdf0e10cSrcweir Reference< XAccessibleComponent > getParentAccessibleComponent() const; getPanelDeck() const111cdf0e10cSrcweir ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } 112cdf0e10cSrcweir ::rtl::OUString getPanelDisplayName(); 113cdf0e10cSrcweir 114cdf0e10cSrcweir private: 115cdf0e10cSrcweir void impl_notifyBoundRectChanges(); 116cdf0e10cSrcweir void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir private: 119cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; 120cdf0e10cSrcweir Reference< XAccessible > m_xAccessibleParent; 121cdf0e10cSrcweir ::svt::IToolPanelDeck* m_pPanelDeck; 122cdf0e10cSrcweir ::svt::PanelTabBar* m_pTabBar; 123cdf0e10cSrcweir size_t m_nItemPos; 124cdf0e10cSrcweir }; 125cdf0e10cSrcweir 126cdf0e10cSrcweir //================================================================================================================== 127cdf0e10cSrcweir //= AccessibleToolPanelDeckTabBarItem_Impl 128cdf0e10cSrcweir //================================================================================================================== 129cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ AccessibleToolPanelDeckTabBarItem_Impl(AccessibleToolPanelDeckTabBarItem & i_rAntiImpl,const Reference<XAccessible> & i_rAccessibleParent,::svt::IToolPanelDeck & i_rPanelDeck,::svt::PanelTabBar & i_rTabBar,const size_t i_nItemPos)130cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, 131cdf0e10cSrcweir const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, 132cdf0e10cSrcweir const size_t i_nItemPos ) 133cdf0e10cSrcweir :m_rAntiImpl( i_rAntiImpl ) 134cdf0e10cSrcweir ,m_xAccessibleParent( i_rAccessibleParent ) 135cdf0e10cSrcweir ,m_pPanelDeck( &i_rPanelDeck ) 136cdf0e10cSrcweir ,m_pTabBar( &i_rTabBar ) 137cdf0e10cSrcweir ,m_nItemPos( i_nItemPos ) 138cdf0e10cSrcweir { 139cdf0e10cSrcweir m_pPanelDeck->AddListener( *this ); 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ ~AccessibleToolPanelDeckTabBarItem_Impl()143cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem_Impl::~AccessibleToolPanelDeckTabBarItem_Impl() 144cdf0e10cSrcweir { 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ checkDisposed() const148cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::checkDisposed() const 149cdf0e10cSrcweir { 150cdf0e10cSrcweir if ( isDisposed() ) 151cdf0e10cSrcweir throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); 152cdf0e10cSrcweir } 153cdf0e10cSrcweir 154cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ dispose()155cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::dispose() 156cdf0e10cSrcweir { 157cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelDeckTabBarItem_Impl::dispose: disposed twice!" ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir m_xAccessibleParent.clear(); 160cdf0e10cSrcweir m_pPanelDeck->RemoveListener( *this ); 161cdf0e10cSrcweir m_pPanelDeck = NULL; 162cdf0e10cSrcweir m_pTabBar = NULL; 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ getParentAccessibleComponent() const166cdf0e10cSrcweir Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const 167cdf0e10cSrcweir { 168cdf0e10cSrcweir Reference< XAccessible > xAccessibleParent( m_rAntiImpl.getAccessibleParent(), UNO_QUERY_THROW ); 169cdf0e10cSrcweir return Reference< XAccessibleComponent >( xAccessibleParent->getAccessibleContext(), UNO_QUERY ); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ getPanelDisplayName()173cdf0e10cSrcweir ::rtl::OUString AccessibleToolPanelDeckTabBarItem_Impl::getPanelDisplayName() 174cdf0e10cSrcweir { 175cdf0e10cSrcweir const ::svt::PToolPanel pPanel( m_pPanelDeck->GetPanel( getItemPos() ) ); 176cdf0e10cSrcweir if ( pPanel.get() == NULL ) 177cdf0e10cSrcweir throw DisposedException(); 178cdf0e10cSrcweir return pPanel->GetDisplayName(); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir 181cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ impl_notifyBoundRectChanges()182cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyBoundRectChanges() 183cdf0e10cSrcweir { 184cdf0e10cSrcweir m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() ); 185cdf0e10cSrcweir } 186cdf0e10cSrcweir 187cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ impl_notifyStateChange(const sal_Int16 i_nLostState,const sal_Int16 i_nGainedState)188cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, 191cdf0e10cSrcweir i_nLostState > -1 ? makeAny( i_nLostState ) : Any(), 192cdf0e10cSrcweir i_nGainedState > -1 ? makeAny( i_nGainedState ) : Any() 193cdf0e10cSrcweir ); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ PanelInserted(const::svt::PToolPanel & i_pPanel,const size_t i_nPosition)197cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir (void)i_pPanel; 200cdf0e10cSrcweir if ( i_nPosition <= m_nItemPos ) 201cdf0e10cSrcweir ++m_nItemPos; 202cdf0e10cSrcweir impl_notifyBoundRectChanges(); 203cdf0e10cSrcweir } 204cdf0e10cSrcweir 205cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ PanelRemoved(const size_t i_nPosition)206cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::PanelRemoved( const size_t i_nPosition ) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir if ( i_nPosition == m_nItemPos ) 209cdf0e10cSrcweir { 210cdf0e10cSrcweir m_rAntiImpl.dispose(); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir else if ( i_nPosition < m_nItemPos ) 213cdf0e10cSrcweir { 214cdf0e10cSrcweir --m_nItemPos; 215cdf0e10cSrcweir impl_notifyBoundRectChanges(); 216cdf0e10cSrcweir } 217cdf0e10cSrcweir } 218cdf0e10cSrcweir 219cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ ActivePanelChanged(const::boost::optional<size_t> & i_rOldActive,const::boost::optional<size_t> & i_rNewActive)220cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir if ( m_nItemPos == i_rOldActive ) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir impl_notifyStateChange( AccessibleStateType::ACTIVE, -1 ); 225cdf0e10cSrcweir impl_notifyStateChange( AccessibleStateType::SELECTED, -1 ); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir else if ( m_nItemPos == i_rNewActive ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir impl_notifyStateChange( -1, AccessibleStateType::ACTIVE ); 230cdf0e10cSrcweir impl_notifyStateChange( -1, AccessibleStateType::SELECTED ); 231cdf0e10cSrcweir } 232cdf0e10cSrcweir } 233cdf0e10cSrcweir 234cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ LayouterChanged(const::svt::PDeckLayouter & i_rNewLayouter)235cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir (void)i_rNewLayouter; 238cdf0e10cSrcweir // if the tool panel deck has a new layouter, then the old layouter, and thus all items it was 239cdf0e10cSrcweir // responsible for, died. So do we. 240cdf0e10cSrcweir dispose(); 241cdf0e10cSrcweir } 242cdf0e10cSrcweir 243cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ Dying()244cdf0e10cSrcweir void AccessibleToolPanelDeckTabBarItem_Impl::Dying() 245cdf0e10cSrcweir { 246cdf0e10cSrcweir // if the tool panel deck is dying, then its layouter dies, so should we. 247cdf0e10cSrcweir dispose(); 248cdf0e10cSrcweir } 249cdf0e10cSrcweir 250cdf0e10cSrcweir //================================================================================================================== 251cdf0e10cSrcweir //= ItemMethodGuard 252cdf0e10cSrcweir //================================================================================================================== 253cdf0e10cSrcweir class ItemMethodGuard 254cdf0e10cSrcweir { 255cdf0e10cSrcweir public: ItemMethodGuard(AccessibleToolPanelDeckTabBarItem_Impl & i_rImpl)256cdf0e10cSrcweir ItemMethodGuard( AccessibleToolPanelDeckTabBarItem_Impl& i_rImpl ) 257cdf0e10cSrcweir :m_aGuard( Application::GetSolarMutex() ) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir i_rImpl.checkDisposed(); 260cdf0e10cSrcweir } ~ItemMethodGuard()261cdf0e10cSrcweir ~ItemMethodGuard() 262cdf0e10cSrcweir { 263cdf0e10cSrcweir } 264cdf0e10cSrcweir clear()265cdf0e10cSrcweir void clear() 266cdf0e10cSrcweir { 267cdf0e10cSrcweir m_aGuard.clear(); 268cdf0e10cSrcweir } 269cdf0e10cSrcweir 270cdf0e10cSrcweir private: 271cdf0e10cSrcweir ::vos::OClearableGuard m_aGuard; 272cdf0e10cSrcweir }; 273cdf0e10cSrcweir 274cdf0e10cSrcweir //================================================================================================================== 275cdf0e10cSrcweir //= AccessibleToolPanelDeckTabBarItem 276cdf0e10cSrcweir //================================================================================================================== 277cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ AccessibleToolPanelDeckTabBarItem(const Reference<XAccessible> & i_rAccessibleParent,::svt::IToolPanelDeck & i_rPanelDeck,::svt::PanelTabBar & i_rTabBar,const size_t i_nItemPos)278cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent, 279cdf0e10cSrcweir ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos ) 280cdf0e10cSrcweir :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos ) ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ ~AccessibleToolPanelDeckTabBarItem()285cdf0e10cSrcweir AccessibleToolPanelDeckTabBarItem::~AccessibleToolPanelDeckTabBarItem() 286cdf0e10cSrcweir { 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChildCount()290cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChildCount( ) throw (RuntimeException) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir return 0; 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChild(sal_Int32 i)296cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir (void)i; 299cdf0e10cSrcweir throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); 300cdf0e10cSrcweir } 301cdf0e10cSrcweir 302cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleParent()303cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleParent( ) throw (RuntimeException) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 306cdf0e10cSrcweir return m_pImpl->getAccessibleParent(); 307cdf0e10cSrcweir } 308cdf0e10cSrcweir 309cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRole()310cdf0e10cSrcweir sal_Int16 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRole( ) throw (RuntimeException) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir return AccessibleRole::PAGE_TAB; 313cdf0e10cSrcweir } 314cdf0e10cSrcweir 315cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleDescription()316cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleDescription( ) throw (RuntimeException) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 319cdf0e10cSrcweir return m_pImpl->getPanelDisplayName(); 320cdf0e10cSrcweir } 321cdf0e10cSrcweir 322cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleName()323cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleName( ) throw (RuntimeException) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 326cdf0e10cSrcweir return m_pImpl->getPanelDisplayName(); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir 329cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRelationSet()330cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRelationSet( ) throw (RuntimeException) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 333cdf0e10cSrcweir ::utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; 334cdf0e10cSrcweir return pRelationSet; 335cdf0e10cSrcweir } 336cdf0e10cSrcweir 337cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleStateSet()338cdf0e10cSrcweir Reference< XAccessibleStateSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleStateSet( ) throw (RuntimeException) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 341cdf0e10cSrcweir 342cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper ); 343cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::FOCUSABLE ); 344cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::SELECTABLE ); 345cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ICONIFIED ); 346cdf0e10cSrcweir 347cdf0e10cSrcweir if ( m_pImpl->getItemPos() == m_pImpl->getPanelDeck()->GetActivePanel() ) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ACTIVE ); 350cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::SELECTED ); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir if ( m_pImpl->getItemPos() == m_pImpl->getTabBar()->GetFocusedPanelItem() ) 354cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::FOCUSED ); 355cdf0e10cSrcweir 356cdf0e10cSrcweir if ( m_pImpl->getTabBar()->IsEnabled() ) 357cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::ENABLED ); 358cdf0e10cSrcweir 359cdf0e10cSrcweir if ( m_pImpl->getTabBar()->IsVisible() ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::SHOWING ); 362cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::VISIBLE ); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir return pStateSet; 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir 369cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleAtPoint(const UnoPoint & i_rLocation)370cdf0e10cSrcweir Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleAtPoint( const UnoPoint& i_rLocation ) throw (RuntimeException) 371cdf0e10cSrcweir { 372cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 373cdf0e10cSrcweir // we do not have children ... 374cdf0e10cSrcweir (void)i_rLocation; 375cdf0e10cSrcweir return NULL; 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir //-------------------------------------------------------------------- grabFocus()379cdf0e10cSrcweir void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 382cdf0e10cSrcweir m_pImpl->getTabBar()->FocusPanelItem( m_pImpl->getItemPos() ); 383cdf0e10cSrcweir } 384cdf0e10cSrcweir 385cdf0e10cSrcweir //-------------------------------------------------------------------- getForeground()386cdf0e10cSrcweir ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getForeground( ) throw (RuntimeException) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 389cdf0e10cSrcweir Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); 390cdf0e10cSrcweir return xParentComponent->getForeground(); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir //-------------------------------------------------------------------- getBackground()394cdf0e10cSrcweir ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getBackground( ) throw (RuntimeException) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 397cdf0e10cSrcweir Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); 398cdf0e10cSrcweir return xParentComponent->getBackground(); 399cdf0e10cSrcweir } 400cdf0e10cSrcweir 401cdf0e10cSrcweir //-------------------------------------------------------------------- getFont()402cdf0e10cSrcweir Reference< XFont > SAL_CALL AccessibleToolPanelDeckTabBarItem::getFont( ) throw (RuntimeException) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 405cdf0e10cSrcweir Reference< XAccessibleExtendedComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_QUERY_THROW ); 406cdf0e10cSrcweir // TODO: strictly, this is not correct: The TabBar implementation of the TabLayouter might use 407cdf0e10cSrcweir // a different font ... 408cdf0e10cSrcweir return xParentComponent->getFont(); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir 411cdf0e10cSrcweir //-------------------------------------------------------------------- getTitledBorderText()412cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getTitledBorderText( ) throw (RuntimeException) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 415cdf0e10cSrcweir // no support 416cdf0e10cSrcweir return ::rtl::OUString(); 417cdf0e10cSrcweir } 418cdf0e10cSrcweir 419cdf0e10cSrcweir //-------------------------------------------------------------------- getToolTipText()420cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getToolTipText( ) throw (RuntimeException) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 423cdf0e10cSrcweir return m_pImpl->getPanelDisplayName(); 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426cdf0e10cSrcweir //-------------------------------------------------------------------- implGetBounds()427cdf0e10cSrcweir UnoRectangle SAL_CALL AccessibleToolPanelDeckTabBarItem::implGetBounds() throw (RuntimeException) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 430cdf0e10cSrcweir 431cdf0e10cSrcweir const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect( m_pImpl->getItemPos() ) ); 432cdf0e10cSrcweir 433cdf0e10cSrcweir Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); 434cdf0e10cSrcweir const UnoPoint aParentLocation( xParentComponent->getLocationOnScreen() ); 435cdf0e10cSrcweir return UnoRectangle( 436cdf0e10cSrcweir aItemScreenRect.Left() - aParentLocation.X, 437cdf0e10cSrcweir aItemScreenRect.Top() - aParentLocation.Y, 438cdf0e10cSrcweir aItemScreenRect.GetWidth(), 439cdf0e10cSrcweir aItemScreenRect.GetHeight() 440cdf0e10cSrcweir ); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir //-------------------------------------------------------------------- disposing()444cdf0e10cSrcweir void SAL_CALL AccessibleToolPanelDeckTabBarItem::disposing() 445cdf0e10cSrcweir { 446cdf0e10cSrcweir ItemMethodGuard aGuard( *m_pImpl ); 447cdf0e10cSrcweir m_pImpl->dispose(); 448cdf0e10cSrcweir } 449cdf0e10cSrcweir 450cdf0e10cSrcweir //...................................................................................................................... 451cdf0e10cSrcweir } // namespace accessibility 452cdf0e10cSrcweir //...................................................................................................................... 453