[Libreoffice-commits] core.git: framework/inc framework/source include/vcl officecfg/registry vcl/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Thu Nov 19 04:39:44 PST 2015
framework/inc/classes/resource.hrc | 3 -
framework/source/classes/resource.src | 5 --
framework/source/uielement/saveasmenucontroller.cxx | 15 +++-----
include/vcl/menu.hxx | 5 ++
officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 3 +
vcl/source/window/menu.cxx | 18 ++++++++++
6 files changed, 33 insertions(+), 16 deletions(-)
New commits:
commit a3eec8a043eae4417276938968a5a8e227d23111
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Nov 19 13:37:22 2015 +0100
Toolbar: Add 'Save As' to 'Save' dropdown
Change-Id: I6597ae5569b29d09a8c44fc9a55b71166aa37b05
diff --git a/framework/inc/classes/resource.hrc b/framework/inc/classes/resource.hrc
index c7fc394..4331a42 100644
--- a/framework/inc/classes/resource.hrc
+++ b/framework/inc/classes/resource.hrc
@@ -51,8 +51,7 @@
#define STR_CLEAR_RECENT_FILES_HELP (RID_STR_START+24)
#define STR_LANGSTATUS_HINT (RID_STR_START+25)
#define STR_OPEN_REMOTE (RID_STR_START+26)
-#define STR_REMOTE_FILE (RID_STR_START+27)
-#define STR_REMOTE_TITLE (RID_STR_START+28)
+#define STR_REMOTE_TITLE (RID_STR_START+27)
#define POPUPMENU_TOOLBAR_QUICKCUSTOMIZATION (RID_MENU_START+0)
diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src
index 570e288..66f5a24 100644
--- a/framework/source/classes/resource.src
+++ b/framework/source/classes/resource.src
@@ -119,11 +119,6 @@ String STR_OPEN_REMOTE
Text [ en-US ] = "Open remote file";
};
-String STR_REMOTE_FILE
-{
- Text [ en-US ] = "Save Remote File...";
-};
-
String STR_REMOTE_TITLE
{
Text [ en-US ] = " (Remote)";
diff --git a/framework/source/uielement/saveasmenucontroller.cxx b/framework/source/uielement/saveasmenucontroller.cxx
index d056be2..e6f4edd 100644
--- a/framework/source/uielement/saveasmenucontroller.cxx
+++ b/framework/source/uielement/saveasmenucontroller.cxx
@@ -40,6 +40,7 @@ using namespace framework;
namespace {
+static const char CMD_SAVEAS[] = ".uno:SaveAs";
static const char CMD_SAVE_REMOTE[] = ".uno:SaveAsRemote";
class SaveAsMenuController : public svt::PopupMenuControllerBase
@@ -112,11 +113,8 @@ void SaveAsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo
if ( pVCLPopupMenu )
{
- // Open remote menu entry
- pVCLPopupMenu->InsertItem( sal_uInt16( 1 ),
- FWK_RESSTR( STR_REMOTE_FILE ) );
- pVCLPopupMenu->SetItemCommand( sal_uInt16( 1 ),
- CMD_SAVE_REMOTE );
+ pVCLPopupMenu->InsertItem( CMD_SAVEAS, m_xFrame );
+ pVCLPopupMenu->InsertItem( CMD_SAVE_REMOTE, m_xFrame );
}
}
@@ -155,12 +153,11 @@ void SAL_CALL SaveAsMenuController::itemSelected( const css::awt::MenuEvent& rEv
OSL_TRACE( "SaveAsMenuController::itemSelected() - Command : %s",
OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() );
+ Sequence< PropertyValue > aArgsList( 0 );
if ( aCommand == CMD_SAVE_REMOTE )
- {
- Sequence< PropertyValue > aArgsList( 0 );
-
dispatchCommand( CMD_SAVE_REMOTE, aArgsList );
- }
+ else if ( aCommand == CMD_SAVEAS )
+ dispatchCommand( CMD_SAVEAS, aArgsList );
}
}
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index f065e7b..ade703b 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -252,6 +252,11 @@ public:
const OString &rIdent = OString(),
sal_uInt16 nPos = MENU_APPEND);
void InsertItem(const ResId& rResId, sal_uInt16 nPos = MENU_APPEND );
+ void InsertItem(const OUString& rCommand,
+ const css::uno::Reference<css::frame::XFrame>& rFrame,
+ MenuItemBits nBits = MenuItemBits::NONE,
+ const OString &rIdent = OString(),
+ 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 );
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 72858b9..80d2325 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -2032,6 +2032,9 @@
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Save to Remote Ser~ver</value>
</prop>
+ <prop oor:name="PopupLabel" oor:type="xs:string">
+ <value xml:lang="en-US">Save Remote File...</value>
+ </prop>
<prop oor:name="Properties" oor:type="xs:int">
<value>1</value>
</prop>
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 7c36353..803c8a4 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -41,6 +41,7 @@
#include <vcl/toolbox.hxx>
#include <vcl/dockingarea.hxx>
#include <vcl/settings.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <salinst.hxx>
#include <svdata.hxx>
@@ -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<frame::XFrame>& 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
More information about the Libreoffice-commits
mailing list