summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-17 09:21:56 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-17 09:21:56 +0100
commite966bf219edd4ae4ef91d8af38ebb69c17961960 (patch)
treeea0666dac5d135c0d8bc72a58bb27a5874c6ef43
parentd6cc951ebb78f774700d4653ba12af933167c777 (diff)
slidecopy: keyboard accessibility for the ToolPanelDrawer implementation
-rw-r--r--sd/source/ui/inc/taskpane/TitleBar.hxx4
-rw-r--r--sd/source/ui/inc/taskpane/TitledControl.hxx1
-rw-r--r--sd/source/ui/toolpanel/TitleBar.cxx19
-rw-r--r--sd/source/ui/toolpanel/TitledControl.cxx12
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDeck.cxx2
-rw-r--r--sd/source/ui/toolpanel/ToolPanelDrawer.cxx44
6 files changed, 55 insertions, 27 deletions
diff --git a/sd/source/ui/inc/taskpane/TitleBar.hxx b/sd/source/ui/inc/taskpane/TitleBar.hxx
index 9616a081ff47..7998599b2e11 100644
--- a/sd/source/ui/inc/taskpane/TitleBar.hxx
+++ b/sd/source/ui/inc/taskpane/TitleBar.hxx
@@ -88,8 +88,8 @@ public:
virtual bool Expand (bool bFlag = true);
virtual bool IsExpanded (void) const;
virtual void SetEnabledState(bool bFlag);
-
- void SetFocus (bool bFlag);
+ virtual void GetFocus (void);
+ virtual void LoseFocus (void);
virtual void MouseMove(const MouseEvent& rEvent);
/** Empty implementation prevents forwarding to docking window.
diff --git a/sd/source/ui/inc/taskpane/TitledControl.hxx b/sd/source/ui/inc/taskpane/TitledControl.hxx
index f82bafd3669f..d1d38aa0fd36 100644
--- a/sd/source/ui/inc/taskpane/TitledControl.hxx
+++ b/sd/source/ui/inc/taskpane/TitledControl.hxx
@@ -101,7 +101,6 @@ public:
virtual void Resize (void);
virtual void GetFocus (void);
- virtual void LoseFocus (void);
virtual void KeyInput (const KeyEvent& rEvent);
// void Select (bool bExpansionState);
diff --git a/sd/source/ui/toolpanel/TitleBar.cxx b/sd/source/ui/toolpanel/TitleBar.cxx
index dd408ca0b6d8..e54c98428065 100644
--- a/sd/source/ui/toolpanel/TitleBar.cxx
+++ b/sd/source/ui/toolpanel/TitleBar.cxx
@@ -63,7 +63,7 @@ namespace sd { namespace toolpanel {
const int TitleBar::snIndentationWidth = 16;
TitleBar::TitleBar ( ::Window* pParent, const String& rsTitle, TitleBarType eType, bool bIsExpandable)
-: ::Window (pParent)
+: ::Window (pParent, WB_TABSTOP)
, TreeNode(this)
, meType(eType)
, msTitle(rsTitle)
@@ -219,10 +219,21 @@ void TitleBar::SetEnabledState(bool bFlag)
}
-void TitleBar::SetFocus (bool bFlag)
+
+
+void TitleBar::GetFocus()
{
- mbFocused = bFlag;
- Invalidate ();
+ mbFocused = true;
+ Invalidate();
+}
+
+
+
+
+void TitleBar::LoseFocus()
+{
+ mbFocused = false;
+ Invalidate();
}
diff --git a/sd/source/ui/toolpanel/TitledControl.cxx b/sd/source/ui/toolpanel/TitledControl.cxx
index 06e6e7b2e871..07a6a7f7082c 100644
--- a/sd/source/ui/toolpanel/TitledControl.cxx
+++ b/sd/source/ui/toolpanel/TitledControl.cxx
@@ -222,17 +222,7 @@ void TitledControl::GetFocus (void)
{
::Window::GetFocus();
if (GetTitleBar() != NULL)
- GetTitleBar()->SetFocus (true);
-}
-
-
-
-
-void TitledControl::LoseFocus (void)
-{
- ::Window::LoseFocus();
- if (GetTitleBar() != NULL)
- GetTitleBar()->SetFocus (false);
+ GetTitleBar()->GrabFocus();
}
diff --git a/sd/source/ui/toolpanel/ToolPanelDeck.cxx b/sd/source/ui/toolpanel/ToolPanelDeck.cxx
index b437dffbf1d0..0b93e7178e18 100644
--- a/sd/source/ui/toolpanel/ToolPanelDeck.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelDeck.cxx
@@ -67,7 +67,7 @@ namespace sd { namespace toolpanel
//==================================================================================================================
//------------------------------------------------------------------------------------------------------------------
ToolPanelDeck::ToolPanelDeck( Window& i_rParent, ToolPanelViewShell& i_rViewShell )
- :ToolPanelDeck_Base( i_rParent, 0 )
+ :ToolPanelDeck_Base( i_rParent, WB_DIALOGCONTROL )
,m_rViewShell( i_rViewShell )
{
SetDrawersLayout();
diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx
index b8e8002e215b..3a938d460d5f 100644
--- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx
@@ -113,7 +113,15 @@ namespace sd { namespace toolpanel
//------------------------------------------------------------------------------------------------------------------
void ToolPanelDrawer::SetFocusToPanelSelector()
{
- // TODO
+ const size_t nPanelCount( m_rPanelDeck.GetPanelCount() );
+ if ( !nPanelCount )
+ // nothing to focus
+ return;
+ ::boost::optional< size_t > aActivePanel( m_rPanelDeck.GetActivePanel() );
+ if ( !aActivePanel )
+ aActivePanel = 0;
+ ENSURE_OR_RETURN_VOID( *aActivePanel < m_aDrawers.size(), "ToolPanelDrawer::SetFocusToPanelSelector: invalid active panel, or inconsistent drawers!" );
+ m_aDrawers[ *aActivePanel ]->GetWindow()->GrabFocus();
}
//------------------------------------------------------------------------------------------------------------------
@@ -145,8 +153,6 @@ namespace sd { namespace toolpanel
//------------------------------------------------------------------------------------------------------------------
void ToolPanelDrawer::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
{
- impl_triggerRearrange();
-
if ( !!i_rOldActive )
{
OSL_ENSURE( *i_rOldActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal old index!" );
@@ -158,6 +164,8 @@ namespace sd { namespace toolpanel
OSL_ENSURE( *i_rNewActive < m_aDrawers.size(), "ToolPanelDrawer::ActivePanelChanged: illegal new index!" );
m_aDrawers[ *i_rNewActive ]->Expand( true );
}
+
+ impl_triggerRearrange();
}
//------------------------------------------------------------------------------------------------------------------
@@ -187,18 +195,38 @@ namespace sd { namespace toolpanel
IMPL_LINK( ToolPanelDrawer, OnWindowEvent, VclSimpleEvent*, i_pEvent )
{
const VclWindowEvent* pWindowEvent = PTR_CAST( VclWindowEvent, i_pEvent );
- if ( !pWindowEvent )
- return 0L;
+ ENSURE_OR_RETURN( pWindowEvent, "no WindowEvent", 0L );
+ bool bActivatePanel = false;
switch ( pWindowEvent->GetId() )
{
case VCLEVENT_WINDOW_MOUSEBUTTONUP:
{
- const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() );
- m_rPanelDeck.ActivatePanel( nPanelPos );
- return 1L;
+ const MouseEvent* pMouseEvent = static_cast< const MouseEvent* >( pWindowEvent->GetData() );
+ ENSURE_OR_RETURN( pMouseEvent, "no mouse event with MouseButtonUp", 0L );
+ if ( pMouseEvent->GetButtons() == MOUSE_LEFT )
+ {
+ bActivatePanel = true;
+ }
}
break;
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = static_cast< const KeyEvent* >( pWindowEvent->GetData() );
+ ENSURE_OR_RETURN( pKeyEvent, "no key event with KeyInput", 0L );
+ const KeyCode& rKeyCode( pKeyEvent->GetKeyCode() );
+ if ( ( rKeyCode.GetModifier() == 0 ) && ( rKeyCode.GetCode() == KEY_RETURN ) )
+ {
+ bActivatePanel = true;
+ }
+ }
+ break;
+ }
+ if ( bActivatePanel )
+ {
+ const size_t nPanelPos = impl_getPanelPositionFromWindow( pWindowEvent->GetWindow() );
+ m_rPanelDeck.ActivatePanel( nPanelPos );
+ return 1L;
}
return 0L;
}