From a3eec8a043eae4417276938968a5a8e227d23111 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Thu, 19 Nov 2015 13:37:22 +0100 Subject: Toolbar: Add 'Save As' to 'Save' dropdown Change-Id: I6597ae5569b29d09a8c44fc9a55b71166aa37b05 --- vcl/source/window/menu.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'vcl/source/window') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 7c36353f5a4e..803c8a456a1a 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -525,6 +526,23 @@ void Menu::InsertItem( const ResId& rResId, sal_uInt16 nPos ) delete mpLayoutData, mpLayoutData = nullptr; } +void Menu::InsertItem(const OUString& rCommand, const uno::Reference& rFrame, + MenuItemBits nBits, const OString &rIdent, sal_uInt16 nPos) +{ + OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame)); + OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame)); + Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, /*bLarge=*/ false, rFrame)); + + // let's invent an ItemId + const sal_uInt16 COMMAND_ITEMID_START = 30000; + sal_uInt16 nItemId = COMMAND_ITEMID_START + GetItemCount(); + + InsertItem(nItemId, aLabel, aImage, nBits, rIdent, nPos); + SetItemCommand(nItemId, rCommand); + SetHelpText(nItemId, aTooltip); +} + + void Menu::InsertSeparator(const OString &rIdent, sal_uInt16 nPos) { // do nothing if it's a menu bar -- cgit v1.2.3