diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 13:18:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-05 09:39:11 +0200 |
commit | 14cfff500e93f0d6cbf8412065feea85c01ea81d (patch) | |
tree | 76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /fpicker | |
parent | d924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (diff) |
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and
joining of strings like this.
Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r-- | fpicker/inc/fpsofficeResMgr.hxx | 5 | ||||
-rw-r--r-- | fpicker/inc/strings.hrc | 2 | ||||
-rw-r--r-- | fpicker/source/aqua/resourceprovider.mm | 8 | ||||
-rw-r--r-- | fpicker/source/office/iodlg.cxx | 4 | ||||
-rw-r--r-- | fpicker/source/win32/resourceprovider.cxx | 8 |
5 files changed, 12 insertions, 15 deletions
diff --git a/fpicker/inc/fpsofficeResMgr.hxx b/fpicker/inc/fpsofficeResMgr.hxx index 3393f8afa95a..a86a91509c38 100644 --- a/fpicker/inc/fpsofficeResMgr.hxx +++ b/fpicker/inc/fpsofficeResMgr.hxx @@ -10,9 +10,6 @@ #include <unotools/resmgr.hxx> -inline OUString FpsResId(std::string_view aId) -{ - return Translate::get(aId, Translate::Create("fps")); -}; +inline OUString FpsResId(TranslateId aId) { return Translate::get(aId, Translate::Create("fps")); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/fpicker/inc/strings.hrc b/fpicker/inc/strings.hrc index 6037da706828..042ea35c44ce 100644 --- a/fpicker/inc/strings.hrc +++ b/fpicker/inc/strings.hrc @@ -19,7 +19,7 @@ #pragma once -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) #define STR_EXPLORERFILE_OPEN NC_("STR_EXPLORERFILE_OPEN", "Open") #define STR_EXPLORERFILE_SAVE NC_("STR_EXPLORERFILE_SAVE", "Save as") diff --git a/fpicker/source/aqua/resourceprovider.mm b/fpicker/source/aqua/resourceprovider.mm index 4daa24b9ff07..34b0359a231d 100644 --- a/fpicker/source/aqua/resourceprovider.mm +++ b/fpicker/source/aqua/resourceprovider.mm @@ -42,7 +42,7 @@ namespace { struct Entry { sal_Int32 ctrlId; - const char* resId; + TranslateId resId; }; } @@ -71,9 +71,9 @@ Entry const CtrlIdToResIdTable[] = { const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); -static const char* CtrlIdToResId(sal_Int32 aControlId) +static TranslateId CtrlIdToResId(sal_Int32 aControlId) { - const char *pResId = nullptr; + TranslateId pResId; for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ ) { @@ -94,7 +94,7 @@ namespace CResourceProvider_Impl OUString aResString; // translate the control id to a resource id - const char* pResId = CtrlIdToResId(aId); + TranslateId pResId = CtrlIdToResId(aId); if (pResId) aResString = FpsResId(pResId); diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 1f94a58436ae..6d863e1d2f3f 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -378,8 +378,8 @@ SvtFileDialog::SvtFileDialog(weld::Window* pParent, PickerFlags nStyle) AddControls_Impl( ); // adjust the labels to the mode - const char* pResId = STR_EXPLORERFILE_OPEN; - const char* pButtonResId = nullptr; + TranslateId pResId = STR_EXPLORERFILE_OPEN; + TranslateId pButtonResId; if ( nStyle & PickerFlags::SaveAs ) { diff --git a/fpicker/source/win32/resourceprovider.cxx b/fpicker/source/win32/resourceprovider.cxx index 883edf36dff2..ff841b385b26 100644 --- a/fpicker/source/win32/resourceprovider.cxx +++ b/fpicker/source/win32/resourceprovider.cxx @@ -46,7 +46,7 @@ namespace { struct Entry { sal_Int32 ctrlId; - const char* resId; + TranslateId resId; }; } @@ -71,9 +71,9 @@ Entry const CtrlIdToResIdTable[] = { const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable ); -static const char* CtrlIdToResId( sal_Int32 aControlId ) +static TranslateId CtrlIdToResId( sal_Int32 aControlId ) { - const char* pResId = nullptr; + TranslateId pResId; for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ ) { @@ -93,7 +93,7 @@ namespace CResourceProvider { OUString aResOUString; // translate the control id to a resource id - const char *pResId = CtrlIdToResId(aId); + TranslateId pResId = CtrlIdToResId(aId); if (pResId) aResOUString = FpsResId(pResId); return aResOUString; |