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 /svx/inc | |
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 'svx/inc')
-rw-r--r-- | svx/inc/DescriptionGenerator.hxx | 3 | ||||
-rw-r--r-- | svx/inc/fieldunit.hrc | 4 | ||||
-rw-r--r-- | svx/inc/fmstring.hrc | 4 | ||||
-rw-r--r-- | svx/inc/formnavi.hrc | 4 | ||||
-rw-r--r-- | svx/inc/frmsel.hrc | 6 | ||||
-rw-r--r-- | svx/inc/inspectorvalues.hrc | 4 | ||||
-rw-r--r-- | svx/inc/numberingtype.hrc | 4 | ||||
-rw-r--r-- | svx/inc/rotationstrings.hrc | 4 | ||||
-rw-r--r-- | svx/inc/samecontent.hrc | 4 | ||||
-rw-r--r-- | svx/inc/spacing.hrc | 12 | ||||
-rw-r--r-- | svx/inc/svxerr.hrc | 6 | ||||
-rw-r--r-- | svx/inc/swframeposstrings.hrc | 4 | ||||
-rw-r--r-- | svx/inc/tabwin.hrc | 4 | ||||
-rw-r--r-- | svx/inc/txenctab.hrc | 4 |
14 files changed, 34 insertions, 33 deletions
diff --git a/svx/inc/DescriptionGenerator.hxx b/svx/inc/DescriptionGenerator.hxx index daf169f9b478..8b3ac3f5cac2 100644 --- a/svx/inc/DescriptionGenerator.hxx +++ b/svx/inc/DescriptionGenerator.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <rtl/ustrbuf.hxx> +#include <unotools/resmgr.hxx> namespace com::sun::star::beans { @@ -75,7 +76,7 @@ public: shape that is made more specific by later calls to <member>addProperty</member>. */ - void Initialize(const char* pResourceId); + void Initialize(TranslateId pResourceId); /** Returns the description string and then resets it. Usually called as last method before destroying the object. diff --git a/svx/inc/fieldunit.hrc b/svx/inc/fieldunit.hrc index f16238550efe..28c160c7fcf0 100644 --- a/svx/inc/fieldunit.hrc +++ b/svx/inc/fieldunit.hrc @@ -23,9 +23,9 @@ #include <tools/fldunit.hxx> #include <utility> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const std::pair<const char*, FieldUnit> RID_SVXSTR_FIELDUNIT_TABLE[] = +const std::pair<TranslateId, FieldUnit> RID_SVXSTR_FIELDUNIT_TABLE[] = { { NC_("RID_SVXSTR_FIELDUNIT_TABLE", "Millimeter") , FieldUnit::MM }, { NC_("RID_SVXSTR_FIELDUNIT_TABLE", "Centimeter") , FieldUnit::CM }, diff --git a/svx/inc/fmstring.hrc b/svx/inc/fmstring.hrc index 7a78d0ae2623..08f78b7f2cc3 100644 --- a/svx/inc/fmstring.hrc +++ b/svx/inc/fmstring.hrc @@ -20,9 +20,9 @@ #ifndef INCLUDED_SVX_INC_FMSTRING_HRC #define INCLUDED_SVX_INC_FMSTRING_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const char* RID_RSC_SQL_INTERNATIONAL[] = +const TranslateId RID_RSC_SQL_INTERNATIONAL[] = { NC_("RID_RSC_SQL_INTERNATIONAL", "LIKE"), NC_("RID_RSC_SQL_INTERNATIONAL", "NOT"), diff --git a/svx/inc/formnavi.hrc b/svx/inc/formnavi.hrc index f105cca63292..3326bc69517c 100644 --- a/svx/inc/formnavi.hrc +++ b/svx/inc/formnavi.hrc @@ -20,9 +20,9 @@ #ifndef INCLUDED_SVX_INC_FRMSEL_HRC #define INCLUDED_SVX_INC_FRMSEL_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const char* RID_SVXSW_CONVERTMENU[] = +const TranslateId RID_SVXSW_CONVERTMENU[] = { NC_("RID_SVXSW_CONVERTMENU|ConvertToEdit", "~Text Box"), NC_("RID_SVXSW_CONVERTMENU|ConvertToButton", "~Button"), diff --git a/svx/inc/frmsel.hrc b/svx/inc/frmsel.hrc index 893d84de2faa..147d4fa9cb08 100644 --- a/svx/inc/frmsel.hrc +++ b/svx/inc/frmsel.hrc @@ -23,9 +23,9 @@ #include <utility> #include <sal/types.h> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -std::pair<const char*, sal_uInt16> RID_SVXSTR_FRMSEL_TEXTS[] = +std::pair<TranslateId, sal_uInt16> RID_SVXSTR_FRMSEL_TEXTS[] = { { NC_("RID_SVXSTR_FRMSEL_TEXTS", "Border setting") , 0 }, { NC_("RID_SVXSTR_FRMSEL_TEXTS", "Left border line") , 1 }, @@ -38,7 +38,7 @@ std::pair<const char*, sal_uInt16> RID_SVXSTR_FRMSEL_TEXTS[] = { NC_("RID_SVXSTR_FRMSEL_TEXTS", "Diagonal border line from bottom left to top right") , 8 }, }; -std::pair<const char*, sal_uInt16> RID_SVXSTR_FRMSEL_DESCRIPTIONS[] = +std::pair<TranslateId, sal_uInt16> RID_SVXSTR_FRMSEL_DESCRIPTIONS[] = { { NC_("RID_SVXSTR_FRMSEL_DESCRIPTIONS", "Border setting") , 0 }, { NC_("RID_SVXSTR_FRMSEL_DESCRIPTIONS", "Left border line") , 1 }, diff --git a/svx/inc/inspectorvalues.hrc b/svx/inc/inspectorvalues.hrc index 863b13b899e8..0c09dc4a060d 100644 --- a/svx/inc/inspectorvalues.hrc +++ b/svx/inc/inspectorvalues.hrc @@ -9,8 +9,8 @@ #pragma once -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) -#define NNC_(Context, StringSingular, StringPlural) reinterpret_cast<char const *>(Context "\004" u8##StringSingular "\004" u8##StringPlural) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) +#define NNC_(Context, StringSingular, StringPlural) TranslateNId(Context, reinterpret_cast<char const *>(u8##StringSingular), reinterpret_cast<char const *>(u8##StringPlural)) /*-------------------------------------------------------------------- Description: API names for Paragraph, Character diff --git a/svx/inc/numberingtype.hrc b/svx/inc/numberingtype.hrc index 7181aeb385e9..404a7534e00b 100644 --- a/svx/inc/numberingtype.hrc +++ b/svx/inc/numberingtype.hrc @@ -22,9 +22,9 @@ #include <utility> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const std::pair<const char*, int> RID_SVXSTRARY_NUMBERINGTYPE[] = +const std::pair<TranslateId, int> RID_SVXSTRARY_NUMBERINGTYPE[] = { { /* SVX_NUM_NUMBER_NONE */ NC_("RID_SVXSTRARY_NUMBERINGTYPE", "None") , 5 }, { /* SVX_NUM_CHAR_SPECIAL */ NC_("RID_SVXSTRARY_NUMBERINGTYPE", "Bullet") , 6 }, diff --git a/svx/inc/rotationstrings.hrc b/svx/inc/rotationstrings.hrc index 229f2bee53c5..bb9a81c6b68b 100644 --- a/svx/inc/rotationstrings.hrc +++ b/svx/inc/rotationstrings.hrc @@ -10,9 +10,9 @@ #ifndef INCLUDED_SVX_INC_ROTATIONSTRINGS_HRC #define INCLUDED_SVX_INC_ROTATIONSTRINGS_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const char* RID_SVXITEMS_ROTATE_MODE[] = +const TranslateId RID_SVXITEMS_ROTATE_MODE[] = { // enum SvxRotateMode ---------------------------------------------------- NC_("RID_SVXITEMS_ROTATE_MODE_STANDARD", "Rotation only within cell"), diff --git a/svx/inc/samecontent.hrc b/svx/inc/samecontent.hrc index b4a6bc8d667d..99ff7a37c040 100644 --- a/svx/inc/samecontent.hrc +++ b/svx/inc/samecontent.hrc @@ -11,9 +11,9 @@ #include <utility> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const std::pair<const char*, int> RID_SVXSTRARY_SAMECONTENT[] = +const std::pair<TranslateId, int> RID_SVXSTRARY_SAMECONTENT[] = { { NC_("RID_SVXSTRARY_SAMECONTENT", "All Pages"), 0 }, { NC_("RID_SVXSTRARY_SAMECONTENT", "First Page"), 1 }, diff --git a/svx/inc/spacing.hrc b/svx/inc/spacing.hrc index 8c9ba6da29a2..280e534b4896 100644 --- a/svx/inc/spacing.hrc +++ b/svx/inc/spacing.hrc @@ -9,11 +9,11 @@ #ifndef INCLUDED_SVX_INC_SPACING_HRC #define INCLUDED_SVX_INC_SPACING_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) struct measurement { - const char* key; + TranslateId key; int twips; int human; }; @@ -29,7 +29,7 @@ const measurement RID_SVXSTRARY_SPACING_INCH[] = { NC_("RID_SVXSTRARY_SPACING_INCH", "Medium Large (1/2″)"), 720, 0 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Large (3/4″)"), 1077, 0 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Extra Large (1″)"), 1440, 0 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; // To translators: this is a listbox labelled by "Spacing:", cm units @@ -50,7 +50,7 @@ const measurement RID_SVXSTRARY_SPACING_CM[] = { NC_("RID_SVXSTRARY_SPACING_CM", "Large (%1)"), 1077, 190 }, // Extra Large (2.54 cm) { NC_("RID_SVXSTRARY_SPACING_CM", "Extra Large (%1)"), 1440, 254 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; // To translators: this is a listbox labelled by "Margins:", inch units @@ -64,7 +64,7 @@ const measurement RID_SVXSTRARY_MARGINS_INCH[] = { NC_("RID_SVXSTRARY_MARGINS_INCH", "Medium Large (1/2″)"), 720, 0 }, { NC_("RID_SVXSTRARY_MARGINS_INCH", "Large (3/4″)"), 1077, 0 }, { NC_("RID_SVXSTRARY_MARGINS_INCH", "Extra Large (1″)"), 1440, 0 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; // To translators: this is a listbox labelled by "Margins:", cm units @@ -85,7 +85,7 @@ const measurement RID_SVXSTRARY_MARGINS_CM[] = { NC_("RID_SVXSTRARY_MARGINS_CM", "Large (%1)"), 1077, 190 }, // Extra Large (2.54 cm) { NC_("RID_SVXSTRARY_MARGINS_CM", "Extra Large (%1)"), 1440, 254 }, - { nullptr, 0, 0 } + { {}, 0, 0 } }; #endif diff --git a/svx/inc/svxerr.hrc b/svx/inc/svxerr.hrc index 9691386c94e7..40066df41531 100644 --- a/svx/inc/svxerr.hrc +++ b/svx/inc/svxerr.hrc @@ -20,7 +20,7 @@ #ifndef INCLUDED_SVX_INC_SVXERR_HRC #define INCLUDED_SVX_INC_SVXERR_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) #include <svx/svxerr.hxx> #include <editeng/editerr.hxx> @@ -40,7 +40,7 @@ const ErrMsgCode RID_SVXERRCTX[] = ErrCode(ERRCTX_SVX_BACKGROUND) }, { NC_("RID_SVXERRCTX", "$(ERR) loading the graphics.") , ErrCode(ERRCTX_SVX_IMPORT_GRAPHIC) }, - { nullptr, ERRCODE_NONE } + { {}, ERRCODE_NONE } }; // Error-Code ------------------------------------------------------------ @@ -70,7 +70,7 @@ const ErrMsgCode RID_SVXERRCODE[] = ERRCODE_SVX_READ_FILTER_PPOINT }, { NC_("RID_SVXERRCODE", "Password protection is not supported when documents are saved in a Microsoft Office format.\nDo you want to save the document without password protection?"), ERRCODE_SVX_EXPORT_FILTER_CRYPT }, - { nullptr, ERRCODE_NONE } + { {}, ERRCODE_NONE } }; #endif diff --git a/svx/inc/swframeposstrings.hrc b/svx/inc/swframeposstrings.hrc index 1d3da664b208..b89608350e32 100644 --- a/svx/inc/swframeposstrings.hrc +++ b/svx/inc/swframeposstrings.hrc @@ -20,10 +20,10 @@ #ifndef INCLUDED_SVX_INC_SWFRAMEPOSSTRINGS_HRC #define INCLUDED_SVX_INC_SWFRAMEPOSSTRINGS_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) //the following string have to match the (enum values) positions in svx/swframeposstrings.hxx! -const char* RID_SVXSW_FRAMEPOSITIONS[] = +const TranslateId RID_SVXSW_FRAMEPOSITIONS[] = { NC_("RID_SVXSW_FRAMEPOSITIONS", "Left"), NC_("RID_SVXSW_FRAMEPOSITIONS", "Right"), diff --git a/svx/inc/tabwin.hrc b/svx/inc/tabwin.hrc index 8ab1888038da..dd609a5bcb58 100644 --- a/svx/inc/tabwin.hrc +++ b/svx/inc/tabwin.hrc @@ -20,9 +20,9 @@ #ifndef INCLUDED_SVX_INC_TABWIN_HRC #define INCLUDED_SVX_INC_TABWIN_HRC -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) -const char* RID_RSC_TABWIN_PREFIX[] = +const TranslateId RID_RSC_TABWIN_PREFIX[] = { NC_("RID_RSC_TABWIN_PREFIX", "Table"), NC_("RID_RSC_TABWIN_PREFIX", "Query"), diff --git a/svx/inc/txenctab.hrc b/svx/inc/txenctab.hrc index e7171fbd1097..e140015a7eb3 100644 --- a/svx/inc/txenctab.hrc +++ b/svx/inc/txenctab.hrc @@ -23,11 +23,11 @@ #include <rtl/textenc.h> #include <utility> -#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) // Encodings for which no conversion exist yet are commented out. -const std::pair<const char*, rtl_TextEncoding> RID_SVXSTR_TEXTENCODING_TABLE[] = +const std::pair<TranslateId, rtl_TextEncoding> RID_SVXSTR_TEXTENCODING_TABLE[] = { { NC_("RID_SVXSTR_TEXTENCODING_TABLE", "Western Europe (Windows-1252/WinLatin 1)") , RTL_TEXTENCODING_MS_1252 }, { NC_("RID_SVXSTR_TEXTENCODING_TABLE", "Western Europe (Apple Macintosh)") , RTL_TEXTENCODING_APPLE_ROMAN }, |