diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-10 12:08:45 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-03-10 12:13:16 -0400 |
commit | ed6b8c9f8d1b932300ce16d6188d10036827f676 (patch) | |
tree | 8403ccbfa84d1b54c1a116f5a50bafa8d3d5c447 /sc | |
parent | 7a9d4cd51ee9b1ce6cdf076caeeed6d2ae07fb92 (diff) |
Select the whole text when the named range box gets focus.
Not doing this had been bugging me for a long time since I use
Shift-Ctrl-F5 to define named ranges a lot. Small usability improvement.
Change-Id: Ib1a4e4e26e15667598a603443dde05e08fdbe3b7
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 70 |
1 files changed, 41 insertions, 29 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 7bda59d42ae4..544a7f1681c8 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2484,43 +2484,55 @@ void ScPosWnd::DoEnter() bool ScPosWnd::Notify( NotifyEvent& rNEvt ) { - bool nHandled = false; + bool bHandled = true; - if ( rNEvt.GetType() == EVENT_KEYINPUT ) + switch (rNEvt.GetType()) { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - - switch ( pKEvt->GetKeyCode().GetCode() ) + case EVENT_KEYINPUT: { - case KEY_RETURN: - DoEnter(); - nHandled = true; - break; + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - case KEY_ESCAPE: - if (nTipVisible) - { - // escape when the tip help is shown: only hide the tip - HideTip(); - } - else - { - if (!bFormulaMode) - SetText( aPosStr ); - ReleaseFocus_Impl(); - } - nHandled = true; - break; + switch ( pKEvt->GetKeyCode().GetCode() ) + { + case KEY_RETURN: + DoEnter(); + break; + + case KEY_ESCAPE: + if (nTipVisible) + { + // escape when the tip help is shown: only hide the tip + HideTip(); + } + else + { + if (!bFormulaMode) + SetText( aPosStr ); + ReleaseFocus_Impl(); + } + break; + } } + break; + case EVENT_GETFOCUS: + { + // Select the whole text upon focus. + OUString aStr = GetText(); + SetSelection(Selection(0, aStr.getLength())); + } + break; + case EVENT_LOSEFOCUS: + HideTip(); + bHandled = false; + break; + default: + bHandled = false; } - if ( !nHandled ) - nHandled = ComboBox::Notify( rNEvt ); - - if ( rNEvt.GetType() == EVENT_LOSEFOCUS ) - HideTip(); + if (!bHandled) + bHandled = ComboBox::Notify(rNEvt); - return nHandled; + return bHandled; } void ScPosWnd::ReleaseFocus_Impl() |