summaryrefslogtreecommitdiff
path: root/sc/source/ui/cctrl
diff options
context:
space:
mode:
authorKohei Yoshida <kohei@openoffice.org>2009-08-26 19:07:14 +0000
committerKohei Yoshida <kohei@openoffice.org>2009-08-26 19:07:14 +0000
commit5e8d3e43d3e4689d91d2f94d826146c076f907e6 (patch)
treedafbcb76885f44f5c6b50fbcaa800b696ae9f275 /sc/source/ui/cctrl
parentb0838ee5af5000192b5784ca1da504be1db0b7cf (diff)
TAB key to cycle through controls.
Diffstat (limited to 'sc/source/ui/cctrl')
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx57
1 files changed, 57 insertions, 0 deletions
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 7423ea4278fb..4c9dee6b4af1 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -985,11 +985,21 @@ ScDPFieldPopupWindow::ScDPFieldPopupWindow(Window* pParent, ScDocument* pDoc) :
maBtnUnselectSingle(this, 0),
maBtnOk(this),
maBtnCancel(this),
+ mnCurTabStop(0),
mpExtendedData(NULL),
mpOKAction(NULL),
maWndSize(160, 330),
mePrevToggleAllState(STATE_DONTKNOW)
{
+ maTabStopCtrls.reserve(7);
+ maTabStopCtrls.push_back(this);
+ maTabStopCtrls.push_back(&maChecks);
+ maTabStopCtrls.push_back(&maChkToggleAll);
+ maTabStopCtrls.push_back(&maBtnSelectSingle);
+ maTabStopCtrls.push_back(&maBtnUnselectSingle);
+ maTabStopCtrls.push_back(&maBtnOk);
+ maTabStopCtrls.push_back(&maBtnCancel);
+
const StyleSettings& rStyle = GetSettings().GetStyleSettings();
Point aPos;
@@ -1157,6 +1167,28 @@ void ScDPFieldPopupWindow::selectCurrentMemberOnly(bool bSet)
maChecks.CheckEntryPos(nSelected, bSet);
}
+void ScDPFieldPopupWindow::cycleFocus(bool bReverse)
+{
+ maTabStopCtrls[mnCurTabStop]->LoseFocus();
+ if (mnCurTabStop == 0)
+ clearSelectedMenuItem();
+
+ if (bReverse)
+ {
+ if (mnCurTabStop > 0)
+ --mnCurTabStop;
+ else
+ mnCurTabStop = maTabStopCtrls.size() - 1;
+ }
+ else
+ {
+ ++mnCurTabStop;
+ if (mnCurTabStop >= maTabStopCtrls.size())
+ mnCurTabStop = 0;
+ }
+ maTabStopCtrls[mnCurTabStop]->GetFocus();
+}
+
IMPL_LINK( ScDPFieldPopupWindow, ButtonHdl, Button*, pBtn )
{
if (pBtn == &maBtnOk)
@@ -1225,6 +1257,26 @@ void ScDPFieldPopupWindow::MouseMove(const MouseEvent& rMEvt)
queueCloseSubMenu();
}
+long ScDPFieldPopupWindow::Notify(NotifyEvent& rNEvt)
+{
+ switch (rNEvt.GetType())
+ {
+ case EVENT_KEYUP:
+ {
+ const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
+ const KeyCode& rCode = pKeyEvent->GetKeyCode();
+ bool bShift = rCode.IsShift();
+ if (rCode.GetCode() == KEY_TAB)
+ {
+ cycleFocus(bShift);
+ return true;
+ }
+ }
+ break;
+ }
+ return ScMenuFloatingWindow::Notify(rNEvt);
+}
+
void ScDPFieldPopupWindow::Paint(const Rectangle& rRect)
{
ScMenuFloatingWindow::Paint(rRect);
@@ -1248,6 +1300,11 @@ void ScDPFieldPopupWindow::Paint(const Rectangle& rRect)
DrawRect(Rectangle(aPos,aSize));
}
+Window* ScDPFieldPopupWindow::GetPreferredKeyInputWindow()
+{
+ return maTabStopCtrls[mnCurTabStop];
+}
+
Reference<XAccessible> ScDPFieldPopupWindow::CreateAccessible()
{
if (!mxAccessible.is())