diff options
-rw-r--r-- | dbaccess/source/ui/browser/sbagrid.cxx | 18 | ||||
-rw-r--r-- | dbaccess/source/ui/control/dbtreelistbox.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 6 | ||||
-rw-r--r-- | framework/source/fwe/classes/addonmenu.cxx | 10 | ||||
-rw-r--r-- | framework/source/uielement/controlmenucontroller.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/headermenucontroller.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/menubarmerger.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 3 | ||||
-rw-r--r-- | svtools/source/control/stdmenu.cxx | 2 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 3 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 3 | ||||
-rw-r--r-- | svx/source/mnuctrls/SmartTagCtl.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/lingu/olmenu.cxx | 22 | ||||
-rw-r--r-- | sw/source/ui/smartmenu/stmenu.cxx | 8 | ||||
-rw-r--r-- | toolkit/source/awt/vclxmenu.cxx | 4 | ||||
-rw-r--r-- | vcl/inc/vcl/menu.hxx | 9 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 74 |
19 files changed, 112 insertions, 86 deletions
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index b3179d3ebaa2..f95b727d28ab 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -723,15 +723,15 @@ void SbaGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rM case DataType::REF: break; default: - rMenu.InsertItem(ID_BROWSER_COLATTRSET, aNewItems.GetItemText(ID_BROWSER_COLATTRSET), 0, nPos++); + rMenu.InsertItem(ID_BROWSER_COLATTRSET, aNewItems.GetItemText(ID_BROWSER_COLATTRSET), 0, OString(), nPos++); rMenu.SetHelpId(ID_BROWSER_COLATTRSET, aNewItems.GetHelpId(ID_BROWSER_COLATTRSET)); - rMenu.InsertSeparator(nPos++); + rMenu.InsertSeparator(OString(), nPos++); } } - rMenu.InsertItem(ID_BROWSER_COLWIDTH, aNewItems.GetItemText(ID_BROWSER_COLWIDTH), 0, nPos++); + rMenu.InsertItem(ID_BROWSER_COLWIDTH, aNewItems.GetItemText(ID_BROWSER_COLWIDTH), 0, OString(), nPos++); rMenu.SetHelpId(ID_BROWSER_COLWIDTH, aNewItems.GetHelpId(ID_BROWSER_COLWIDTH)); - rMenu.InsertSeparator(nPos++); + rMenu.InsertSeparator(OString(), nPos++); } } @@ -816,20 +816,20 @@ void SbaGridControl::PreExecuteRowContextMenu(sal_uInt16 nRow, PopupMenu& rMenu) if (!IsReadOnlyDB()) { - rMenu.InsertItem(ID_BROWSER_TABLEATTR, aNewItems.GetItemText(ID_BROWSER_TABLEATTR), 0, nPos++); + rMenu.InsertItem(ID_BROWSER_TABLEATTR, aNewItems.GetItemText(ID_BROWSER_TABLEATTR), 0, OString(), nPos++); rMenu.SetHelpId(ID_BROWSER_TABLEATTR, aNewItems.GetHelpId(ID_BROWSER_TABLEATTR)); - rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems.GetItemText(ID_BROWSER_ROWHEIGHT), 0, nPos++); + rMenu.InsertItem(ID_BROWSER_ROWHEIGHT, aNewItems.GetItemText(ID_BROWSER_ROWHEIGHT), 0, OString(), nPos++); rMenu.SetHelpId(ID_BROWSER_ROWHEIGHT, aNewItems.GetHelpId(ID_BROWSER_ROWHEIGHT)); - rMenu.InsertSeparator(nPos++); + rMenu.InsertSeparator(OString(), nPos++); } if ( GetSelectRowCount() > 0 ) { - rMenu.InsertItem(ID_BROWSER_COPY, aNewItems.GetItemText(SID_COPY), 0, nPos++); + rMenu.InsertItem(ID_BROWSER_COPY, aNewItems.GetItemText(SID_COPY), 0, OString(), nPos++); rMenu.SetHelpId(ID_BROWSER_COPY, aNewItems.GetHelpId(SID_COPY)); - rMenu.InsertSeparator(nPos++); + rMenu.InsertSeparator(OString(), nPos++); } } diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index ce7a37a2035a..38cb20f7e523 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -513,7 +513,7 @@ namespace const sal_uInt16 nCommandId = _rCommandController.registerCommandURL( aCommand ); _rMenu.InsertItem( nCommandId, _rMenu.GetItemText( nId ), _rMenu.GetItemImage( nId ), - _rMenu.GetItemBits( nId ), pos ); + _rMenu.GetItemBits( nId ), OString(), pos ); // more things to preserve: // - the help command diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 78143183a5f2..2073c2990979 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -986,10 +986,10 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) for ( sal_uInt16 nW = 0; nW < nWords; nW++ ) { String aAlternate( pAlt[nW] ); - aPopupMenu.InsertItem( MN_ALTSTART+nW, aAlternate, 0, nW ); - pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, 0, nW ); + aPopupMenu.InsertItem( MN_ALTSTART+nW, aAlternate, 0, OString(), nW ); + pAutoMenu->InsertItem( MN_AUTOSTART+nW, aAlternate, 0, OString(), nW ); } - aPopupMenu.InsertSeparator( nWords ); + aPopupMenu.InsertSeparator(OString(), nWords); } else aPopupMenu.RemoveItem( MN_AUTOCORR ); // delete? diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index 9d8951734729..f5c5218b9677 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -208,9 +208,9 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me { nInsSepAfterPos += ( pHelpMenu->GetItemCount() - nItemCount ); if ( pHelpMenu->GetItemType( nInsSepAfterPos ) != MENUITEM_SEPARATOR ) - pHelpMenu->InsertSeparator( nInsSepAfterPos ); + pHelpMenu->InsertSeparator(OString(), nInsSepAfterPos); } - pHelpMenu->InsertSeparator( nItemCount ); + pHelpMenu->InsertSeparator(OString(), nItemCount); } } } @@ -258,7 +258,7 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, if ( pAddonPopupMenu->GetItemCount() > 0 ) { pAddonPopupMenu->SetCommandURL( aURL ); - pMergeMenuBar->InsertItem( nId, aTitle, 0, nInsertPos++ ); + pMergeMenuBar->InsertItem( nId, aTitle, 0, OString(), nInsertPos++ ); pMergeMenuBar->SetPopupMenu( nId, pAddonPopupMenu ); // Store the command URL into the VCL menu bar for later identification @@ -325,12 +325,12 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent // have already one before us nElements = 0; bInsertSeparator = sal_False; - pCurrentMenu->InsertSeparator( nInsPos ); + pCurrentMenu->InsertSeparator(OString(), nInsPos); nInsPos = AddonMenuManager::GetNextPos( nInsPos ); } sal_uInt16 nId = nUniqueMenuId++; - pCurrentMenu->InsertItem( nId, aTitle, 0, nInsPos ); + pCurrentMenu->InsertItem(nId, aTitle, 0, OString(), nInsPos); nInsPos = AddonMenuManager::GetNextPos( nInsPos ); ++nElements; diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 5ee41bc0da27..5b4b9b3a7b5e 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -302,7 +302,7 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve // none of the items which precede the nSID-slot in the source menu are present in our conversion menu nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position - pVCLPopupMenu->InsertItem( nMenuId, m_pResPopupMenu->GetItemText( nMenuId ), m_pResPopupMenu->GetItemBits( nMenuId ), ++nPrevInConversion ); + pVCLPopupMenu->InsertItem( nMenuId, m_pResPopupMenu->GetItemText( nMenuId ), m_pResPopupMenu->GetItemBits( nMenuId ), OString(), ++nPrevInConversion ); pVCLPopupMenu->SetItemImage( nMenuId, m_pResPopupMenu->GetItemImage( nMenuId )); pVCLPopupMenu->SetHelpId( nMenuId, m_pResPopupMenu->GetHelpId( nMenuId )); } diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index cd307cce786a..b0520dea7a77 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -174,7 +174,7 @@ void HeaderMenuController::fillPopupMenu( const Reference< ::com::sun::star::fra aStrBuf.appendAscii( "false" ); pVCLPopupMenu->SetItemCommand( 1, aStrBuf.makeStringAndClear() ); - pVCLPopupMenu->InsertSeparator( 1 ); + pVCLPopupMenu->InsertSeparator(OString(), 1); } } } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 0f2c6ca4cb27..f28788709f3f 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -777,7 +777,7 @@ void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu ) if ( nBeforePos != MENU_APPEND ) nInsertPos = nBeforePos; - pMenu->InsertItem( nNewItemId, aMenuItem.aLabel, 0, nInsertPos ); + pMenu->InsertItem(nNewItemId, aMenuItem.aLabel, 0, OString(), nInsertPos); pMenu->SetItemCommand( nNewItemId, aMenuItem.aURL ); } } diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx index 64a5d363d71e..80fefdfbad11 100644 --- a/framework/source/uielement/menubarmerger.cxx +++ b/framework/source/uielement/menubarmerger.cxx @@ -178,11 +178,11 @@ bool MenuBarMerger::CreateSubMenu( { if ( rMenuItem.aURL.equalsAsciiL( SEPARATOR_STRING, SEPARATOR_STRING_LEN )) { - pSubMenu->InsertSeparator( MENU_APPEND ); + pSubMenu->InsertSeparator(); } else { - pSubMenu->InsertItem( nItemId, rMenuItem.aTitle, 0, MENU_APPEND ); + pSubMenu->InsertItem(nItemId, rMenuItem.aTitle); pSubMenu->SetItemCommand( nItemId, rMenuItem.aURL ); if ( !rMenuItem.aSubMenu.empty() ) { @@ -219,11 +219,11 @@ bool MenuBarMerger::MergeMenuItems( { if ( rMenuItem.aURL.equalsAsciiL( SEPARATOR_STRING, SEPARATOR_STRING_LEN )) { - pMenu->InsertSeparator( nPos+nModIndex+nIndex ); + pMenu->InsertSeparator(OString(), nPos+nModIndex+nIndex); } else { - pMenu->InsertItem( nItemId, rMenuItem.aTitle, 0, nPos+nModIndex+nIndex ); + pMenu->InsertItem(nItemId, rMenuItem.aTitle, 0, OString(), nPos+nModIndex+nIndex); pMenu->SetItemCommand( nItemId, rMenuItem.aURL ); if ( !rMenuItem.aSubMenu.empty() ) { @@ -343,10 +343,10 @@ bool MenuBarMerger::ProcessFallbackOperation( if ( IsCorrectContext( rMenuItem.aContext, rModuleIdentifier )) { if ( rMenuItem.aURL.equalsAsciiL( SEPARATOR_STRING, SEPARATOR_STRING_LEN )) - pCurrMenu->InsertSeparator( MENU_APPEND ); + pCurrMenu->InsertSeparator(OString(), MENU_APPEND); else { - pCurrMenu->InsertItem( rItemId, rMenuItem.aTitle, 0, MENU_APPEND ); + pCurrMenu->InsertItem(rItemId, rMenuItem.aTitle); pCurrMenu->SetItemCommand( rItemId, rMenuItem.aURL ); ++rItemId; } @@ -371,7 +371,7 @@ bool MenuBarMerger::ProcessFallbackOperation( else { // normal case: insert a new item with popup - pCurrMenu->InsertItem( rItemId, ::rtl::OUString(), 0, MENU_APPEND ); + pCurrMenu->InsertItem(rItemId, OUString()); pCurrMenu->SetItemCommand( rItemId, aCmd ); pCurrMenu->SetPopupMenu( rItemId, pPopupMenu ); } diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index ee97af94bc56..cb5541752e15 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1981,7 +1981,8 @@ void Change( Menu* pMenu, SfxViewShell* pView ) const SfxSlot* pSlot = pIFace->GetSlot( aCmd ); if ( pSlot ) { - pMenu->InsertItem( pSlot->GetSlotId(), pMenu->GetItemText( nId ), pMenu->GetItemBits( nId ), nPos ); + pMenu->InsertItem( pSlot->GetSlotId(), pMenu->GetItemText( nId ), + pMenu->GetItemBits( nId ), OString(), nPos ); pMenu->SetItemCommand( pSlot->GetSlotId(), aCmd ); pMenu->RemoveItem( nPos+1 ); break; diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx index ab684460f512..c8bf2749a142 100644 --- a/svtools/source/control/stdmenu.cxx +++ b/svtools/source/control/stdmenu.cxx @@ -80,7 +80,7 @@ void FontNameMenu::Fill( const FontList* pList ) break; j--; } - InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, j ); + InsertItem( i+1, rName, MIB_RADIOCHECK | MIB_AUTOCHECK, OString(), j ); } SetCurName( maCurName ); diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 26eacd9cb132..dda5a52e74c5 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -742,7 +742,8 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe if (nHiddenCols < 16) { // (only the first 16 items to keep the menu rather small) aName = xCurCol->getPropertyValue(FM_PROP_LABEL); - pShowColsMenu->InsertItem(nHiddenCols + 1, ::comphelper::getString(aName), 0, nHiddenCols); + pShowColsMenu->InsertItem(nHiddenCols + 1, ::comphelper::getString(aName), + 0, OString(), nHiddenCols); // the ID is arbitrary, but should be unique within the whole menu } ++nHiddenCols; diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index eebc0f3227f7..31304ac7aa00 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -4156,7 +4156,8 @@ void ControlConversionMenuController::StateChanged(sal_uInt16 nSID, SfxItemState if (MENU_ITEM_NOTFOUND == nPrevInConversion) // none of the items which precede the nSID-slot in the source menu are present in our conversion menu nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position - m_pConversionMenu->InsertItem(nSID, pSource->GetItemText(nSID), pSource->GetItemBits(nSID), ++nPrevInConversion); + m_pConversionMenu->InsertItem(nSID, pSource->GetItemText(nSID), + pSource->GetItemBits(nSID), OString(), ++nPrevInConversion); m_pConversionMenu->SetItemImage(nSID, pSource->GetItemImage(nSID)); m_pConversionMenu->SetHelpId(nSID, pSource->GetHelpId(nSID)); diff --git a/svx/source/mnuctrls/SmartTagCtl.cxx b/svx/source/mnuctrls/SmartTagCtl.cxx index 1f9d52d75a84..36d43cc01581 100644 --- a/svx/source/mnuctrls/SmartTagCtl.cxx +++ b/svx/source/mnuctrls/SmartTagCtl.cxx @@ -98,17 +98,17 @@ void SvxSmartTagsControl::FillMenu() PopupMenu* pSbMenu = mpMenu; if ( 1 < rActionComponentsSequence.getLength() ) { - mpMenu->InsertItem( nMenuId, aSmartTagCaption, 0, nMenuPos++); + mpMenu->InsertItem(nMenuId, aSmartTagCaption, 0, OString(), nMenuPos++); pSbMenu = new PopupMenu; mpMenu->SetPopupMenu( nMenuId++, pSbMenu ); } pSbMenu->SetSelectHdl( LINK( this, SvxSmartTagsControl, MenuSelect ) ); // sub-menu starts with smart tag caption and separator - const rtl::OUString aSmartTagCaption2 = aSmartTagCaption + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(": ")) + aRangeText; + const rtl::OUString aSmartTagCaption2 = aSmartTagCaption + OUString(": ") + aRangeText; nSubMenuPos = 0; - pSbMenu->InsertItem( nMenuId++, aSmartTagCaption2, MIB_NOSELECT, nSubMenuPos++ ); - pSbMenu->InsertSeparator( nSubMenuPos++ ); + pSbMenu->InsertItem(nMenuId++, aSmartTagCaption2, MIB_NOSELECT, OString(), nSubMenuPos++); + pSbMenu->InsertSeparator(OString(), nSubMenuPos++); // Add subitem for every action reference for the current smart tag type: for ( sal_uInt16 i = 0; i < rActionComponents.getLength(); ++i ) @@ -127,7 +127,7 @@ void SvxSmartTagsControl::FillMenu() xController, xTextRange ); - pSbMenu->InsertItem( nSubMenuId++, aActionCaption, 0, nSubMenuPos++ ); + pSbMenu->InsertItem( nSubMenuId++, aActionCaption, 0, OString(), nSubMenuPos++ ); InvokeAction aEntry( xAction, xSmartTagProperties, nActionID ); maInvokeActions.push_back( aEntry ); } diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 6cb971916710..3686f97f3237 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -416,8 +416,8 @@ SwSpellPopup::SwSpellPopup( sal_uInt16 nItemId = MN_SUGGESTION_START; for (sal_uInt16 i = 0; i < nStringCount; ++i) { - const String aEntry = aSuggestions[ i ]; - InsertItem( nItemId, aEntry, 0, i ); + const OUString aEntry = aSuggestions[ i ]; + InsertItem(nItemId, aEntry, 0, OString(), i); SetHelpId( nItemId, HID_LINGU_REPLACE); if (!aSuggestionImageUrl.isEmpty()) SetItemImage( nItemId, aImage ); @@ -434,7 +434,7 @@ SwSpellPopup::SwSpellPopup( OUString aSpellingAndGrammar = RetrieveLabelFromCommand( ".uno:SpellingAndGrammarDialog" ); SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); sal_uInt16 nItemPos = GetItemPos( MN_IGNORE_WORD ); - InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); + InsertItem(MN_IGNORE_SELECTION, aIgnoreSelection, 0, OString(), nItemPos); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); EnableItem( MN_AUTOCORR, bEnable ); @@ -581,8 +581,8 @@ aInfo16( SW_RES(IMG_INFO_16) ) sal_uInt16 nPos = 0; OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment ); - InsertSeparator( nPos++ ); - InsertItem( MN_SHORT_COMMENT, aMessageText, MIB_NOSELECT, nPos++ ); + InsertSeparator(OString(), nPos++); + InsertItem(MN_SHORT_COMMENT, aMessageText, MIB_NOSELECT, OString(), nPos++); if (bUseImagesInMenus) SetItemImage( MN_SHORT_COMMENT, aInfo16 ); @@ -603,12 +603,12 @@ aInfo16( SW_RES(IMG_INFO_16) ) if ( !sExplanationLink.isEmpty( ) ) { - InsertItem( MN_EXPLANATION_LINK, String( SW_RES( STR_EXPLANATION_LINK ) ), MIB_TEXT | MIB_HELP, nPos++ ); + InsertItem(MN_EXPLANATION_LINK, SW_RESSTR(STR_EXPLANATION_LINK), MIB_TEXT | MIB_HELP, OString(), nPos++); } SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); - InsertSeparator( nPos++ ); + InsertSeparator(OString(), nPos++); sal_Int32 nStringCount = aSuggestions.getLength(); if ( nStringCount ) // suggestions available... { @@ -628,22 +628,22 @@ aInfo16( SW_RES(IMG_INFO_16) ) sal_uInt16 nItemId = MN_SUGGESTION_START; for (sal_uInt16 i = 0; i < nStringCount; ++i) { - const String aEntry = aSuggestions[ i ]; - InsertItem( nItemId, aEntry, 0, nPos++ ); + const OUString aEntry = aSuggestions[ i ]; + InsertItem(nItemId, aEntry, 0, OString(), nPos++); SetHelpId( nItemId, HID_LINGU_REPLACE ); if (!aSuggestionImageUrl.isEmpty()) SetItemImage( nItemId, aImage ); ++nItemId; } - InsertSeparator( nPos++ ); + InsertSeparator(OString(), nPos++); } OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) ); OUString aSpellingAndGrammar = RetrieveLabelFromCommand( ".uno:SpellingAndGrammarDialog" ); SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar ); sal_uInt16 nItemPos = GetItemPos( MN_IGNORE_WORD ); - InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos ); + InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, OString(), nItemPos ); SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION); EnableItem( MN_AUTOCORR, false ); diff --git a/sw/source/ui/smartmenu/stmenu.cxx b/sw/source/ui/smartmenu/stmenu.cxx index 64d1cce16a6d..e95167c860f8 100644 --- a/sw/source/ui/smartmenu/stmenu.cxx +++ b/sw/source/ui/smartmenu/stmenu.cxx @@ -88,7 +88,7 @@ SwSmartTagPopup::SwSmartTagPopup( SwView* pSwView, PopupMenu* pSbMenu = this; if ( 1 < aActionComponentsSequence.getLength() ) { - InsertItem( nMenuId, aSmartTagCaption, 0, nMenuPos++); + InsertItem(nMenuId, aSmartTagCaption, 0, OString(), nMenuPos++); pSbMenu = new PopupMenu; SetPopupMenu( nMenuId++, pSbMenu ); } @@ -96,8 +96,8 @@ SwSmartTagPopup::SwSmartTagPopup( SwView* pSwView, // sub-menu starts with smart tag caption and separator const rtl::OUString aSmartTagCaption2 = aSmartTagCaption + ": " + aRangeText; nSubMenuPos = 0; - pSbMenu->InsertItem( nMenuId++, aSmartTagCaption2, MIB_NOSELECT, nSubMenuPos++ ); - pSbMenu->InsertSeparator( nSubMenuPos++ ); + pSbMenu->InsertItem(nMenuId++, aSmartTagCaption2, MIB_NOSELECT, OString(), nSubMenuPos++); + pSbMenu->InsertSeparator(OString(), nSubMenuPos++); // Add subitem for every action reference for the current smart tag type: for ( sal_uInt16 i = 0; i < rActionComponents.getLength(); ++i ) @@ -116,7 +116,7 @@ SwSmartTagPopup::SwSmartTagPopup( SwView* pSwView, xController, mxTextRange ); - pSbMenu->InsertItem( nSubMenuId++, aActionCaption, 0, nSubMenuPos++ ); + pSbMenu->InsertItem(nSubMenuId++, aActionCaption, 0, OString(), nSubMenuPos++); InvokeAction aEntry( xAction, xSmartTagProperties, nActionID ); maInvokeActions.push_back( aEntry ); } diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index be0712a0e152..aa7bcc1361e2 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -407,7 +407,7 @@ void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) - mpMenu->InsertItem( nItemId, aText, (MenuItemBits)nItemStyle, nPos ); + mpMenu->InsertItem(nItemId, aText, (MenuItemBits)nItemStyle, OString(), nPos); } void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException) @@ -543,7 +543,7 @@ void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::Ru ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) - mpMenu->InsertSeparator( nPos ); + mpMenu->InsertSeparator(OString(), nPos); } void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException) diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx index 9bd5c0b37388..ebf8e49ff747 100644 --- a/vcl/inc/vcl/menu.hxx +++ b/vcl/inc/vcl/menu.hxx @@ -212,16 +212,20 @@ public: void InsertItem( sal_uInt16 nItemId, const XubString& rStr, MenuItemBits nItemBits = 0, + const OString &rIdent = OString(), sal_uInt16 nPos = MENU_APPEND ); void InsertItem( sal_uInt16 nItemId, const Image& rImage, MenuItemBits nItemBits = 0, + const OString &rIdent = OString(), sal_uInt16 nPos = MENU_APPEND ); void InsertItem( sal_uInt16 nItemId, const XubString& rString, const Image& rImage, MenuItemBits nItemBits = 0, + const OString &rIdent = OString(), sal_uInt16 nPos = MENU_APPEND ); void InsertItem( const ResId& rResId, sal_uInt16 nPos = MENU_APPEND ); - void InsertSeparator( sal_uInt16 nPos = MENU_APPEND ); + void InsertSeparator( const OString &rIdent = OString(), + sal_uInt16 nPos = MENU_APPEND ); void RemoveItem( sal_uInt16 nPos ); void CopyItem( const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 nNewPos = MENU_APPEND ); @@ -233,7 +237,8 @@ public: sal_uInt16 GetMenuFlags() const { return nMenuFlags; } sal_uInt16 GetItemCount() const; - sal_uInt16 GetItemId( sal_uInt16 nPos ) const; + sal_uInt16 GetItemId(sal_uInt16 nPos) const; + sal_uInt16 GetItemId(const OString &rIdent) const; sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const; MenuItemType GetItemType( sal_uInt16 nPos ) const; sal_uInt16 GetCurItemId() const; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index b18062583cad..d9defdfc932f 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1690,11 +1690,11 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con if (rClass == "GtkMenuItem") { OUString sLabel(OStringToOUString(convertMnemonicMarkup(extractLabel(rProps)), RTL_TEXTENCODING_UTF8)); - pParent->InsertItem(nNewId, sLabel, MIB_TEXT); + pParent->InsertItem(nNewId, sLabel, MIB_TEXT, rID); } else if (rClass == "GtkSeparatorMenuItem") { - pParent->InsertSeparator(); + pParent->InsertSeparator(rID); } SAL_WARN_IF(nOldCount == pParent->GetItemCount(), "vcl.layout", "probably need to implement " << rClass.getStr()); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 5fe08d186b06..d2d6adf89b20 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -109,7 +109,7 @@ static sal_Bool ImplAccelDisabled() struct MenuItemData { - sal_uInt16 nId; // SV Id + sal_uInt16 nId; // SV Id MenuItemType eType; // MenuItem-Type MenuItemBits nBits; // MenuItem-Bits Menu* pSubMenu; // Pointer to SubMenu @@ -119,7 +119,8 @@ struct MenuItemData XubString aTipHelpText; // TipHelp-String (eg, expanded filenames) XubString aCommandStr; // CommandString XubString aHelpCommandStr; // Help command string (to reference external help) - rtl::OString aHelpId; // Help-Id + OString sIdent; + OString aHelpId; // Help-Id sal_uLong nUserValue; // User value Image aImage; // Image KeyCode aAccelKey; // Accelerator-Key @@ -181,9 +182,10 @@ public: const XubString& rStr, const Image& rImage, Menu* pMenu, - size_t nPos + size_t nPos, + const OString &rIdent ); - void InsertSeparator( size_t nPos ); + void InsertSeparator(const OString &rIdent, size_t nPos); void Remove( size_t nPos ); @@ -228,11 +230,13 @@ MenuItemData* MenuItemList::Insert( const XubString& rStr, const Image& rImage, Menu* pMenu, - size_t nPos + size_t nPos, + const OString &rIdent ) { MenuItemData* pData = new MenuItemData( rStr, rImage ); pData->nId = nId; + pData->sIdent = rIdent; pData->eType = eType; pData->nBits = nBits; pData->pSubMenu = NULL; @@ -264,10 +268,11 @@ MenuItemData* MenuItemList::Insert( return pData; } -void MenuItemList::InsertSeparator( size_t nPos ) +void MenuItemList::InsertSeparator(const OString &rIdent, size_t nPos) { MenuItemData* pData = new MenuItemData; pData->nId = 0; + pData->sIdent = rIdent; pData->eType = MENUITEM_SEPARATOR; pData->nBits = 0; pData->pSubMenu = NULL; @@ -1194,7 +1199,8 @@ void Menu::RemoveEventListener( const Link& rEventListener ) maEventListeners.removeListener( rEventListener ); } -void Menu::InsertItem( sal_uInt16 nItemId, const XubString& rStr, MenuItemBits nItemBits, sal_uInt16 nPos ) +void Menu::InsertItem(sal_uInt16 nItemId, const XubString& rStr, MenuItemBits nItemBits, + const OString &rIdent, sal_uInt16 nPos) { DBG_ASSERT( nItemId, "Menu::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == MENU_ITEM_NOTFOUND, @@ -1205,8 +1211,8 @@ void Menu::InsertItem( sal_uInt16 nItemId, const XubString& rStr, MenuItemBits n nPos = MENU_APPEND; // put Item in MenuItemList - MenuItemData* pData = pItemList->Insert( nItemId, MENUITEM_STRING, - nItemBits, rStr, Image(), this, nPos ); + MenuItemData* pData = pItemList->Insert(nItemId, MENUITEM_STRING, + nItemBits, rStr, Image(), this, nPos, rIdent); // update native menu if( ImplGetSalMenu() && pData->pSalMenuItem ) @@ -1223,18 +1229,18 @@ void Menu::InsertItem( sal_uInt16 nItemId, const XubString& rStr, MenuItemBits n ImplCallEventListeners( VCLEVENT_MENU_INSERTITEM, nPos ); } -void Menu::InsertItem( sal_uInt16 nItemId, const Image& rImage, - MenuItemBits nItemBits, sal_uInt16 nPos ) +void Menu::InsertItem(sal_uInt16 nItemId, const Image& rImage, + MenuItemBits nItemBits, const OString &rIdent, sal_uInt16 nPos) { - InsertItem( nItemId, ImplGetSVEmptyStr(), nItemBits, nPos ); + InsertItem(nItemId, ImplGetSVEmptyStr(), nItemBits, rIdent, nPos); SetItemImage( nItemId, rImage ); } -void Menu::InsertItem( sal_uInt16 nItemId, - const XubString& rStr, const Image& rImage, - MenuItemBits nItemBits, sal_uInt16 nPos ) +void Menu::InsertItem(sal_uInt16 nItemId, const XubString& rStr, + const Image& rImage, MenuItemBits nItemBits, + const OString &rIdent, sal_uInt16 nPos) { - InsertItem( nItemId, rStr, nItemBits, nPos ); + InsertItem(nItemId, rStr, nItemBits, rIdent, nPos); SetItemImage( nItemId, rImage ); } @@ -1272,16 +1278,16 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) { Bitmap aBmp( ResId( (RSHEADER_TYPE*)GetClassRes(), *pMgr ) ); if ( aText.Len() ) - InsertItem( nItemId, aText, aBmp, nStatus, nPos ); + InsertItem( nItemId, aText, aBmp, nStatus, OString(), nPos ); else - InsertItem( nItemId, aBmp, nStatus, nPos ); + InsertItem( nItemId, aBmp, nStatus, OString(), nPos ); } IncrementRes( GetObjSizeRes( (RSHEADER_TYPE*)GetClassRes() ) ); } else if ( !bSep ) - InsertItem( nItemId, aText, nStatus, nPos ); + InsertItem(nItemId, aText, nStatus, OString(), nPos); if ( bSep ) - InsertSeparator( nPos ); + InsertSeparator(OString(), nPos); String aHelpText; if ( nObjMask & RSC_MENUITEM_HELPTEXT ) @@ -1342,7 +1348,7 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) delete mpLayoutData, mpLayoutData = NULL; } -void Menu::InsertSeparator( sal_uInt16 nPos ) +void Menu::InsertSeparator(const OString &rIdent, sal_uInt16 nPos) { // do nothing if its a menu bar if ( bIsMenuBar ) @@ -1353,7 +1359,7 @@ void Menu::InsertSeparator( sal_uInt16 nPos ) nPos = MENU_APPEND; // put separator in item list - pItemList->InsertSeparator( nPos ); + pItemList->InsertSeparator(rIdent, nPos); // update native menu size_t itemPos = ( nPos != MENU_APPEND ) ? nPos : pItemList->size() - 1; @@ -1402,7 +1408,7 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 n return; if ( eType == MENUITEM_SEPARATOR ) - pThis->InsertSeparator( nNewPos ); + pThis->InsertSeparator( OString(), nNewPos ); else { sal_uInt16 nId = rMenu.GetItemId( nPos ); @@ -1413,11 +1419,11 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 n MenuItemData* pData = rMenu.GetItemList()->GetData( nId ); if ( eType == MENUITEM_STRINGIMAGE ) - pThis->InsertItem( nId, pData->aText, pData->aImage, pData->nBits, nNewPos ); + pThis->InsertItem( nId, pData->aText, pData->aImage, pData->nBits, pData->sIdent, nNewPos ); else if ( eType == MENUITEM_STRING ) - pThis->InsertItem( nId, pData->aText, pData->nBits, nNewPos ); + pThis->InsertItem( nId, pData->aText, pData->nBits, pData->sIdent, nNewPos ); else - pThis->InsertItem( nId, pData->aImage, pData->nBits, nNewPos ); + pThis->InsertItem( nId, pData->aImage, pData->nBits, pData->sIdent, nNewPos ); if ( rMenu.IsItemChecked( nId ) ) pThis->CheckItem( nId, sal_True ); @@ -1501,7 +1507,7 @@ sal_uInt16 Menu::ImplGetNextVisible( sal_uInt16 nPos ) const return ITEMPOS_INVALID; } -sal_uInt16 Menu::GetItemId( sal_uInt16 nPos ) const +sal_uInt16 Menu::GetItemId(sal_uInt16 nPos) const { MenuItemData* pData = pItemList->GetDataFromPos( nPos ); @@ -1511,6 +1517,18 @@ sal_uInt16 Menu::GetItemId( sal_uInt16 nPos ) const return 0; } +sal_uInt16 Menu::GetItemId(const OString &rIdent) const +{ + for (size_t n = 0; n < pItemList->size(); ++n) + { + MenuItemData* pData = pItemList->GetDataFromPos(n); + if (pData && pData->sIdent == rIdent) + return pData->nId; + } + return MENU_ITEM_NOTFOUND; +} + + sal_uInt16 Menu::GetItemPos( sal_uInt16 nItemId ) const { size_t nPos; @@ -3647,7 +3665,7 @@ sal_uInt16 PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, sal_uLong { rtl::OUString aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) ); MenuItemData* pData = pItemList->Insert( - 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF ); + 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF, OString() ); pData->bIsTemporary = sal_True; } } |