summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/backingwindow.cxx
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-01-29 21:07:42 +0100
committerJan Holesovsky <kendy@collabora.com>2014-01-31 12:06:46 +0000
commit5b1e68bd852cac4534c5ce2e548187dce1d4561a (patch)
tree2f03db39ff8ed9807d27d8330708ff3271e0d1aa /sfx2/source/dialog/backingwindow.cxx
parent82300f367dda20e3e83477dae9dd37124ac9831b (diff)
fdo#71763: F6 key moves focus on this trip: Menu -> Sidebar -> Thumbnail view
Sidebar and thumbnail View are actually not separate windows but F6 key traversal should simulate it as they would be. Define a new getfocus flag called GETFOCUS_F6 which means focus were grabed as a result of pressing F6 key. Use this and other two (GETFOCUS_FORWARD, GETFOCUS_BACKWARD) flags to indicate the focus were grabbed along subwindow relation (define a new ImplGrabFocusToDocument method with a flag parameter on the analogy of GrabFocus() <-> ImplGrabFocus()). Handle F6, Shift+F6 inside BackingWindow as it would have two subwindow (sidebar and thumbnail view). Plus Ctrl+F6 -> grab focus to the thumbnail view. Change-Id: Ie43d761e7cb0269afb79481a81947a4b96e1dde0 Reviewed-on: https://gerrit.libreoffice.org/7486 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sfx2/source/dialog/backingwindow.cxx')
-rw-r--r--sfx2/source/dialog/backingwindow.cxx55
1 files changed, 54 insertions, 1 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index daa3d10964fa..70605d8db738 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -308,6 +308,41 @@ void BackingWindow::Paint( const Rectangle& )
aDev );
}
+bool BackingWindow::PreNotify( NotifyEvent& rNEvt )
+{
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pEvt = rNEvt.GetKeyEvent();
+ const KeyCode& rKeyCode(pEvt->GetKeyCode());
+ // Subwindows of BackingWindow: Sidebar and Thumbnail view
+ if( rKeyCode.GetCode() == KEY_F6 )
+ {
+ if( rKeyCode.IsShift() ) // Shift + F6
+ {
+ if( mpAllRecentThumbnails->HasFocus() )
+ {
+ mpOpenButton->GrabFocus();
+ return true;
+ }
+ }
+ else if ( rKeyCode.IsMod1() ) // Ctrl + F6
+ {
+ mpAllRecentThumbnails->GrabFocus();
+ return true;
+ }
+ else // F6
+ {
+ if( mpAllButtonsBox->HasChildPathFocus() )
+ {
+ mpAllRecentThumbnails->GrabFocus();
+ return true;
+ }
+ }
+ }
+ }
+ return Window::PreNotify( rNEvt );
+}
+
bool BackingWindow::Notify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == EVENT_KEYINPUT )
@@ -318,7 +353,6 @@ bool BackingWindow::Notify( NotifyEvent& rNEvt )
mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper();
mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame);
}
-
const KeyEvent* pEvt = rNEvt.GetKeyEvent();
const KeyCode& rKeyCode(pEvt->GetKeyCode());
if( pEvt && mpAccExec->execute(rKeyCode) )
@@ -328,6 +362,25 @@ bool BackingWindow::Notify( NotifyEvent& rNEvt )
return Window::Notify( rNEvt );
}
+void BackingWindow::GetFocus()
+{
+ sal_uInt16 nFlags = GetParent()->GetGetFocusFlags();
+ if( nFlags & GETFOCUS_F6 )
+ {
+ if( nFlags & GETFOCUS_FORWARD ) // F6
+ {
+ mpOpenButton->GrabFocus();
+ return;
+ }
+ else // Shift + F6 or Ctrl + F6
+ {
+ mpAllRecentThumbnails->GrabFocus();
+ return;
+ }
+ }
+ Window::GetFocus();
+}
+
void BackingWindow::setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame )
{
mxFrame = xFrame;