[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Dec 31 07:04:03 UTC 2018
include/sfx2/notebookbar/NotebookbarTabControl.hxx | 4
include/vcl/tabctrl.hxx | 1
sfx2/source/notebookbar/NotebookbarTabControl.cxx | 92 +++++++++++++++++++++
3 files changed, 97 insertions(+)
New commits:
commit cb834ae5c8d5dbecdbc3729bc21889d97d8b582f
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Thu Nov 22 23:31:37 2018 -0900
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Mon Dec 31 08:03:41 2018 +0100
Provide keyboard navigation to Shortcuts tool box and Hamburger menu in
NotebookbarTabControl
Use Ctrl+Right/Left arrow to move focus among current notebookbar tab
control tab title, hamburger menu, and shortcuts tool box.
Change-Id: Ia7b22ff03fce7148eb411cfe9eaabc247b737cb5
Reviewed-on: https://gerrit.libreoffice.org/63875
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj at gmail.com>
diff --git a/include/sfx2/notebookbar/NotebookbarTabControl.hxx b/include/sfx2/notebookbar/NotebookbarTabControl.hxx
index 2ff4d3c48974..f3411d769b71 100644
--- a/include/sfx2/notebookbar/NotebookbarTabControl.hxx
+++ b/include/sfx2/notebookbar/NotebookbarTabControl.hxx
@@ -27,6 +27,8 @@ public:
NotebookbarTabControl( Window* pParent );
~NotebookbarTabControl() override;
+ virtual void KeyInput( const KeyEvent& rKEvt ) override;
+ virtual bool EventNotify( NotifyEvent& rNEvt ) override;
virtual void StateChanged(StateChangedType nStateChange) override;
virtual Size calculateRequisition() const override;
@@ -36,6 +38,8 @@ private:
const OUString& aModuleName,
ToolBox* pShortcuts
);
+ void ArrowStops( sal_uInt16 nCode );
+
DECL_LINK(OpenNotebookbarPopupMenu, NotebookBar*, void);
css::uno::Reference<css::ui::XUIConfigurationListener> m_pListener;
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 332f92abb4e9..cf64e66efc64 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -201,6 +201,7 @@ public:
void SetIconClickHdl( Link<NotebookBar*, void> aHdl );
void SetToolBox( ToolBox* pToolBox );
ToolBox* GetToolBox() { return m_pShortcuts; }
+ PushButton* GetOpenMenu() { return m_pOpenMenu; }
virtual sal_uInt16 GetPageId( const Point& rPos ) const override;
virtual void SelectTabPage( sal_uInt16 nPageId ) override;
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index 994dbf7d3a3f..2e5f18af3150 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -126,6 +126,20 @@ public:
mbUseDefaultButtonSize = false;
SetToolboxButtonSize(ToolBoxButtonSize::Small);
}
+
+ virtual void KeyInput( const KeyEvent& rKEvt ) override
+ {
+ if ( rKEvt.GetKeyCode().IsMod1() )
+ {
+ sal_uInt16 nCode( rKEvt.GetKeyCode().GetCode() );
+ if ( nCode == KEY_RIGHT || nCode == KEY_LEFT )
+ {
+ GetParent()->KeyInput( rKEvt );
+ return;
+ }
+ }
+ return sfx2::sidebar::SidebarToolBox::KeyInput( rKEvt );
+ }
};
NotebookbarTabControl::NotebookbarTabControl( Window* pParent )
@@ -139,6 +153,84 @@ NotebookbarTabControl::~NotebookbarTabControl()
{
}
+void NotebookbarTabControl::ArrowStops( sal_uInt16 nCode )
+{
+ ToolBox* pToolBox( GetToolBox() );
+ PushButton* pOpenMenu( GetOpenMenu() );
+
+ if ( nCode == KEY_LEFT )
+ {
+ if ( HasFocus() )
+ {
+ if ( pToolBox )
+ pToolBox->GrabFocus();
+ else if ( pOpenMenu )
+ pOpenMenu->GrabFocus();
+ }
+ else if ( pToolBox && pToolBox->HasFocus() )
+ {
+ if ( pOpenMenu )
+ pOpenMenu->GrabFocus();
+ else
+ GrabFocus();
+ }
+ else if ( pOpenMenu && pOpenMenu->HasFocus() )
+ {
+ GrabFocus();
+ }
+ }
+ else if ( nCode == KEY_RIGHT )
+ {
+ if ( HasFocus() )
+ {
+ if ( pOpenMenu )
+ pOpenMenu->GrabFocus();
+ else if ( pToolBox )
+ pToolBox->GrabFocus();
+ }
+ else if ( pToolBox && pToolBox->HasFocus() )
+ {
+ GrabFocus();
+ }
+ else if ( pOpenMenu && pOpenMenu->HasFocus() )
+ {
+ if ( pToolBox )
+ pToolBox->GrabFocus();
+ else
+ GrabFocus();
+ }
+ }
+}
+
+void NotebookbarTabControl::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( rKEvt.GetKeyCode().IsMod1() )
+ {
+ sal_uInt16 nCode( rKEvt.GetKeyCode().GetCode() );
+ if ( nCode == KEY_RIGHT || nCode == KEY_LEFT )
+ {
+ ArrowStops( nCode );
+ return;
+ }
+ }
+ return NotebookbarTabControlBase::KeyInput( rKEvt );
+}
+
+bool NotebookbarTabControl::EventNotify( NotifyEvent& rNEvt )
+{
+ if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+ {
+ const vcl::KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode();
+ sal_uInt16 nCode = rKey.GetCode();
+ if ( rKey.IsMod1() && ( nCode == KEY_RIGHT || nCode == KEY_LEFT ) )
+ {
+ ArrowStops( nCode );
+ return true;
+ }
+ }
+ return NotebookbarTabControlBase::EventNotify( rNEvt );
+}
+
void NotebookbarTabControl::StateChanged(StateChangedType nStateChange)
{
if( !m_bInitialized && SfxViewFrame::Current() )
More information about the Libreoffice-commits
mailing list