diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-09 09:37:17 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-04-09 09:37:17 +0200 |
commit | 72cc18f2f44c8855a1a1737b1ae77f9803c0a70c (patch) | |
tree | 74aa5069455fc22339ce549035e15b16772ff3bd /accessibility | |
parent | 1b192bd38a3695cc2965ece438d47d6f74958289 (diff) | |
parent | b7b7e92dded92c924a136910cca7d99c371af8c8 (diff) |
slidecopy: merge CWS wth MWS-m76
Diffstat (limited to 'accessibility')
-rwxr-xr-x | accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx | 91 | ||||
-rw-r--r-- | accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx | 92 | ||||
-rw-r--r-- | accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx | 107 | ||||
-rw-r--r-- | accessibility/inc/accessibility/helper/accessiblestrings.hrc | 3 | ||||
-rwxr-xr-x | accessibility/source/extended/AccessibleToolPanelDeck.cxx | 408 | ||||
-rw-r--r-- | accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx | 459 | ||||
-rw-r--r-- | accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx | 456 | ||||
-rwxr-xr-x[-rw-r--r--] | accessibility/source/extended/makefile.mk | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | accessibility/source/helper/acc_factory.cxx | 40 | ||||
-rw-r--r-- | accessibility/source/helper/accessiblestrings.src | 4 |
10 files changed, 1655 insertions, 10 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx new file mode 100755 index 000000000000..10c6520b6a3d --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * 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_ACCESSIBLETOOLPANELDECK_HXX +#define ACC_ACCESSIBLETOOLPANELDECK_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class ToolPanelDeck; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelDeck + //================================================================================================================== + class AccessibleToolPanelDeck_Impl; + typedef VCLXAccessibleComponent AccessibleToolPanelDeck_Base; + class AccessibleToolPanelDeck : public AccessibleToolPanelDeck_Base + { + public: + AccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + + using AccessibleToolPanelDeck_Base::NotifyAccessibleEvent; + + protected: + virtual ~AccessibleToolPanelDeck(); + + // 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); + + // 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); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + private: + ::boost::scoped_ptr< AccessibleToolPanelDeck_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELDECK_HXX diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx new file mode 100644 index 000000000000..cc2d39c5acbf --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * 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_ACCESSIBLETOOLPANELTABBAR_HXX +#define ACC_ACCESSIBLETOOLPANELTABBAR_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class IToolPanelDeck; + class PanelTabBar; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelTabBar + //================================================================================================================== + class AccessibleToolPanelTabBar_Impl; + typedef VCLXAccessibleComponent AccessibleToolPanelTabBar_Base; + class AccessibleToolPanelTabBar : public AccessibleToolPanelTabBar_Base + { + public: + AccessibleToolPanelTabBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + + using AccessibleToolPanelTabBar_Base::NotifyAccessibleEvent; + + protected: + virtual ~AccessibleToolPanelTabBar(); + + // 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); + + // 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); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + private: + ::boost::scoped_ptr< AccessibleToolPanelTabBar_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELTABBAR_HXX diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx new file mode 100644 index 000000000000..80b2ccaaf104 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * 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 <boost/scoped_ptr.hpp> + +namespace svt +{ + class IToolPanelDeck; + class PanelTabBar; +} + +//...................................................................................................................... +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, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar, + 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/inc/accessibility/helper/accessiblestrings.hrc b/accessibility/inc/accessibility/helper/accessiblestrings.hrc index 859da828beb1..1f936e678b98 100644 --- a/accessibility/inc/accessibility/helper/accessiblestrings.hrc +++ b/accessibility/inc/accessibility/helper/accessiblestrings.hrc @@ -45,7 +45,8 @@ #define RID_STR_ACC_ACTION_DECBLOCK ( RID_TK_ACC_START + 6 ) -#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 1000 ) +#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 100 ) +#define RID_STR_ACC_DESC_PANELDECL_TABBAR ( RID_TK_ACC_START + 101 ) // ----------------------------------------------------------------------------- diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx new file mode 100755 index 000000000000..14739b7777ff --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeck.cxx @@ -0,0 +1,408 @@ +/************************************************************************* + * 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/AccessibleToolPanelDeck.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <tools/diagnose_ex.h> + +#include <boost/noncopyable.hpp> +#include <vector> + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + /** === 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::accessibility::XAccessibleContext; + using ::com::sun::star::lang::DisposedException; + using ::com::sun::star::lang::IndexOutOfBoundsException; + using ::com::sun::star::lang::Locale; + using ::com::sun::star::accessibility::XAccessibleRelationSet; + using ::com::sun::star::accessibility::XAccessibleStateSet; + using ::com::sun::star::accessibility::IllegalAccessibleComponentStateException; + using ::com::sun::star::awt::XFont; + /** === end UNO using === **/ + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + + typedef ::com::sun::star::awt::Rectangle UnoRectangle; + typedef ::com::sun::star::awt::Point UnoPoint; + + //================================================================================================================== + //= AccessibleToolPanelDeck_Impl - declaration + //================================================================================================================== + class AccessibleToolPanelDeck_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener + { + public: + AccessibleToolPanelDeck_Impl( + AccessibleToolPanelDeck& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + + void checkDisposed(); + bool isDisposed() const { return m_pPanelDeck == NULL; } + void dispose(); + + ~AccessibleToolPanelDeck_Impl(); + + Reference< XAccessible > getOwnAccessible() const; + Reference< XAccessible > getActivePanelAccessible(); + + protected: + // 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: + AccessibleToolPanelDeck& m_rAntiImpl; + Reference< XAccessible > m_xAccessibleParent; + ::svt::ToolPanelDeck* m_pPanelDeck; + + typedef ::std::vector< Reference< XAccessible > > AccessibleChildren; + Reference< XAccessible > m_xActivePanelAccessible; + }; + + //================================================================================================================== + //= MethodGuard + //================================================================================================================== + namespace + { + class MethodGuard + { + public: + MethodGuard( AccessibleToolPanelDeck_Impl& i_rImpl ) + :m_aGuard( Application::GetSolarMutex() ) + { + i_rImpl.checkDisposed(); + } + ~MethodGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + + private: + ::vos::OClearableGuard m_aGuard; + }; + } + + //================================================================================================================== + //= AccessibleToolPanelDeck_Impl - implementation + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck_Impl::AccessibleToolPanelDeck_Impl( AccessibleToolPanelDeck& i_rAntiImpl, const Reference< XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pPanelDeck( &i_rPanelDeck ) + ,m_xActivePanelAccessible() + { + m_pPanelDeck->AddListener( *this ); + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck_Impl::~AccessibleToolPanelDeck_Impl() + { + if ( !isDisposed() ) + dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::dispose() + { + ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck = NULL; + m_xAccessibleParent.clear(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::checkDisposed() + { + if ( isDisposed() ) + throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelDeck_Impl::getOwnAccessible() const + { + Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); + OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), + "AccessibleToolPanelDeck_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); + return xOwnAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelDeck_Impl::getActivePanelAccessible() + { + ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: already disposed!", NULL ); + + if ( !m_xActivePanelAccessible.is() ) + { + ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() ); + ENSURE_OR_RETURN( !!aActivePanel, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: this should not be called without an active panel!", NULL ); + ::svt::PToolPanel pActivePanel( m_pPanelDeck->GetPanel( *aActivePanel ) ); + ENSURE_OR_RETURN( pActivePanel.get() != NULL, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: no active panel!", NULL ); + m_xActivePanelAccessible = pActivePanel->CreatePanelAccessible( getOwnAccessible() ); + } + + return m_xActivePanelAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + (void)i_pPanel; + (void)i_nPosition; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition ) + { + (void)i_nPosition; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + if ( !!i_rOldActive ) + { + if ( !m_xActivePanelAccessible.is() ) + { + // again, this might in theory happen if the XAccessible for the active panel has never before been requested. + // In this case, just say that all our children are invalid, so they all must be re-requested. + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); + } + else + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( m_xActivePanelAccessible ), Any() ); + } + } + + m_xActivePanelAccessible.clear(); + + if ( !!i_rNewActive ) + { + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getActivePanelAccessible() ) ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + MethodGuard aGuard( *this ); + + (void)i_rNewLayouter; + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck_Impl::Dying() + { + // the tool panel deck is dying, so dispose ourself + m_rAntiImpl.dispose(); + } + + //================================================================================================================== + //= AccessibleToolPanelDeck + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck::AccessibleToolPanelDeck( const Reference< XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck ) + :AccessibleToolPanelDeck_Base( i_rPanelDeck.GetWindowPeer() ) + ,m_pImpl( new AccessibleToolPanelDeck_Impl( *this, i_rAccessibleParent, i_rPanelDeck ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeck::~AccessibleToolPanelDeck() + { + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int32 SAL_CALL AccessibleToolPanelDeck::getAccessibleChildCount( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + sal_Int32 nChildCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); + + ::boost::optional< size_t > aActivePanel( m_pImpl->m_pPanelDeck->GetActivePanel() ); + if ( !!aActivePanel ) + return ++nChildCount; + + return nChildCount; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const sal_Int32 nChildCount( getAccessibleChildCount() ); + if ( ( i_nIndex < 0 ) || ( i_nIndex >= nChildCount ) ) + throw IndexOutOfBoundsException( ::rtl::OUString(), *this ); + + // first "n" children are provided by the layouter + const size_t nLayouterCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() ); + if ( size_t( i_nIndex ) < nLayouterCount ) + return m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChild( + size_t( i_nIndex ), + m_pImpl->getOwnAccessible() + ); + + // the last child is the XAccessible of the active panel + return m_pImpl->getActivePanelAccessible(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleParent( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return m_pImpl->m_xAccessibleParent; + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int16 SAL_CALL AccessibleToolPanelDeck::getAccessibleRole( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return AccessibleRole::PANEL; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const ::Point aRequestedPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); + // check the panel window itself + const ::Window& rActivePanelAnchor( m_pImpl->m_pPanelDeck->GetPanelWindowAnchor() ); + const Rectangle aPanelAnchorArea( rActivePanelAnchor.GetPosPixel(), rActivePanelAnchor.GetOutputSizePixel() ); + if ( aPanelAnchorArea.IsInside( aRequestedPoint ) ) + // note that this assumes that the Window which actually implements the concrete panel covers + // the complete area of its "anchor" Window. But this is ensured by the ToolPanelDeck implementation. + return m_pImpl->getActivePanelAccessible(); + + // check the XAccessible instances provided by the layouter + try + { + const ::svt::PDeckLayouter pLayouter( m_pImpl->m_pPanelDeck->GetLayouter() ); + ENSURE_OR_THROW( pLayouter.get() != NULL, "invalid layouter" ); + + const size_t nLayouterChildren = pLayouter->GetAccessibleChildCount(); + for ( size_t i=0; i<nLayouterChildren; ++i ) + { + const Reference< XAccessible > xLayoutItemAccessible( pLayouter->GetAccessibleChild( i, m_pImpl->getOwnAccessible() ), UNO_SET_THROW ); + const Reference< XAccessibleComponent > xLayoutItemComponent( xLayoutItemAccessible->getAccessibleContext(), UNO_QUERY_THROW ); + const ::Rectangle aLayoutItemBounds( VCLUnoHelper::ConvertToVCLRect( xLayoutItemComponent->getBounds() ) ); + if ( aLayoutItemBounds.IsInside( aRequestedPoint ) ) + return xLayoutItemAccessible; + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL AccessibleToolPanelDeck::grabFocus( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + m_pImpl->m_pPanelDeck->GrabFocus(); + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL AccessibleToolPanelDeck::disposing() + { + AccessibleToolPanelDeck_Base::disposing(); + m_pImpl->dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelDeck::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) + { + // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those + // A11Y events ourself + (void)i_rVclWindowEvent; + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelDeck::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) + { + AccessibleToolPanelDeck_Base::FillAccessibleStateSet( i_rStateSet ); + if ( m_pImpl->isDisposed() ) + { + i_rStateSet.AddState( AccessibleStateType::DEFUNC ); + } + else + { + i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + } + } + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx new file mode 100644 index 000000000000..7e97e3714172 --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx @@ -0,0 +1,459 @@ +/************************************************************************* + * 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/AccessibleToolPanelDeckTabBar.hxx" +#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx" +#include "accessibility/helper/accresmgr.hxx" +#include "accessibility/helper/accessiblestrings.hrc" + +/** === begin UNO includes === **/ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +/** === end UNO includes === **/ + +#include <svtools/toolpanel/toolpaneldeck.hxx> +#include <svtools/toolpanel/paneltabbar.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> +#include <vcl/button.hxx> +#include <vos/mutex.hxx> +#include <tools/diagnose_ex.h> + +#include <vector> + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + /** === 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::XAccessibleContext; + /** === end UNO using === **/ + + namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole; + namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; + namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; + + typedef ::com::sun::star::awt::Point UnoPoint; + typedef ::com::sun::star::awt::Size UnoSize; + typedef ::com::sun::star::awt::Rectangle UnoRectangle; + + //================================================================================================================== + //= 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; + }; + + //================================================================================================================== + //= AccessibleToolPanelTabBar_Impl + //================================================================================================================== + class AccessibleToolPanelTabBar_Impl :public ::boost::noncopyable + ,public ::svt::IToolPanelDeckListener + { + public: + AccessibleToolPanelTabBar_Impl( + AccessibleToolPanelTabBar& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + ~AccessibleToolPanelTabBar_Impl(); + + void checkDisposed(); + bool isDisposed() const { return m_pPanelDeck == NULL; } + void dispose(); + + ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } + ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } + const Reference< XAccessible >& getAccessibleParent() const { return m_xAccessibleParent; } + Reference< XAccessible > getAccessiblePanelItem( size_t i_nPosition ); + Reference< XAccessible > getOwnAccessible() const; + + protected: + // 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(); + + DECL_LINK( OnWindowEvent, const VclSimpleEvent* ); + + private: + AccessibleToolPanelTabBar& m_rAntiImpl; + Reference< XAccessible > m_xAccessibleParent; + ::svt::IToolPanelDeck* m_pPanelDeck; + ::svt::PanelTabBar* m_pTabBar; + ::std::vector< Reference< XAccessible > > m_aChildren; + }; + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar_Impl::AccessibleToolPanelTabBar_Impl( AccessibleToolPanelTabBar& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pPanelDeck( &i_rPanelDeck ) + ,m_pTabBar( &i_rTabBar ) + ,m_aChildren() + { + m_pPanelDeck->AddListener( *this ); + m_aChildren.resize( m_pPanelDeck->GetPanelCount() ); + + const String sAccessibleDescription( TK_RES_STRING( RID_STR_ACC_DESC_PANELDECL_TABBAR ) ); + i_rTabBar.SetAccessibleName( sAccessibleDescription ); + i_rTabBar.SetAccessibleDescription( sAccessibleDescription ); + + i_rTabBar.GetScrollButton( true ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + i_rTabBar.GetScrollButton( false ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::checkDisposed() + { + if ( isDisposed() ) + throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl ); + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar_Impl::~AccessibleToolPanelTabBar_Impl() + { + if ( !isDisposed() ) + dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::dispose() + { + ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" ); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck = NULL; + + m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) ); + m_pTabBar = NULL; + + m_xAccessibleParent.clear(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem( size_t i_nPosition ) + { + ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: already disposed!", NULL ); + ENSURE_OR_RETURN( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: invalid index!", NULL ); + + Reference< XAccessible >& rAccessibleChild( m_aChildren[ i_nPosition ] ); + if ( !rAccessibleChild.is() ) + { + ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pAccesibleItemContext( new AccessibleToolPanelDeckTabBarItem( + getOwnAccessible(), *m_pPanelDeck, *m_pTabBar, i_nPosition ) ); + rAccessibleChild.set( new AccessibleWrapper( pAccesibleItemContext.get() ) ); + pAccesibleItemContext->lateInit( rAccessibleChild ); + } + return rAccessibleChild; + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getOwnAccessible() const + { + Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) ); + OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ), + "AccessibleToolPanelTabBar_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" ); + return xOwnAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition ) + { + ENSURE_OR_RETURN_VOID( i_nPosition <= m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); + (void)i_pPanel; + m_aChildren.insert( m_aChildren.begin() + i_nPosition, NULL ); + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getAccessiblePanelItem( i_nPosition ) ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::PanelRemoved( const size_t i_nPosition ) + { + ENSURE_OR_RETURN_VOID( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" ); + + const Reference< XAccessible > xOldChild( getAccessiblePanelItem( i_nPosition ) ); + m_aChildren.erase( m_aChildren.begin() + i_nPosition ); + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xOldChild ), Any() ); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) + { + (void)i_rOldActive; + (void)i_rNewActive; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter ) + { + (void)i_rNewLayouter; + m_rAntiImpl.dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar_Impl::Dying() + { + m_rAntiImpl.dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + IMPL_LINK( AccessibleToolPanelTabBar_Impl, OnWindowEvent, const VclSimpleEvent*, i_pEvent ) + { + ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!", 0L ); + + const VclWindowEvent* pWindowEvent( dynamic_cast< const VclWindowEvent* >( i_pEvent ) ); + if ( !pWindowEvent ) + return 0L; + + const bool bForwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( true ) ); + const bool bBackwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( false ) ); + ENSURE_OR_RETURN( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?", 0L ); + + const bool bShow = ( i_pEvent->GetId() == VCLEVENT_WINDOW_SHOW ); + const bool bHide = ( i_pEvent->GetId() == VCLEVENT_WINDOW_HIDE ); + if ( !bShow && !bHide ) + // not interested in events other than visibility changes + return 0L; + + const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() ); + const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() ); + const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() ); + m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild ); + + return 1L; + } + + //================================================================================================================== + //= MethodGuard + //================================================================================================================== + namespace + { + class MethodGuard + { + public: + MethodGuard( AccessibleToolPanelTabBar_Impl& i_rImpl ) + :m_aGuard( Application::GetSolarMutex() ) + { + i_rImpl.checkDisposed(); + } + ~MethodGuard() + { + } + + void clear() + { + m_aGuard.clear(); + } + + private: + ::vos::OClearableGuard m_aGuard; + }; + } + + //================================================================================================================== + //= AccessibleToolPanelTabBar + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar::AccessibleToolPanelTabBar( const Reference< XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) + :AccessibleToolPanelTabBar_Base( i_rTabBar.GetWindowPeer() ) + ,m_pImpl( new AccessibleToolPanelTabBar_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar ) ) + { + } + + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelTabBar::~AccessibleToolPanelTabBar() + { + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int32 SAL_CALL AccessibleToolPanelTabBar::getAccessibleChildCount( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); + const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); + + return m_pImpl->getPanelDeck()->GetPanelCount() + + ( bHasScrollBack ? 1 : 0 ) + + ( bHasScrollForward ? 1 : 0 ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); + const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); + + const bool bScrollBackRequested = ( bHasScrollBack && ( i_nIndex == 0 ) ); + const bool bScrollForwardRequested = ( bHasScrollForward && ( i_nIndex == getAccessibleChildCount() - 1 ) ); + OSL_ENSURE( !( bScrollBackRequested && bScrollForwardRequested ), "AccessibleToolPanelTabBar::getAccessibleChild: ouch!" ); + + if ( bScrollBackRequested || bScrollForwardRequested ) + { + Reference< XAccessible > xScrollButtonAccessible( m_pImpl->getTabBar()->GetScrollButton( bScrollForwardRequested ).GetAccessible() ); + ENSURE_OR_RETURN( xScrollButtonAccessible.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible!", NULL ); + #if OSL_DEBUG_LEVEL > 0 + Reference< XAccessibleContext > xScrollButtonContext( xScrollButtonAccessible->getAccessibleContext() ); + ENSURE_OR_RETURN( xScrollButtonContext.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible context!", xScrollButtonAccessible ); + OSL_ENSURE( xScrollButtonContext->getAccessibleParent() == m_pImpl->getOwnAccessible(), + "AccessibleToolPanelTabBar::getAccessibleChild: wrong parent at the button's accesible!" ); + #endif + return xScrollButtonAccessible; + } + + return m_pImpl->getAccessiblePanelItem( i_nIndex - ( bHasScrollBack ? 1 : 0 ) ); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleParent( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return m_pImpl->getAccessibleParent(); + } + + //------------------------------------------------------------------------------------------------------------------ + sal_Int16 SAL_CALL AccessibleToolPanelTabBar::getAccessibleRole( ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + return AccessibleRole::PAGE_TAB_LIST; + } + + //------------------------------------------------------------------------------------------------------------------ + namespace + { + bool lcl_covers( const ::Window& i_rWindow, const ::Point& i_rPoint ) + { + const Rectangle aWindowBounds( i_rWindow.GetWindowExtentsRelative( i_rWindow.GetParent() ) ); + return aWindowBounds.IsInside( i_rPoint ); + } + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException) + { + MethodGuard aGuard( *m_pImpl ); + + // check the tab items + const UnoPoint aOwnScreenPos( getLocationOnScreen() ); + const ::Point aRequestedScreenPoint( i_rPoint.X + aOwnScreenPos.X, i_rPoint.Y + aOwnScreenPos.Y ); + + for ( size_t i=0; i<m_pImpl->getPanelDeck()->GetPanelCount(); ++i ) + { + const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect(i) ); + if ( aItemScreenRect.IsInside( aRequestedScreenPoint ) ) + return m_pImpl->getAccessiblePanelItem(i); + } + + // check the scroll buttons + const ::Point aRequestedClientPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) ); + + const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible(); + if ( bHasScrollBack && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( false ), aRequestedClientPoint ) ) + return m_pImpl->getTabBar()->GetScrollButton( false ).GetAccessible(); + + const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible(); + if ( bHasScrollForward && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( true ), aRequestedClientPoint ) ) + return m_pImpl->getTabBar()->GetScrollButton( true ).GetAccessible(); + + // no hit + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void SAL_CALL AccessibleToolPanelTabBar::disposing() + { + AccessibleToolPanelTabBar_Base::disposing(); + m_pImpl->dispose(); + } + + //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > AccessibleToolPanelTabBar::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ) + { + // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those + // A11Y events ourself + (void)i_rVclWindowEvent; + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ + void AccessibleToolPanelTabBar::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) + { + AccessibleToolPanelTabBar_Base::FillAccessibleStateSet( i_rStateSet ); + i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); + + ENSURE_OR_RETURN_VOID( !m_pImpl->isDisposed(), "AccessibleToolPanelTabBar::FillAccessibleStateSet: already disposed!" ); + if ( m_pImpl->getTabBar()->IsVertical() ) + i_rStateSet.AddState( AccessibleStateType::VERTICAL ); + else + i_rStateSet.AddState( AccessibleStateType::HORIZONTAL ); + } + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx new file mode 100644 index 000000000000..24130b18aab9 --- /dev/null +++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx @@ -0,0 +1,456 @@ +/************************************************************************* + * 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/paneltabbar.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, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar, + const size_t i_nItemPos + ); + ~AccessibleToolPanelDeckTabBarItem_Impl(); + + ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; } + + // 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_pPanelDeck == NULL; } + void checkDisposed() const; + void dispose(); + + const Reference< XAccessible >& + getAccessibleParent() const { return m_xAccessibleParent; } + size_t getItemPos() const { return m_nItemPos; } + + Reference< XAccessibleComponent > getParentAccessibleComponent() const; + ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; } + ::rtl::OUString getPanelDisplayName(); + + private: + void impl_notifyBoundRectChanges(); + void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState ); + + private: + AccessibleToolPanelDeckTabBarItem& m_rAntiImpl; + Reference< XAccessible > m_xAccessibleParent; + ::svt::IToolPanelDeck* m_pPanelDeck; + ::svt::PanelTabBar* m_pTabBar; + size_t m_nItemPos; + }; + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem_Impl + //================================================================================================================== + //------------------------------------------------------------------------------------------------------------------ + AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl, + const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, + const size_t i_nItemPos ) + :m_rAntiImpl( i_rAntiImpl ) + ,m_xAccessibleParent( i_rAccessibleParent ) + ,m_pPanelDeck( &i_rPanelDeck ) + ,m_pTabBar( &i_rTabBar ) + ,m_nItemPos( i_nItemPos ) + { + m_pPanelDeck->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!" ); + + m_xAccessibleParent.clear(); + m_pPanelDeck->RemoveListener( *this ); + m_pPanelDeck = NULL; + m_pTabBar = 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 ::svt::PToolPanel pPanel( m_pPanelDeck->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 ) + { + (void)i_pPanel; + 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 ) + { + (void)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, + ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos ) + :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, 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) + { + (void)i; + 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::PAGE_TAB; + } + + //-------------------------------------------------------------------- + ::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 ); + + ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper ); + pStateSet->AddState( AccessibleStateType::FOCUSABLE ); + pStateSet->AddState( AccessibleStateType::SELECTABLE ); + pStateSet->AddState( AccessibleStateType::ICONIFIED ); + + if ( m_pImpl->getItemPos() == m_pImpl->getPanelDeck()->GetActivePanel() ) + { + pStateSet->AddState( AccessibleStateType::ACTIVE ); + pStateSet->AddState( AccessibleStateType::SELECTED ); + } + + if ( m_pImpl->getItemPos() == m_pImpl->getTabBar()->GetFocusedPanelItem() ) + pStateSet->AddState( AccessibleStateType::FOCUSED ); + + if ( m_pImpl->getTabBar()->IsEnabled() ) + pStateSet->AddState( AccessibleStateType::ENABLED ); + + if ( m_pImpl->getTabBar()->IsVisible() ) + { + 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 ... + (void)i_rLocation; + return NULL; + } + + //-------------------------------------------------------------------- + void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException) + { + ItemMethodGuard aGuard( *m_pImpl ); + m_pImpl->getTabBar()->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 ); + + const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->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() + ); + return UnoRectangle(); + } + + //-------------------------------------------------------------------- + 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 446ec73ec1b7..27f4403c8210 100644..100755 --- a/accessibility/source/extended/makefile.mk +++ b/accessibility/source/extended/makefile.mk @@ -70,7 +70,10 @@ SLOFILES=\ $(SLO)$/AccessibleGridControlHeader.obj \ $(SLO)$/AccessibleGridControlTableCell.obj \ $(SLO)$/AccessibleGridControlHeaderCell.obj \ - $(SLO)$/AccessibleGridControlTable.obj + $(SLO)$/AccessibleGridControlTable.obj \ + $(SLO)$/AccessibleToolPanelDeck.obj \ + $(SLO)$/AccessibleToolPanelDeckTabBar.obj \ + $(SLO)$/AccessibleToolPanelDeckTabBarItem.obj # --- Targets ------------------------------------------------------- diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index 50d3ac682377..7279b5e2ff60 100644..100755 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -29,18 +29,12 @@ #include "precompiled_accessibility.hxx" #include <accessibility/helper/acc_factory.hxx> -#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX #include <toolkit/awt/vclxwindows.hxx> -#endif #include <accessibility/standard/vclxaccessiblebutton.hxx> #include <accessibility/standard/vclxaccessiblecheckbox.hxx> -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWCOMBOBOX_HXX #include <accessibility/standard/vclxaccessibledropdowncombobox.hxx> -#endif #include <accessibility/standard/vclxaccessiblecombobox.hxx> -#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWLISTBOX_HXX #include <accessibility/standard/vclxaccessibledropdownlistbox.hxx> -#endif #include <accessibility/standard/vclxaccessibleedit.hxx> #include <accessibility/standard/vclxaccessiblefixedhyperlink.hxx> #include <accessibility/standard/vclxaccessiblefixedtext.hxx> @@ -67,13 +61,17 @@ #include <accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx> #include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx> #include <accessibility/extended/accessibleeditbrowseboxcell.hxx> +#include <accessibility/extended/AccessibleToolPanelDeck.hxx> +#include <accessibility/extended/AccessibleToolPanelDeckTabBar.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 @@ -227,6 +225,18 @@ inline bool hasFloatingChild(Window *pWindow) sal_uInt16 _nColPos ) const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + createAccessibleToolPanelTabBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + protected: virtual ~AccessibleFactory(); }; @@ -508,6 +518,20 @@ inline bool hasFloatingChild(Window *pWindow) _rxFocusWindow, _rBrowseBox, _nRowPos, _nColPos ); } + //-------------------------------------------------------------------- + Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelDeck( + const Reference< XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck ) + { + return new AccessibleToolPanelDeck( i_rAccessibleParent, i_rPanelDeck ); + } + + //-------------------------------------------------------------------- + Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelTabBar( + const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar ) + { + return new AccessibleToolPanelTabBar( i_rAccessibleParent, i_rPanelDeck, i_rTabBar ); + } + //........................................................................ } // namespace accessibility //........................................................................ diff --git a/accessibility/source/helper/accessiblestrings.src b/accessibility/source/helper/accessiblestrings.src index 4df1391f3c1d..ee7f77f9b502 100644 --- a/accessibility/source/helper/accessiblestrings.src +++ b/accessibility/source/helper/accessiblestrings.src @@ -70,3 +70,7 @@ String RID_STR_ACC_NAME_BROWSEBUTTON Text [ en-US ] = "Browse"; }; +String RID_STR_ACC_DESC_PANELDECL_TABBAR +{ + Text [ en-US ] = "Panel Deck Tab Bar"; +}; |