menu.cxx (77438bbc) menu.cxx (ad3a95a3)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 1559 unchanged lines hidden (view full) ---

1568 else
1569 return MENUITEM_DONTKNOW;
1570}
1571
1572sal_uInt16 Menu::GetCurItemId() const
1573{
1574 return nSelectedId;
1575}
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 1559 unchanged lines hidden (view full) ---

1568 else
1569 return MENUITEM_DONTKNOW;
1570}
1571
1572sal_uInt16 Menu::GetCurItemId() const
1573{
1574 return nSelectedId;
1575}
1576//IAccessibility2 Implementation 2009
1577void Menu::SetHightlightItem( sal_uInt16 nHighlightedItem )
1578{
1579 this->nHighlightedItem = nHighlightedItem;
1580}
1581sal_uInt16 Menu::GetHighlightItem() const
1582{
1583 return nHighlightedItem;
1584}
1576
1585
1586
1587XubString Menu::GetItemAccKeyStrFromPos(sal_uInt16 nPos) const
1588{
1589 MenuItemData* pData = pItemList->GetDataFromPos( nPos );
1590 if (pData)
1591 {
1592 return pData->aAccelKey.GetName();
1593 }
1594 return XubString();
1595}
1596
1597sal_Bool Menu::IsTemporaryItemFromPos(sal_uInt16 nPos ) const
1598{
1599 MenuItemData* pData = pItemList->GetDataFromPos( nPos );
1600 if (pData)
1601 {
1602 return pData->bIsTemporary;
1603 }
1604 return sal_False;
1605}
1606
1577void Menu::SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits )
1578{
1579 MenuItemData* pData = pItemList->GetData( nItemId );
1580 if ( pData )
1581 pData->nBits = nBits;
1582}
1583
1584MenuItemBits Menu::GetItemBits( sal_uInt16 nItemId ) const

--- 2138 unchanged lines hidden (view full) ---

3723 if ( !nVisibleEntries )
3724 {
3725 ResMgr* pResMgr = ImplGetResMgr();
3726 if( pResMgr )
3727 {
3728 String aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) );
3729 MenuItemData* pData = pItemList->Insert(
3730 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF );
1607void Menu::SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits )
1608{
1609 MenuItemData* pData = pItemList->GetData( nItemId );
1610 if ( pData )
1611 pData->nBits = nBits;
1612}
1613
1614MenuItemBits Menu::GetItemBits( sal_uInt16 nItemId ) const

--- 2138 unchanged lines hidden (view full) ---

3753 if ( !nVisibleEntries )
3754 {
3755 ResMgr* pResMgr = ImplGetResMgr();
3756 if( pResMgr )
3757 {
3758 String aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) );
3759 MenuItemData* pData = pItemList->Insert(
3760 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF );
3761//IAccessibility2 Implementation 2009-----
3762 sal_uInt16 nmPos;
3763 pData = pItemList->GetData( pData->nId, nmPos );
3731 pData->bIsTemporary = sal_True;
3764 pData->bIsTemporary = sal_True;
3765 ImplCallEventListeners(VCLEVENT_MENU_SUBMENUCHANGED,nmPos);
3766//-----IAccessibility2 Implementation 2009
3732 }
3733 }
3734 else if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( nMenuFlags & MENU_FLAG_NOAUTOMNEMONICS ) )
3735 {
3736 CreateAutoMnemonics();
3737 }
3738
3739 MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle | WB_SYSTEMWINDOW );

--- 260 unchanged lines hidden (view full) ---

4000void MenuFloatingWindow::doShutdown()
4001{
4002 if( pMenu )
4003 {
4004 // #105373# notify toolkit that highlight was removed
4005 // otherwise the entry will not be read when the menu is opened again
4006 if( nHighlightedItem != ITEMPOS_INVALID )
4007 pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
3767 }
3768 }
3769 else if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( nMenuFlags & MENU_FLAG_NOAUTOMNEMONICS ) )
3770 {
3771 CreateAutoMnemonics();
3772 }
3773
3774 MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle | WB_SYSTEMWINDOW );

--- 260 unchanged lines hidden (view full) ---

4035void MenuFloatingWindow::doShutdown()
4036{
4037 if( pMenu )
4038 {
4039 // #105373# notify toolkit that highlight was removed
4040 // otherwise the entry will not be read when the menu is opened again
4041 if( nHighlightedItem != ITEMPOS_INVALID )
4042 pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
4008
4043//IAccessibility2 Implementation 2009-----
4044 pMenu->SetHightlightItem(ITEMPOS_INVALID);
4045//-----IAccessibility2 Implementation 2009
4009 if( !bKeyInput && pMenu && pMenu->pStartedFrom && !pMenu->pStartedFrom->bIsMenuBar )
4010 {
4011 // #102461# remove highlight in parent
4012 MenuItemData* pData;
4013 sal_uInt16 i, nCount = (sal_uInt16)pMenu->pStartedFrom->pItemList->Count();
4014 for(i = 0; i < nCount; i++)
4015 {
4016 pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i );

--- 654 unchanged lines hidden (view full) ---

4671 if( pPWin && pPWin->nHighlightedItem != i )
4672 {
4673 pPWin->HighlightItem( i, sal_True );
4674 pPWin->nHighlightedItem = i;
4675 }
4676 }
4677 }
4678 HighlightItem( nHighlightedItem, sal_True );
4046 if( !bKeyInput && pMenu && pMenu->pStartedFrom && !pMenu->pStartedFrom->bIsMenuBar )
4047 {
4048 // #102461# remove highlight in parent
4049 MenuItemData* pData;
4050 sal_uInt16 i, nCount = (sal_uInt16)pMenu->pStartedFrom->pItemList->Count();
4051 for(i = 0; i < nCount; i++)
4052 {
4053 pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i );

--- 654 unchanged lines hidden (view full) ---

4708 if( pPWin && pPWin->nHighlightedItem != i )
4709 {
4710 pPWin->HighlightItem( i, sal_True );
4711 pPWin->nHighlightedItem = i;
4712 }
4713 }
4714 }
4715 HighlightItem( nHighlightedItem, sal_True );
4716//IAccessibility2 Implementation 2009-----
4717 pMenu->SetHightlightItem(nHighlightedItem);
4718//-----IAccessibility2 Implementation 2009
4679 pMenu->ImplCallHighlight( nHighlightedItem );
4680 }
4681 else
4682 pMenu->nSelectedId = 0;
4683
4684 if ( bStartPopupTimer )
4685 {
4686 // #102438# Menu items are not selectable

--- 285 unchanged lines hidden (view full) ---

4972 // Forward...
4973 ((MenuBarWindow*)((MenuBar*)pMenu->pStartedFrom)->ImplGetWindow())->KeyInput( rKEvent );
4974 }
4975 else
4976 {
4977 MenuFloatingWindow* pFloat = ((PopupMenu*)pMenu->pStartedFrom)->ImplGetFloatingWindow();
4978 pFloat->GrabFocus();
4979 pFloat->KillActivePopup();
4719 pMenu->ImplCallHighlight( nHighlightedItem );
4720 }
4721 else
4722 pMenu->nSelectedId = 0;
4723
4724 if ( bStartPopupTimer )
4725 {
4726 // #102438# Menu items are not selectable

--- 285 unchanged lines hidden (view full) ---

5012 // Forward...
5013 ((MenuBarWindow*)((MenuBar*)pMenu->pStartedFrom)->ImplGetWindow())->KeyInput( rKEvent );
5014 }
5015 else
5016 {
5017 MenuFloatingWindow* pFloat = ((PopupMenu*)pMenu->pStartedFrom)->ImplGetFloatingWindow();
5018 pFloat->GrabFocus();
5019 pFloat->KillActivePopup();
5020//IAccessibility2 Implementation 2009-----
5021 sal_uInt16 highlightItem = pFloat->GetHighlightedItem();
5022 pFloat->ChangeHighlightItem(highlightItem, sal_False);
5023//-----IAccessibility2 Implementation 2009
4980 }
4981 }
4982 }
4983 break;
4984 case KEY_RIGHT:
4985 {
4986 if( pMenu )
4987 {

--- 573 unchanged lines hidden (view full) ---

5561 {
5562 HighlightItem( nHighlightedItem, sal_False );
5563 pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
5564 }
5565
5566 nHighlightedItem = (sal_uInt16)n;
5567 DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
5568 HighlightItem( nHighlightedItem, sal_True );
5024 }
5025 }
5026 }
5027 break;
5028 case KEY_RIGHT:
5029 {
5030 if( pMenu )
5031 {

--- 573 unchanged lines hidden (view full) ---

5605 {
5606 HighlightItem( nHighlightedItem, sal_False );
5607 pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
5608 }
5609
5610 nHighlightedItem = (sal_uInt16)n;
5611 DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
5612 HighlightItem( nHighlightedItem, sal_True );
5613//IAccessibility2 Implementation 2009-----
5614 pMenu->SetHightlightItem(nHighlightedItem);
5615//-----IAccessibility2 Implementation 2009
5569 pMenu->ImplCallHighlight( nHighlightedItem );
5570
5571 if( mbAutoPopup )
5572 ImplCreatePopup( bSelectEntry );
5573
5574 // #58935# #73659# Focus, wenn kein Popup drunter haengt...
5575 if ( bJustActivated && !pActivePopup )
5576 GrabFocus();

--- 583 unchanged lines hidden ---
5616 pMenu->ImplCallHighlight( nHighlightedItem );
5617
5618 if( mbAutoPopup )
5619 ImplCreatePopup( bSelectEntry );
5620
5621 // #58935# #73659# Focus, wenn kein Popup drunter haengt...
5622 if ( bJustActivated && !pActivePopup )
5623 GrabFocus();

--- 583 unchanged lines hidden ---