[Libreoffice-commits] .: 2 commits - cui/source vcl/inc vcl/source

2013-01-25 Thread Libreoffice Gerrit user
 cui/source/inc/helpid.hrc |4 
 vcl/inc/svids.hrc |2 ++
 vcl/source/control/button.cxx |   20 +---
 vcl/source/src/btntext.src|   19 ++-
 4 files changed, 29 insertions(+), 16 deletions(-)

New commits:
commit 14d8cd11d6b4831811dbaeb6cfa1f81392251abe
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Jan 25 13:42:13 2013 +

Resolves: rhbz#902694 impossible short-cuts for OK/Cancel translations

auto-adding mnemonics to the first character of OK/Cancel translations 
suggests
short-cuts under various CJK/Indic languages which can't be achieved with a
single keystroke combination

Some platforms want mnemonic-ed OK/Cancel, some don't. So lets have two
translations, one for each situation, rather than trying to automunge.

Change-Id: I23e21e79b27ead86f535309ca0efc2adea86ae24

diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index 27e5e0a..064cd53 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -156,6 +156,8 @@
 #define SV_BUTTONTEXT_NEW   10115
 #define SV_BUTTONTEXT_EDIT  10116
 #define SV_BUTTONTEXT_APPLY 10117
+#define SV_BUTTONTEXT_OK_NOMNEMONIC 10118
+#define SV_BUTTONTEXT_CANCEL_NOMNEMONIC 10119
 
 #define SV_STDTEXT_FIRSTSV_STDTEXT_SERVICENOTAVAILABLE
 #define SV_STDTEXT_SERVICENOTAVAILABLE  10200
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1cc10af..e2f8b76 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -143,18 +143,16 @@ OUString Button::GetStandardText( StandardButtonType 
eButton )
 }
 
 sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId;
-OUString aText = ResId(nResId, *pResMgr).toString();
-
-if (nResId == SV_BUTTONTEXT_OK || nResId == SV_BUTTONTEXT_CANCEL)
-{
-#ifndef WNT
-// Windows (apparently) has some magic auto-accelerator evil around
-// ok / cancel so add accelerators only for Unix
-if (aText.indexOf('~') == -1)
-return ~ + aText;
+#ifdef WNT
+// 
http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
+// Under windows we don't want accelerators on ok/cancel but do on other
+// buttons
+if (nResId == SV_BUTTONTEXT_OK)
+nResId = SV_BUTTONTEXT_OK_NOMNEMONIC;
+else if (nResId == SV_BUTTONTEXT_CANCEL)
+nResId = SV_BUTTONTEXT_CANCEL_NOMNEMONIC;
 #endif
-}
-return aText;
+return ResId(nResId, *pResMgr).toString();
 }
 
 // ---
diff --git a/vcl/source/src/btntext.src b/vcl/source/src/btntext.src
index 5f93307..a16fc70 100644
--- a/vcl/source/src/btntext.src
+++ b/vcl/source/src/btntext.src
@@ -18,13 +18,30 @@
 
 #include svids.hrc
 
+//http://lists.freedesktop.org/archives/libreoffice/2013-January/044513.html
+//Special OK/Cancel handling
+
 String SV_BUTTONTEXT_OK
 {
-Text [ en-US ] = OK;
+Text [ x-comment ] = This is used on buttons for platforms other than 
windows, there should be a ~ mnemonic in this string;
+Text [ en-US ] = ~OK;
 };
 
 String SV_BUTTONTEXT_CANCEL
 {
+Text [ x-comment ] = This is used on buttons for platforms other than 
windows, there should be a ~ mnemonic in this string;
+Text [ en-US ] = ~Cancel;
+};
+
+String SV_BUTTONTEXT_OK_NOMNEMONIC
+{
+Text [ x-comment ] = This is used on buttons for Windows, there should be 
no ~ mnemonic in this string;
+Text [ en-US ] = OK;
+};
+
+String SV_BUTTONTEXT_CANCEL_NOMNEMONIC
+{
+Text [ x-comment ] = This is used on buttons for Windows, there should be 
no ~ mnemonic in this string;
 Text [ en-US ] = Cancel;
 };
 
commit 610ebd9a1100095b81835a476465b6ef126e8e1e
Author: Caolán McNamara caol...@redhat.com
Date:   Fri Jan 25 12:44:20 2013 +

remove redundant HIDs

Change-Id: I982b760084cf9ed259432b7c77a865e3f8f13fed

diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc
index 82c1567..c1ab0c6 100644
--- a/cui/source/inc/helpid.hrc
+++ b/cui/source/inc/helpid.hrc
@@ -190,13 +190,9 @@
 #define HID_CHARMAP_CTL_SHOWSET CUI_HID_CHARMAP_CTL_SHOWSET
 #define HID_CHARMAP_CTL_SHOWTEXT CUI_HID_CHARMAP_CTL_SHOWTEXT
 #define HID_CHARMAP_CTL_SHOWCHAR CUI_HID_CHARMAP_CTL_SHOWCHAR
-#define HID_DLG_NAME CUI_HID_DLG_NAME
-#define HID_DLG_MESSBOX CUI_HID_DLG_MESSBOX
 #define HID_HANGULDLG_SUGGESTIONS CUI_HID_HANGULDLG_SUGGESTIONS
 #define HID_HANGULDLG_SUGGESTIONS_GRID CUI_HID_HANGULDLG_SUGGESTIONS_GRID
 #define HID_HANGULDLG_SUGGESTIONS_LIST CUI_HID_HANGULDLG_SUGGESTIONS_LIST
-#define HID_DLG_OBJECT_NAME CUI_HID_DLG_OBJECT_NAME
-#define HID_DLG_OBJECT_TITLE_DESC CUI_HID_DLG_OBJECT_TITLE_DESC
 #define HID_SVX_CONFIG_MENU_ORGANIZER CUI_HID_SVX_CONFIG_MENU_ORGANIZER
 #define HID_SVX_CONFIG_ICON_SELECTOR CUI_HID_SVX_CONFIG_ICON_SELECTOR
 #define HID_SVX_CONFIG_NAME_SUBMENU CUI_HID_SVX_CONFIG_NAME_SUBMENU

[Libreoffice-commits] .: 2 commits - cui/source vcl/inc vcl/source

2012-12-11 Thread Libreoffice Gerrit user
 cui/source/dialogs/thesdlg.cxx |   36 +--
 cui/source/inc/thesdlg.hxx |9 
 vcl/inc/vcl/builder.hxx|   29 +++
 vcl/source/window/builder.cxx  |  387 ++---
 vcl/source/window/window2.cxx  |   23 --
 5 files changed, 407 insertions(+), 77 deletions(-)

New commits:
commit e4cdeebc488e41d64cee1ccc531fc04ce727b03c
Author: Caolán McNamara caol...@redhat.com
Date:   Tue Dec 11 09:33:45 2012 +

add popup menu support to .ui loader

and hack up a mechanism to support menubuttons and map
the popups to the menubuttons

Change-Id: I6f3bd0e83b2c55f71aa85924fdc32d3a73ce0197

diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index e2793e6..4ca873f 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -21,6 +21,7 @@
 
 class ListBox;
 class NumericFormatter;
+class PopupMenu;
 class ScrollBar;
 class VclMultiLineEdit;
 
@@ -56,6 +57,18 @@ private:
 };
 std::vectorWinAndId m_aChildren;
 
+struct MenuAndId
+{
+OString m_sID;
+PopupMenu *m_pMenu;
+MenuAndId(const OString rId, PopupMenu *pMenu)
+: m_sID(rId)
+, m_pMenu(pMenu)
+{
+}
+};
+std::vectorMenuAndId m_aMenus;
+
 struct StringPair
 {
 OString m_sID;
@@ -72,6 +85,7 @@ private:
 typedef StringPair ButtonImageWidgetMap;
 typedef StringPair TextBufferMap;
 typedef StringPair WidgetAdjustmentMap;
+typedef StringPair ButtonMenuMap;
 
 struct ListStore
 {
@@ -112,6 +126,8 @@ private:
 std::vectorButtonImageWidgetMap m_aButtonImageWidgetMaps;
 StockMap m_aStockMap;
 
+std::vectorButtonMenuMap m_aButtonMenuMaps;
+
 Translations m_aTranslations;
 
 std::mapWindow*, Window* m_aRedundantParentWidgets;
@@ -131,6 +147,8 @@ private:
 Window *get_by_name(OString sID);
 void delete_by_name(OString sID);
 
+PopupMenu *get_menu_by_name(OString sID);
+
 class sortIntoBestTabTraversalOrder
 : public std::binary_functionconst Window*, const Window*, bool
 {
@@ -168,6 +186,10 @@ public:
 }
 OString get_by_window(const Window *pWindow) const;
 void delete_by_window(const Window *pWindow);
+
+//Convert _ gtk markup to ~ vcl markup
+static OString convertMnemonicMarkup(const OString rIn);
+
 private:
 Window *insertObject(Window *pParent, const OString rClass, const OString 
rID,
 stringmap rProps, stringmap rPangoAttributes);
@@ -189,12 +211,19 @@ private:
 void applyPackingProperty(Window *pCurrent, xmlreader::XmlReader reader);
 void collectProperty(xmlreader::XmlReader reader, const OString rID, 
stringmap rVec);
 void collectPangoAttribute(xmlreader::XmlReader reader, stringmap rMap);
+void collectAccelerator(xmlreader::XmlReader reader, stringmap rMap);
+
+void insertMenuObject(PopupMenu *pParent, const OString rClass, const 
OString rID,
+stringmap rProps, stringmap rAccels);
+void handleMenuChild(PopupMenu *pParent, xmlreader::XmlReader reader);
+void handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader reader);
 
 void handleListStore(xmlreader::XmlReader reader, const OString rID);
 void handleRow(xmlreader::XmlReader reader, const OString rID, sal_Int32 
nRowIndex);
 void handleAdjustment(const OString rID, stringmap rProperties);
 void handleTextBuffer(const OString rID, stringmap rProperties);
 void handleTabChild(Window *pParent, xmlreader::XmlReader reader);
+void handleMenu(xmlreader::XmlReader reader, const OString rID);
 
 PackingData get_window_packing_data(const Window *pWindow) const;
 void set_window_packing_position(const Window *pWindow, sal_Int32 
nPosition);
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 81467f6..39c5e0a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -20,6 +20,7 @@
 #include vcl/layout.hxx
 #include vcl/lstbox.hxx
 #include vcl/menubtn.hxx
+#include vcl/mnemonic.hxx
 #include vcl/prgsbar.hxx
 #include vcl/scrbar.hxx
 #include vcl/svapp.hxx
@@ -234,6 +235,19 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, 
OUString sUIFile, OStri
 delete_by_name(*aI);
 }
 
+//Set button menus when everything has been imported
+for (std::vectorButtonMenuMap::iterator aI = 
m_pParserState-m_aButtonMenuMaps.begin(),
+ aEnd = m_pParserState-m_aButtonMenuMaps.end(); aI != aEnd; ++aI)
+{
+MenuButton *pTarget = getMenuButton(aI-m_sID);
+PopupMenu *pMenu = get_menu_by_name(aI-m_sValue);
+SAL_WARN_IF(!pTarget || !pMenu,
+vcl, missing elements of button/menu);
+if (!pTarget || !pMenu)
+continue;
+pTarget-SetPopupMenu(pMenu);
+}
+
 //Remove ScrollWindow parent widgets whose children in vcl implement 
scrolling
 //internally.
 for (std::mapWindow*, Window*::iterator aI =