LibreOffice Module sw (master)  1
actctrl.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <actctrl.hxx>
21 #include <vcl/event.hxx>
22 #include <vcl/toolbox.hxx>
23 
25 {
26  bool bHandled = false;
27 
28  if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
29  {
30  const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
31  const vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
32  const sal_uInt16 aCode = aKeyCode.GetCode();
33  const sal_uInt16 nModifier = aKeyCode.GetModifier();
34  if( aCode == KEY_RETURN &&
35  !nModifier)
36  {
37  aActionLink.Call( *this );
38  bHandled = true;
39  }
40  else
41  {
42  vcl::Window* pParent = GetParent();
43  if ( pParent != nullptr && aCode == KEY_TAB &&
44  pParent->GetType() == WindowType::TOOLBOX )
45  {
46  static_cast<ToolBox*>(pParent)->ChangeHighlightUpDn( aKeyCode.IsShift() );
47  bHandled = true;
48  }
49  }
50  }
51  if(!bHandled)
52  bHandled = NumericField::EventNotify(rNEvt);
53  return bHandled;
54 }
55 
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define KEY_TAB
sal_uInt16 GetCode() const
const KeyEvent * GetKeyEvent() const
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: actctrl.cxx:24
sal_uInt16 GetModifier() const
Link< NumEditAction &, void > aActionLink
Definition: actctrl.hxx:28
virtual bool EventNotify(NotifyEvent &rNEvt) override
MouseNotifyEvent GetType() const
vcl::Window * GetParent() const
#define KEY_RETURN
const vcl::KeyCode & GetKeyCode() const
bool IsShift() const
WindowType GetType() const