diff options
author | Kohei Yoshida <kohei@openoffice.org> | 2009-08-26 02:47:23 +0000 |
---|---|---|
committer | Kohei Yoshida <kohei@openoffice.org> | 2009-08-26 02:47:23 +0000 |
commit | 443f0efd5acca6afe87f75d9f9f75844596622ac (patch) | |
tree | 1b7a0d14904a9e6edcfd90dae096f823400bc9f8 /sc/source/ui/cctrl | |
parent | 4848dbac7b540e2a0d64521e19765a261f7e7305 (diff) |
clear selected menu item when the popup ends.
Diffstat (limited to 'sc/source/ui/cctrl')
-rw-r--r-- | sc/source/ui/cctrl/dpcontrol.cxx | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index e17ff0cd1dab..8b4c1ba6812e 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -303,6 +303,7 @@ ScMenuFloatingWindow::ScMenuFloatingWindow(Window* pParent, ScDocument* pDoc, US SetFont(maLabelFont); SetText(OUString::createFromAscii("ScMenuFloatingWindow")); + SetPopupModeEndHdl( LINK(this, ScMenuFloatingWindow, PopupEndHdl) ); } ScMenuFloatingWindow::~ScMenuFloatingWindow() @@ -537,6 +538,8 @@ void ScMenuFloatingWindow::setSelectedMenuItem(size_t nPos, bool bSubMenuTimer, selectMenuItem(mnSelectedMenu, false, bSubMenuTimer); selectMenuItem(nPos, true, bSubMenuTimer); mnSelectedMenu = nPos; + + fireMenuHighlightedEvent(); } size_t ScMenuFloatingWindow::getSelectedMenuItem() const @@ -708,26 +711,6 @@ void ScMenuFloatingWindow::selectMenuItem(size_t nPos, bool bSelected, bool bSub else queueCloseSubMenu(); } - - if (mxAccessible.is()) - { - // Fire a menu highlight event since the accessibility framework - // needs this to track focus on menu items. - do - { - Reference<XAccessibleContext> xAccCxt = mxAccessible->getAccessibleContext(); - if (!xAccCxt.is()) - break; - - Reference<XAccessible> xAccMenu = xAccCxt->getAccessibleChild(nPos); - if (!xAccMenu.is()) - break; - - VclAccessibleEvent aEvent(VCLEVENT_MENU_HIGHLIGHT, xAccMenu); - FireVclEvent(&aEvent); - } - while (false); - } } } @@ -883,6 +866,26 @@ size_t ScMenuFloatingWindow::getSubMenuPos(ScMenuFloatingWindow* pSubMenu) return MENU_NOT_SELECTED; } +void ScMenuFloatingWindow::fireMenuHighlightedEvent() +{ + if (mnSelectedMenu == MENU_NOT_SELECTED) + return; + + if (!mxAccessible.is()) + return; + + Reference<XAccessibleContext> xAccCxt = mxAccessible->getAccessibleContext(); + if (!xAccCxt.is()) + return; + + Reference<XAccessible> xAccMenu = xAccCxt->getAccessibleChild(mnSelectedMenu); + if (!xAccMenu.is()) + return; + + VclAccessibleEvent aEvent(VCLEVENT_MENU_HIGHLIGHT, xAccMenu); + FireVclEvent(&aEvent); +} + void ScMenuFloatingWindow::setSubMenuFocused(ScMenuFloatingWindow* pSubMenu) { maCloseTimer.reset(); @@ -941,6 +944,12 @@ void ScMenuFloatingWindow::terminateAllPopupMenus() mpParentMenu->terminateAllPopupMenus(); } +IMPL_LINK( ScMenuFloatingWindow, PopupEndHdl, void*, EMPTYARG ) +{ + clearSelectedMenuItem(); + return 0; +} + // ============================================================================ ScDPFieldPopupWindow::Member::Member() : |