summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-16 08:47:04 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-03-16 08:47:04 +0100
commit1412426cc9cf5234c3b60cc2f46153df624f2b15 (patch)
tree53a4bec3ed0172d006dd68db8feabf8704fff21a /svtools/source
parent7e0b098047b0b0a4a73301310d92e85fb235ecd9 (diff)
slidecopy: KeyInput: call the base class only when not having handled the key input myself. Otherwise, it will be tempted to send a Notify event, which in turn might lead to our focus being lost, which will corrupt our internal state
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/toolpanel/paneltabbar.cxx33
1 files changed, 32 insertions, 1 deletions
diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
index fdc5f3f23ee3..694e04765353 100644
--- a/svtools/source/toolpanel/paneltabbar.cxx
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -1136,9 +1136,37 @@ namespace svt
}
//------------------------------------------------------------------------------------------------------------------
+ class KeyInputHandler
+ {
+ public:
+ KeyInputHandler( Control& i_rControl, const KeyEvent& i_rKeyEvent )
+ :m_rControl( i_rControl )
+ ,m_rKeyEvent( i_rKeyEvent )
+ ,m_bHandled( false )
+ {
+ }
+
+ ~KeyInputHandler()
+ {
+ if ( !m_bHandled )
+ m_rControl.Control::KeyInput( m_rKeyEvent );
+ }
+
+ void setHandled()
+ {
+ m_bHandled = true;
+ }
+
+ private:
+ Control& m_rControl;
+ const KeyEvent& m_rKeyEvent;
+ bool m_bHandled;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
void PanelTabBar::KeyInput( const KeyEvent& i_rKeyEvent )
{
- Control::KeyInput( i_rKeyEvent );
+ KeyInputHandler aKeyInputHandler( *this, i_rKeyEvent );
const KeyCode& rKeyCode( i_rKeyEvent.GetKeyCode() );
if ( rKeyCode.GetModifier() != 0 )
@@ -1191,6 +1219,9 @@ namespace svt
m_pImpl->m_aFocusedItem.reset( ( *m_pImpl->m_aFocusedItem + nPanelCount - 1 ) % nPanelCount );
}
m_pImpl->InvalidateItem( *m_pImpl->m_aFocusedItem );
+
+ // don't delegate to base class
+ aKeyInputHandler.setHandled();
}
//------------------------------------------------------------------------------------------------------------------