diff options
Diffstat (limited to 'vcl/source/control/button.cxx')
-rw-r--r-- | vcl/source/control/button.cxx | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index aed5ef25a4ef..bf0432c2e143 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -37,7 +37,7 @@ #include <vcl/vclstatuslistener.hxx> #include <vcl/uitest/uiobject.hxx> -#include <svids.hrc> +#include <strings.hrc> #include <bitmaps.hlst> #include <svdata.hxx> #include <window.h> @@ -122,46 +122,32 @@ void Button::Click() ImplCallEventListenersAndHandler( VclEventId::ButtonClick, [this] () { maClickHdl.Call(this); } ); } -OUString Button::GetStandardText( StandardButtonType eButton ) +OUString Button::GetStandardText(StandardButtonType eButton) { - static struct + static const char* aResIdAry[static_cast<int>(StandardButtonType::Count)] = { - sal_uInt32 nResId; - const char* pDefText; - } aResIdAry[static_cast<int>(StandardButtonType::Count)] = - { - { SV_BUTTONTEXT_OK, "~OK" }, - { SV_BUTTONTEXT_CANCEL, "~Cancel" }, - { SV_BUTTONTEXT_YES, "~Yes" }, - { SV_BUTTONTEXT_NO, "~No" }, - { SV_BUTTONTEXT_RETRY, "~Retry" }, - { SV_BUTTONTEXT_HELP, "~Help" }, - { SV_BUTTONTEXT_CLOSE, "~Close" }, - { SV_BUTTONTEXT_MORE, "~More" }, - { SV_BUTTONTEXT_IGNORE, "~Ignore" }, - { SV_BUTTONTEXT_ABORT, "~Abort" }, - { SV_BUTTONTEXT_LESS, "~Less" } - }; - - ResMgr* pResMgr = ImplGetResMgr(); - - if (!pResMgr) - { - OString aT( aResIdAry[(sal_uInt16)eButton].pDefText ); - return OStringToOUString(aT, RTL_TEXTENCODING_ASCII_US); - } - - sal_uInt32 nResId = aResIdAry[(sal_uInt16)eButton].nResId; + // 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 #ifdef _WIN32 - // 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; + SV_BUTTONTEXT_OK_NOMNEMONIC, + SV_BUTTONTEXT_CANCEL_NOMNEMONIC, +#else + SV_BUTTONTEXT_OK, + SV_BUTTONTEXT_CANCEL, #endif - return ResId(nResId, *pResMgr); + SV_BUTTONTEXT_YES, + SV_BUTTONTEXT_NO, + SV_BUTTONTEXT_RETRY, + SV_BUTTONTEXT_HELP, + SV_BUTTONTEXT_CLOSE, + SV_BUTTONTEXT_MORE, + SV_BUTTONTEXT_IGNORE, + SV_BUTTONTEXT_ABORT, + SV_BUTTONTEXT_LESS, + }; + + return VclResId(aResIdAry[(sal_uInt16)eButton]); } bool Button::SetModeImage( const Image& rImage ) |