summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-07-18 11:01:52 +0200
committerJan Holesovsky <kendy@suse.cz>2013-07-18 11:25:52 +0200
commit8e5e98b609a9dd61f5d8dfa3498f98b8d9b1fb08 (patch)
tree37136ee75b3564f909e7253c1ee1600ae50ce3c5 /framework
parentd05bf07eb7535ae6459567567ae48b1f58918ff6 (diff)
startcenter: Re-introduce code that handles accelerators.
Change-Id: I171de7f63e644c9446a76f6ade592c8242cadcac
Diffstat (limited to 'framework')
-rw-r--r--framework/source/services/backingwindow.cxx83
-rw-r--r--framework/source/services/backingwindow.hxx4
2 files changed, 84 insertions, 3 deletions
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index 76b23ea5c71c..950c1adde8cb 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -77,7 +77,8 @@ const int nLogoHeight = 150;
BackingWindow::BackingWindow( Window* i_pParent ) :
Window( i_pParent ),
mbInitControls( false ),
- mnHideExternalLinks( 0 )
+ mnHideExternalLinks( 0 ),
+ mpAccExec( NULL )
{
m_pUIBuilder = new VclBuilder(this, getUIRootDir(),
"modules/StartModule/ui/startcenter.ui",
@@ -412,6 +413,86 @@ void BackingWindow::Paint( const Rectangle& )
long BackingWindow::Notify( NotifyEvent& rNEvt )
{
+ if( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ // try the 'normal' accelerators (so that eg. Ctrl+Q works)
+ if( !mpAccExec )
+ {
+ mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper();
+ mpAccExec->init( comphelper::getProcessComponentContext(), mxFrame);
+ }
+
+ const KeyEvent* pEvt = rNEvt.GetKeyEvent();
+ const KeyCode& rKeyCode(pEvt->GetKeyCode());
+ if( pEvt && mpAccExec->execute(rKeyCode) )
+ return 1;
+
+ // #i110344# extrawurst: specialized arrow key control
+ if( rKeyCode.GetModifier() == 0 )
+ {
+ if( rKeyCode.GetCode() == KEY_RIGHT )
+ {
+ if( mpWriterButton->HasFocus() )
+ mpDrawButton->GrabFocus();
+ else if( mpCalcButton->HasFocus() )
+ mpDBButton->GrabFocus();
+ else if( mpImpressButton->HasFocus() )
+ mpMathButton->GrabFocus();
+ else if( mpOpenButton->HasFocus() )
+ mpTemplateButton->GrabFocus();
+ return 1;
+ }
+ else if( rKeyCode.GetCode() == KEY_LEFT )
+ {
+ if( mpDrawButton->HasFocus() )
+ mpWriterButton->GrabFocus();
+ else if( mpDBButton->HasFocus() )
+ mpCalcButton->GrabFocus();
+ else if( mpMathButton->HasFocus() )
+ mpImpressButton->GrabFocus();
+ else if( mpTemplateButton->HasFocus() )
+ mpOpenButton->GrabFocus();
+ return 1;
+ }
+ else if( rKeyCode.GetCode() == KEY_UP )
+ {
+ // first column
+ if( mpOpenButton->HasFocus() )
+ mpImpressButton->GrabFocus();
+ else if( mpImpressButton->HasFocus() )
+ mpCalcButton->GrabFocus();
+ else if( mpCalcButton->HasFocus() )
+ mpWriterButton->GrabFocus();
+ // second column
+ else if( mpTemplateButton->HasFocus() )
+ mpMathButton->GrabFocus();
+ else if( mpMathButton->HasFocus() )
+ mpDBButton->GrabFocus();
+ else if( mpDBButton->HasFocus() )
+ mpDrawButton->GrabFocus();
+ return 1;
+ }
+ else if( rKeyCode.GetCode() == KEY_DOWN )
+ {
+ // first column
+ if( mpWriterButton->HasFocus() )
+ mpCalcButton->GrabFocus();
+ else if( mpCalcButton->HasFocus() )
+ mpImpressButton->GrabFocus();
+ else if( mpImpressButton->HasFocus() )
+ mpOpenButton->GrabFocus();
+ // second column
+ else if( mpDrawButton->HasFocus() )
+ mpDBButton->GrabFocus();
+ else if( mpDBButton->HasFocus() )
+ mpMathButton->GrabFocus();
+ else if( mpMathButton->HasFocus() )
+ mpTemplateButton->GrabFocus();
+ return 1;
+ }
+ }
+ }
+
return Window::Notify( rNEvt );
}
diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx
index 03f6af1f2477..99b005a47e5c 100644
--- a/framework/source/services/backingwindow.hxx
+++ b/framework/source/services/backingwindow.hxx
@@ -29,6 +29,7 @@
#include <vcl/toolbox.hxx>
#include <vcl/layout.hxx>
+#include <svtools/acceleratorexecute.hxx>
#include <unotools/moduleoptions.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -86,12 +87,11 @@ namespace framework
bool mbInitControls;
sal_Int32 mnHideExternalLinks;
+ svt::AcceleratorExecute* mpAccExec;
int mnSCWidth;
int mnSCHeight;
- void loadImage( const ResId& i_rId, PushButton& i_rButton );
-
void setupButton( PushButton* pButton, const OUString& rURL, const std::set<OUString>& rURLS,
SvtModuleOptions& rOpt, SvtModuleOptions::EModule eMod );