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.
This commit is contained in:
parent
076719b342
commit
a42067c4fd
6 changed files with 109 additions and 4 deletions
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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*/
|
||||
)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
//........................................................................
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "svtaccessiblefactory.hxx"
|
||||
|
||||
#include <tools/gen.hxx>
|
||||
#include <tools/diagnose_ex.h>
|
||||
|
||||
//........................................................................
|
||||
namespace svt
|
||||
|
@ -125,6 +126,53 @@ namespace svt
|
|||
return m_pData->eAlignment;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
//........................................................................
|
||||
|
|
Loading…
Reference in a new issue