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 | a42067c4fd10629bd6b1f3a301b1e8eab5542584 (patch) | |
tree | 43ef4acecd26dedc4afda361d23dda952c3e9390 /svtools | |
parent | 076719b3429407d362f84d4939e67867cb502053 (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 'svtools')
-rwxr-xr-x | svtools/inc/svtools/accessiblefactory.hxx | 4 | ||||
-rwxr-xr-x | svtools/inc/svtools/toolpanel/tablayouter.hxx | 9 | ||||
-rwxr-xr-x | svtools/source/misc/svtaccessiblefactory.cxx | 2 | ||||
-rwxr-xr-x | svtools/source/toolpanel/paneltabbar.cxx | 45 | ||||
-rwxr-xr-x | svtools/source/toolpanel/paneltabbar.hxx | 3 | ||||
-rwxr-xr-x | svtools/source/toolpanel/tablayouter.cxx | 50 |
6 files changed, 109 insertions, 4 deletions
diff --git a/svtools/inc/svtools/accessiblefactory.hxx b/svtools/inc/svtools/accessiblefactory.hxx index 016d6a920fc6..ab5eb595f76f 100755 --- a/svtools/inc/svtools/accessiblefactory.hxx +++ b/svtools/inc/svtools/accessiblefactory.hxx @@ -65,7 +65,7 @@ namespace svt //........................................................................ class ToolPanelDeck; - class IToolPanelDeck; + class TabDeckLayouter; /** a function which is able to create a factory for the standard Accessible/Context components needed for standard toolkit controls @@ -177,7 +177,7 @@ namespace svt 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 ) = 0; }; diff --git a/svtools/inc/svtools/toolpanel/tablayouter.hxx b/svtools/inc/svtools/toolpanel/tablayouter.hxx index 6df82bc713b4..9d4b56db649c 100755 --- a/svtools/inc/svtools/toolpanel/tablayouter.hxx +++ b/svtools/inc/svtools/toolpanel/tablayouter.hxx @@ -79,6 +79,15 @@ namespace svt void SetTabItemContent( const TabItemContent& i_eItemContent ); TabAlignment GetTabAlignment() const; + // helpers for the A11Y implementation + IToolPanelDeck& GetPanelDeck() const; + ::boost::optional< size_t > + GetFocusedPanelItem() const; + void FocusPanelItem( const size_t i_nItemPos ); + bool IsPanelSelectorEnabled() const; + bool IsPanelSelectorVisible() const; + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; + // IDeckLayouter virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ); virtual void Destroy(); diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx index fc238348bd0b..8a45ee2e0b74 100755 --- a/svtools/source/misc/svtaccessiblefactory.cxx +++ b/svtools/source/misc/svtaccessiblefactory.cxx @@ -224,7 +224,7 @@ namespace svt 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*/ ) { diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index ceaa8ded4ce5..f9a40004cb61 100755 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -34,6 +34,7 @@ #include <vcl/button.hxx> #include <vcl/help.hxx> #include <vcl/virdev.hxx> +#include <tools/diagnose_ex.h> #include <boost/optional.hpp> #include <vector> @@ -382,6 +383,7 @@ namespace svt void InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const; void CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const; Rectangle GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const; + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; inline bool IsVertical() const { @@ -870,6 +872,23 @@ namespace svt } return ::boost::optional< size_t >(); } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle PanelTabBar_Impl::GetItemScreenRect( const size_t i_nItemPos ) const + { + ENSURE_OR_RETURN( i_nItemPos < m_aItems.size(), "PanelTabBar_Impl::GetItemScreenRect: invalid item pos!", Rectangle() ); + const ItemDescriptor& rItem( m_aItems[ i_nItemPos ] ); + const Rectangle aItemRect( m_aNormalizer.getTransformed( + GetActualLogicalItemRect( rItem.GetCurrentRect() ), + m_eTabAlignment ) ); + + const Rectangle aTabBarRect( m_rTabBar.GetWindowExtentsRelative( NULL ) ); + return Rectangle( + Point( aTabBarRect.Left() + aItemRect.Left(), aTabBarRect.Top() + aItemRect.Top() ), + aItemRect.GetSize() + ); + } + //------------------------------------------------------------------------------------------------------------------ IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton ) { @@ -1258,6 +1277,32 @@ namespace svt return m_pImpl->FindItemForPoint( i_rPoint ); } + //------------------------------------------------------------------------------------------------------------------ + ::boost::optional< size_t > PanelTabBar::GetFocusedPanelItem() const + { + return m_pImpl->m_aFocusedItem; + } + + //------------------------------------------------------------------------------------------------------------------ + void PanelTabBar::FocusPanelItem( const size_t i_nItemPos ) + { + ENSURE_OR_RETURN_VOID( i_nItemPos < m_pImpl->m_rPanelDeck.GetPanelCount(), "PanelTabBar::FocusPanelItem: illegal item pos!" ); + + if ( !HasChildPathFocus() ) + GrabFocus(); + + OSL_ENSURE( !!m_pImpl->m_aFocusedItem, "PanelTabBar::FocusPanelItem: have the focus, but not focused item?" ); + if ( !!m_pImpl->m_aFocusedItem ) + m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem ); + m_pImpl->m_aFocusedItem.reset( i_nItemPos ); + } + + //------------------------------------------------------------------------------------------------------------------ + Rectangle PanelTabBar::GetItemScreenRect( const size_t i_nItemPos ) const + { + return m_pImpl->GetItemScreenRect( i_nItemPos ); + } + //........................................................................ } // namespace svt //........................................................................ diff --git a/svtools/source/toolpanel/paneltabbar.hxx b/svtools/source/toolpanel/paneltabbar.hxx index 90792bd1864f..9de726cc1e58 100755 --- a/svtools/source/toolpanel/paneltabbar.hxx +++ b/svtools/source/toolpanel/paneltabbar.hxx @@ -60,6 +60,9 @@ namespace svt // operations ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const; + ::boost::optional< size_t > GetFocusedPanelItem() const; + void FocusPanelItem( const size_t i_nItemPos ); + Rectangle GetItemScreenRect( const size_t i_nItemPos ) const; // Window overridables virtual Size GetOptimalSize( WindowSizeType i_eType ) const; diff --git a/svtools/source/toolpanel/tablayouter.cxx b/svtools/source/toolpanel/tablayouter.cxx index 186b64c001a7..4f73558afecf 100755 --- a/svtools/source/toolpanel/tablayouter.cxx +++ b/svtools/source/toolpanel/tablayouter.cxx @@ -32,6 +32,7 @@ #include "svtaccessiblefactory.hxx" #include <tools/gen.hxx> +#include <tools/diagnose_ex.h> //........................................................................ namespace svt @@ -126,6 +127,53 @@ namespace svt } //-------------------------------------------------------------------- + IToolPanelDeck& TabDeckLayouter::GetPanelDeck() const + { + lcl_checkDisposed( *m_pData ); + return m_pData->rPanels; + } + + //-------------------------------------------------------------------- + ::boost::optional< size_t > TabDeckLayouter::GetFocusedPanelItem() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return ::boost::optional< size_t >(); + return m_pData->pTabBar->GetFocusedPanelItem(); + } + + //-------------------------------------------------------------------- + void TabDeckLayouter::FocusPanelItem( const size_t i_nItemPos ) + { + if ( lcl_checkDisposed( *m_pData ) ) + return; + m_pData->pTabBar->FocusPanelItem( i_nItemPos ); + } + + //-------------------------------------------------------------------- + bool TabDeckLayouter::IsPanelSelectorEnabled() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return false; + return m_pData->pTabBar->IsEnabled(); + } + + //-------------------------------------------------------------------- + bool TabDeckLayouter::IsPanelSelectorVisible() const + { + if ( lcl_checkDisposed( *m_pData ) ) + return false; + return m_pData->pTabBar->IsVisible(); + } + + //-------------------------------------------------------------------- + Rectangle TabDeckLayouter::GetItemScreenRect( const size_t i_nItemPos ) const + { + if ( lcl_checkDisposed( *m_pData ) ) + return Rectangle(); + return m_pData->pTabBar->GetItemScreenRect( i_nItemPos ); + } + + //-------------------------------------------------------------------- Rectangle TabDeckLayouter::Layout( const Rectangle& i_rDeckPlayground ) { if ( lcl_checkDisposed( *m_pData ) ) @@ -210,7 +258,7 @@ namespace svt { if ( lcl_checkDisposed( *m_pData ) ) return NULL; - return m_pData->aAccessibleFactory.getFactory().createAccessibleToolPanelDeckTabBarItem( i_rParentAccessible, m_pData->rPanels, i_nItemPos ); + return m_pData->aAccessibleFactory.getFactory().createAccessibleToolPanelDeckTabBarItem( i_rParentAccessible, this, i_nItemPos ); } //........................................................................ |