sllidecopy: inject an artifical A11Y component into the A11Y object hierarchy, for ZoomText to actually read the tool panel deck drawers
This commit is contained in:
parent
0582a26307
commit
8d3cd06bdf
3 changed files with 73 additions and 6 deletions
|
@ -49,6 +49,30 @@ namespace svt
|
|||
|
||||
static const int s_nIndentationWidth = 16;
|
||||
|
||||
//==================================================================================================================
|
||||
//= DrawerVisualization
|
||||
//==================================================================================================================
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
DrawerVisualization::DrawerVisualization( ToolPanelDrawer& i_rParent )
|
||||
:Window( &i_rParent )
|
||||
,m_rDrawer( i_rParent )
|
||||
{
|
||||
Show();
|
||||
SetAccessibleRole( AccessibleRole::LABEL );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
DrawerVisualization::~DrawerVisualization()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox )
|
||||
{
|
||||
Window::Paint( i_rBoundingBox );
|
||||
m_rDrawer.Paint();
|
||||
}
|
||||
|
||||
//==================================================================================================================
|
||||
//= ToolPanelDrawer
|
||||
//==================================================================================================================
|
||||
|
@ -56,6 +80,7 @@ namespace svt
|
|||
ToolPanelDrawer::ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle )
|
||||
:Window( &i_rParent, WB_TABSTOP )
|
||||
,m_pPaintDevice( new VirtualDevice( *this ) )
|
||||
,m_aVisualization( *this )
|
||||
,m_bFocused( false )
|
||||
,m_bExpanded( false )
|
||||
{
|
||||
|
@ -63,11 +88,14 @@ namespace svt
|
|||
SetBackground( Wallpaper() );
|
||||
SetPointer( POINTER_REFHAND );
|
||||
|
||||
SetAccessibleRole( AccessibleRole::LABEL );
|
||||
SetAccessibleRole( AccessibleRole::LIST_ITEM );
|
||||
|
||||
SetText( i_rTitle );
|
||||
SetAccessibleName( i_rTitle );
|
||||
SetAccessibleDescription( i_rTitle );
|
||||
|
||||
m_aVisualization.SetAccessibleName( i_rTitle );
|
||||
m_aVisualization.SetAccessibleDescription( i_rTitle );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -83,7 +111,7 @@ namespace svt
|
|||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
void ToolPanelDrawer::Paint( const Rectangle& i_rBoundingBox )
|
||||
void ToolPanelDrawer::Paint()
|
||||
{
|
||||
m_pPaintDevice->SetMapMode( GetMapMode() );
|
||||
m_pPaintDevice->SetOutputSize( GetOutputSizePixel() );
|
||||
|
@ -101,13 +129,11 @@ namespace svt
|
|||
aFocusBox.Left() += 2;
|
||||
impl_paintFocusIndicator( aFocusBox );
|
||||
|
||||
DrawOutDev(
|
||||
m_aVisualization.DrawOutDev(
|
||||
Point(), GetOutputSizePixel(),
|
||||
Point(), GetOutputSizePixel(),
|
||||
*m_pPaintDevice
|
||||
);
|
||||
|
||||
::Window::Paint( i_rBoundingBox );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -222,6 +248,13 @@ namespace svt
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
void ToolPanelDrawer::Resize()
|
||||
{
|
||||
Window::Resize();
|
||||
m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
void ToolPanelDrawer::MouseButtonDown( const MouseEvent& i_rMouseEvent )
|
||||
{
|
||||
|
|
|
@ -34,6 +34,33 @@ namespace svt
|
|||
{
|
||||
//......................................................................................................................
|
||||
|
||||
class ToolPanelDrawer;
|
||||
//==================================================================================================================
|
||||
//= DrawerVisualization
|
||||
//==================================================================================================================
|
||||
/** serves a single purpose - let ZoomText read the drawers ...
|
||||
|
||||
Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
|
||||
of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
|
||||
such a child into the A11Y hierarchy, we use this window here.
|
||||
|
||||
(We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
|
||||
this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
|
||||
*/
|
||||
class DrawerVisualization : public Window
|
||||
{
|
||||
public:
|
||||
DrawerVisualization( ToolPanelDrawer& i_rParent );
|
||||
~DrawerVisualization();
|
||||
|
||||
protected:
|
||||
// Window overridables
|
||||
virtual void Paint( const Rectangle& i_rBoundingBox );
|
||||
|
||||
private:
|
||||
ToolPanelDrawer& m_rDrawer;
|
||||
};
|
||||
|
||||
//==================================================================================================================
|
||||
//= ToolPanelDrawer
|
||||
//==================================================================================================================
|
||||
|
@ -48,11 +75,13 @@ namespace svt
|
|||
void SetExpanded( const bool i_bExpanded );
|
||||
bool IsExpanded() const { return m_bExpanded; }
|
||||
|
||||
void Paint();
|
||||
|
||||
protected:
|
||||
// Window overridables
|
||||
virtual void Paint( const Rectangle& i_rBoundingBox );
|
||||
virtual void GetFocus();
|
||||
virtual void LoseFocus();
|
||||
virtual void Resize();
|
||||
virtual void DataChanged( const DataChangedEvent& i_rEvent );
|
||||
virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
|
||||
|
||||
|
@ -73,6 +102,7 @@ namespace svt
|
|||
|
||||
private:
|
||||
::std::auto_ptr< VirtualDevice > m_pPaintDevice;
|
||||
DrawerVisualization m_aVisualization;
|
||||
bool m_bFocused;
|
||||
bool m_bExpanded;
|
||||
};
|
||||
|
|
|
@ -105,11 +105,15 @@ namespace svt
|
|||
return;
|
||||
|
||||
i_rStateSet.AddState( AccessibleStateType::EXPANDABLE );
|
||||
i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
|
||||
|
||||
const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) );
|
||||
ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" );
|
||||
if ( pDrawer->IsExpanded() )
|
||||
i_rStateSet.AddState( AccessibleStateType::EXPANDED );
|
||||
|
||||
if ( pDrawer->HasChildPathFocus() )
|
||||
i_rStateSet.AddState( AccessibleStateType::FOCUSED );
|
||||
}
|
||||
|
||||
//==================================================================================================================
|
||||
|
|
Loading…
Reference in a new issue