diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-01 17:50:14 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-01 17:50:14 +0200 |
commit | 93c3ff235afc52b048f808dede4f7c8c07f57252 (patch) | |
tree | a13a1deacaab2a3b8710d48bfec5e730254b1c6e /accessibility | |
parent | cdad00eca4f1e760c26348db521130c25e89f45b (diff) |
slidecopy: initial version of the A11Y API for the tool panel deck's tab layouter.
Effectively, the implementation showed that the current appraoch of the Deck having n+1 children
(n panel selector items, plus one active panel) doesn't work. So, a next step will be a re-factoring
so that the PanelDeck has 1+x children, where x children are provided by the layouter.
Diffstat (limited to 'accessibility')
4 files changed, 598 insertions, 7 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx new file mode 100644 index 000000000000..e52397fb7db1 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX +#define ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase1.hxx> +#include <rtl/ref.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class TabDeckLayouter; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem + //================================================================================================================== + class AccessibleToolPanelDeckTabBarItem_Impl; + typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleToolPanelDeckTabBarItem_Base; + class AccessibleToolPanelDeckTabBarItem : public AccessibleToolPanelDeckTabBarItem_Base + { + public: + AccessibleToolPanelDeckTabBarItem( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, + const size_t i_nItemPos + ); + + using AccessibleToolPanelDeckTabBarItem_Base::NotifyAccessibleEvent; + using AccessibleToolPanelDeckTabBarItem_Base::lateInit; + + protected: + virtual ~AccessibleToolPanelDeckTabBarItem(); + + public: + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + protected: + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + protected: + ::boost::scoped_ptr< AccessibleToolPanelDeckTabBarItem_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx new file mode 100644 index 000000000000..bf43ce660cf4 --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx @@ -0,0 +1,457 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "precompiled_accessibility.hxx" + +#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <svtools/toolpanel/tablayouter.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <unotools/accessiblerelationsethelper.hxx> +#include <tools/diagnose_ex.h> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + typedef ::com::sun::star::awt::Rectangle UnoRectangle; + typedef ::com::sun::star::awt::Point UnoPoint; + + /** === begin UNO using === **/ + using ::com::sun::star::uno::Reference; + using ::com::sun::star::uno::XInterface; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::UNO_SET_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::uno::RuntimeException; + using ::com::sun::star::uno::Any; + using ::com::sun::star::uno::makeAny; + using ::com::sun::star::uno::Sequence; + using ::com::sun::star::uno::Type; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::lang::IndexOutOfBoundsException; + using ::com::sun::star::accessibility::XAccessibleRelationSet; + using ::com::sun::star::accessibility::XAccessibleStateSet; + using ::com::sun::star::accessibility::XAccessibleComponent; + using ::com::sun::star::accessibility::XAccessibleExtendedComponent; + using ::com::sun::star::awt::XFont; + /** === end UNO using === **/ + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem_Impl + //================================================================================================================== + class AccessibleToolPanelDeckTabBarItem_Impl : public ::svt::IToolPanelDeckListener + { + public: + AccessibleToolPanelDeckTabBarItem_Impl( + AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, + const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, + const size_t i_nItemPos + ); + ~AccessibleToolPanelDeckTabBarItem_Impl(); + + // IToolPanelDeckListener + virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ); + virtual void PanelRemoved( const size_t i_nPosition ); + virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ); + virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ); + virtual void Dying(); + + public: + bool isDisposed() const { return m_pLayouter == NULL; } + void checkDisposed() const; + void dispose(); + + const Reference< XAccessible >& + getAccessibleParent() const { return m_xAccessibleParent; } + const ::rtl::Reference< ::svt::TabDeckLayouter >& + getLayouter() const { return m_pLayouter; } + size_t getItemPos() const { return m_nItemPos; } + + Reference< XAccessibleComponent > + getParentAccessibleComponent() const; + ::rtl::OUString + getPanelDisplayName(); + + private: + void impl_notifyBoundRectChanges(); + void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ); + + private: + AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; + const Reference< XAccessible > m_xAccessibleParent; + ::rtl::Reference< ::svt::TabDeckLayouter > m_pLayouter; + size_t m_nItemPos; + }; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem_Impl + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, + const size_t i_nItemPos ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pLayouter( i_pLayouter ) + ,m_nItemPos( i_nItemPos ) + { + ENSURE_OR_THROW( m_pLayouter.get() != NULL, "illegal layouter!" ); + + ::svt::IToolPanelDeck& rPanels( m_pLayouter->GetPanelDeck() ); + rPanels.AddListener( *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem_Impl::~AccessibleToolPanelDeckTabBarItem_Impl() + { + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::checkDisposed() const + { + if ( isDisposed() ) + throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::dispose() + { + ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelDeckTabBarItem_Impl::dispose: disposed twice!" ); + + ::svt::IToolPanelDeck& rPanels( m_pLayouter->GetPanelDeck() ); + rPanels.RemoveListener( *this ); + + m_pLayouter = NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const + { + Reference< XAccessible > xAccessibleParent( m_rAntiImpl.getAccessibleParent(), UNO_QUERY_THROW ); + return Reference< XAccessibleComponent >( xAccessibleParent->getAccessibleContext(), UNO_QUERY ); + } + + //------------------------------------------------------------------------------------------------------------------ + ::rtl::OUString AccessibleToolPanelDeckTabBarItem_Impl::getPanelDisplayName() + { + const ::rtl::Reference< ::svt::TabDeckLayouter > pLayouter( getLayouter() ); + const ::svt::IToolPanelDeck& rPanels( pLayouter->GetPanelDeck() ); + const ::svt::PToolPanel pPanel( rPanels.GetPanel( getItemPos() ) ); + if ( pPanel.get() == NULL ) + throw DisposedException(); + return pPanel->GetDisplayName(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyBoundRectChanges() + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ) + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, + i_nLostState > -1 ? makeAny( i_nLostState ) : Any(), + i_nGainedState > -1 ? makeAny( i_nGainedState ) : Any() + ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + if ( i_nPosition <= m_nItemPos ) + ++m_nItemPos; + impl_notifyBoundRectChanges(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::PanelRemoved( const size_t i_nPosition ) + { + if ( i_nPosition == m_nItemPos ) + { + m_rAntiImpl.dispose(); + } + else if ( i_nPosition < m_nItemPos ) + { + --m_nItemPos; + impl_notifyBoundRectChanges(); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( m_nItemPos == i_rOldActive ) + { + impl_notifyStateChange( AccessibleStateType::ACTIVE, -1 ); + impl_notifyStateChange( AccessibleStateType::SELECTED, -1 ); + } + else if ( m_nItemPos == i_rNewActive ) + { + impl_notifyStateChange( -1, AccessibleStateType::ACTIVE ); + impl_notifyStateChange( -1, AccessibleStateType::SELECTED ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + // if the tool panel deck has a new layouter, then the old layouter, and thus all items it was + // responsible for, died. So do we. + dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeckTabBarItem_Impl::Dying() + { + // if the tool panel deck is dying, then its layouter dies, so should we. + dispose(); + } + + //================================================================================================================== + //= ItemMethodGuard + //================================================================================================================== + class ItemMethodGuard + { + public: + ItemMethodGuard( AccessibleToolPanelDeckTabBarItem_Impl& i_rImpl ) + :m_aGuard( Application::GetSolarMutex() ) + { + i_rImpl.checkDisposed(); + } + ~ItemMethodGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + + private: + ::vos::OClearableGuard m_aGuard; + }; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent, + const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, const size_t i_nItemPos ) + :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_pLayouter, i_nItemPos ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem::~AccessibleToolPanelDeckTabBarItem() + { + } + + //-------------------------------------------------------------------- + sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChildCount( ) throw (RuntimeException) + { + return 0; + } + + //-------------------------------------------------------------------- + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException) + { + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + } + + //-------------------------------------------------------------------- + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleParent( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getAccessibleParent(); + } + + //-------------------------------------------------------------------- + sal_Int16 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRole( ) throw (RuntimeException) + { + return AccessibleRole::LIST_ITEM; + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleDescription( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getPanelDisplayName(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleName( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getPanelDisplayName(); + } + + //-------------------------------------------------------------------- + Reference< XAccessibleRelationSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRelationSet( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + ::utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper; + return pRelationSet; + } + + //-------------------------------------------------------------------- + Reference< XAccessibleStateSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleStateSet( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + + const ::rtl::Reference< ::svt::TabDeckLayouter > pLayouter( m_pImpl->getLayouter() ); + const ::svt::IToolPanelDeck& rPanels( pLayouter->GetPanelDeck() ); + + ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper ); + pStateSet->AddState( AccessibleStateType::FOCUSABLE ); + pStateSet->AddState( AccessibleStateType::SELECTABLE ); + pStateSet->AddState( AccessibleStateType::ICONIFIED ); + + if ( m_pImpl->getItemPos() == rPanels.GetActivePanel() ) + { + pStateSet->AddState( AccessibleStateType::ACTIVE ); + pStateSet->AddState( AccessibleStateType::SELECTED ); + } + + if ( m_pImpl->getItemPos() == pLayouter->GetFocusedPanelItem() ) + pStateSet->AddState( AccessibleStateType::FOCUSED ); + + if ( pLayouter->IsPanelSelectorEnabled() ) + pStateSet->AddState( AccessibleStateType::ENABLED ); + + if ( pLayouter->IsPanelSelectorVisible() ) + { + pStateSet->AddState( AccessibleStateType::SHOWING ); + pStateSet->AddState( AccessibleStateType::VISIBLE ); + } + + return pStateSet; + } + + + //-------------------------------------------------------------------- + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleAtPoint( const UnoPoint& i_rLocation ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + // we do not have children ... + return NULL; + } + + //-------------------------------------------------------------------- + void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + m_pImpl->getLayouter()->FocusPanelItem( m_pImpl->getItemPos() ); + } + + //-------------------------------------------------------------------- + ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getForeground( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); + return xParentComponent->getForeground(); + } + + //-------------------------------------------------------------------- + ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getBackground( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); + return xParentComponent->getBackground(); + } + + //-------------------------------------------------------------------- + Reference< XFont > SAL_CALL AccessibleToolPanelDeckTabBarItem::getFont( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + Reference< XAccessibleExtendedComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_QUERY_THROW ); + // TODO: strictly, this is not correct: The TabBar implementation of the TabLayouter might use + // a different font ... + return xParentComponent->getFont(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getTitledBorderText( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + // no support + return ::rtl::OUString(); + } + + //-------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getToolTipText( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + return m_pImpl->getPanelDisplayName(); + } + + //-------------------------------------------------------------------- + UnoRectangle SAL_CALL AccessibleToolPanelDeckTabBarItem::implGetBounds() throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + ::rtl::Reference< ::svt::TabDeckLayouter > pLayouter( m_pImpl->getLayouter() ); + + const ::Rectangle aItemScreenRect( pLayouter->GetItemScreenRect( m_pImpl->getItemPos() ) ); + + Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW ); + const UnoPoint aParentLocation( xParentComponent->getLocationOnScreen() ); + return UnoRectangle( + aItemScreenRect.Left() - aParentLocation.X, + aItemScreenRect.Top() - aParentLocation.Y, + aItemScreenRect.GetWidth(), + aItemScreenRect.GetHeight() + ); + } + + //-------------------------------------------------------------------- + void SAL_CALL AccessibleToolPanelDeckTabBarItem::disposing() + { + ItemMethodGuard aGuard( *m_pImpl ); + m_pImpl->dispose(); + } + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk index f0f234548547..81bdabe530ae 100755 --- a/accessibility/source/extended/makefile.mk +++ b/accessibility/source/extended/makefile.mk @@ -72,7 +72,8 @@ SLOFILES=\ $(SLO)$/AccessibleGridControlTableCell.obj \ $(SLO)$/AccessibleGridControlHeaderCell.obj \ $(SLO)$/AccessibleGridControlTable.obj \ - $(SLO)$/AccessibleToolPanelDeck.obj + $(SLO)$/AccessibleToolPanelDeck.obj \ + $(SLO)$/AccessibleToolPanelDeckTabBarItem.obj # --- Targets ------------------------------------------------------- diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index a0b09af9891d..69b0d7ec0954 100755 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -65,13 +65,15 @@ #include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx> #include <accessibility/extended/accessibleeditbrowseboxcell.hxx> #include <accessibility/extended/AccessibleToolPanelDeck.hxx> +#include <accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx> #include <vcl/lstbox.hxx> #include <vcl/combobox.hxx> #include <accessibility/extended/AccessibleGridControl.hxx> #include <svtools/accessibletable.hxx> -#include "vcl/popupmenuwindow.hxx" +#include <vcl/popupmenuwindow.hxx> +#include <cppuhelper/implbase1.hxx> -#include <floatingwindowaccessible.hxx> +#include "floatingwindowaccessible.hxx" //........................................................................ namespace accessibility @@ -95,6 +97,28 @@ inline bool hasFloatingChild(Window *pWindow) using namespace ::svt::table; //================================================================ + //= AccessibleWrapper + //================================================================ + typedef ::cppu::WeakImplHelper1< XAccessible > AccessibleWrapper_Base; + class AccessibleWrapper : public AccessibleWrapper_Base + { + public: + AccessibleWrapper( const Reference< XAccessibleContext >& i_rContext ) + :m_xContext( i_rContext ) + { + } + + // XAccessible + virtual Reference< XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (RuntimeException) + { + return m_xContext; + } + + private: + const Reference< XAccessibleContext > m_xContext; + }; + + //================================================================ //= IAccessibleFactory //================================================================ class AccessibleFactory :public ::toolkit::IAccessibleFactory @@ -233,7 +257,7 @@ inline bool hasFloatingChild(Window *pWindow) virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > createAccessibleToolPanelDeckTabBarItem( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, - ::svt::IToolPanelDeck& i_rPanelDeck, + const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, const size_t i_nItemPos ); @@ -527,10 +551,13 @@ inline bool hasFloatingChild(Window *pWindow) //-------------------------------------------------------------------- Reference< XAccessible > AccessibleFactory::createAccessibleToolPanelDeckTabBarItem( - const Reference< XAccessible >& /*i_rAccessibleParent*/, ::svt::IToolPanelDeck& /*i_rPanelDeck*/, const size_t /*i_nItemPos*/ ) + const Reference< XAccessible >& i_rAccessibleParent, const ::rtl::Reference< ::svt::TabDeckLayouter >& i_pLayouter, const size_t i_nItemPos ) { - // TODO - return NULL; + ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pItemContext( new AccessibleToolPanelDeckTabBarItem( + i_rAccessibleParent, i_pLayouter, i_nItemPos ) ); + Reference< XAccessible > xItemAccessible( new AccessibleWrapper( pItemContext.get() ) ); + pItemContext->lateInit( xItemAccessible ); + return xItemAccessible; } //........................................................................ |