summaryrefslogtreecommitdiff
path: root/formula/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-19 13:18:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-05 09:39:11 +0200
commit14cfff500e93f0d6cbf8412065feea85c01ea81d (patch)
tree76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /formula/inc
parentd924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (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 'formula/inc')
-rw-r--r--formula/inc/core_resource.hrc18
-rw-r--r--formula/inc/core_resource.hxx4
-rw-r--r--formula/inc/strings.hrc2
3 files changed, 12 insertions, 12 deletions
diff --git a/formula/inc/core_resource.hrc b/formula/inc/core_resource.hrc
index 01520f582b1b..ba09355ce284 100644
--- a/formula/inc/core_resource.hrc
+++ b/formula/inc/core_resource.hrc
@@ -22,7 +22,7 @@
#include <formula/compiler.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))
/** These English names are used to store/load ODFF as of ODF v1.2. */
// NAMES CAN ONLY BE CHANGED WHEN PROVIDING BACKWARD AND FORWARD COMPATIBILITY
@@ -31,7 +31,7 @@
// If there is a reason for another name for some function then add an
// *additional* name to be recognized to sc/source/core/tool/compiler.cxx
// ScCompiler::IsOpCode() in the if (mxSymbols->isODFF()) block.
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF[] =
+const std::pair<const char *, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF[] =
{
{ "IF" , SC_OPCODE_IF },
{ "IFERROR" , SC_OPCODE_IF_ERROR },
@@ -472,7 +472,7 @@ const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF[] =
};
/** These function names are used in the OOXML XLSX import/export. */
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML[] =
+const std::pair<const char *, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML[] =
{
{ "IF" , SC_OPCODE_IF },
{ "IFERROR" , SC_OPCODE_IF_ERROR },
@@ -922,7 +922,7 @@ const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML[] =
// If there is a reason for another name for some function then add an
// *additional* name to be recognized to sc/source/core/tool/compiler.cxx
// ScCompiler::IsOpCode() in the else if (mxSymbols->isPODF()) block.
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF[] =
+const std::pair<const char *, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF[] =
{
{ "IF" , SC_OPCODE_IF },
{ "IFERROR" , SC_OPCODE_IF_ERROR },
@@ -1373,7 +1373,7 @@ const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_PODF[] =
// If there is a reason for another name for some function then add an
// *additional* name to be recognized to sc/source/core/tool/compiler.cxx
// ScCompiler::IsOpCode().
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_API[] =
+const std::pair<const char *, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_API[] =
{
{ "IF" , SC_OPCODE_IF },
{ "IFERROR" , SC_OPCODE_IF_ERROR },
@@ -1822,7 +1822,7 @@ const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH_API[] =
should match the [en-US] names of RID_STRLIST_FUNCTION_NAMES below. */
// As such they are a duplicate, but we can not have two string localizations
// at the same time.
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH[] =
+const std::pair<const char *, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH[] =
{
{ "IF" , SC_OPCODE_IF },
{ "IFERROR" , SC_OPCODE_IF_ERROR },
@@ -2272,7 +2272,7 @@ const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_ENGLISH[] =
change has to be mentioned in the release notes, i.e.
https://wiki.documentfoundation.org/ReleaseNotes/...
*/
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES[] =
+const std::pair<TranslateId, int> RID_STRLIST_FUNCTION_NAMES[] =
{
{ NC_("RID_STRLIST_FUNCTION_NAMES", "IF") , SC_OPCODE_IF },
{ NC_("RID_STRLIST_FUNCTION_NAMES", "IFERROR") , SC_OPCODE_IF_ERROR },
@@ -2711,10 +2711,10 @@ const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES[] =
{ NC_("RID_STRLIST_FUNCTION_NAMES", "RAND.NV"), SC_OPCODE_RANDOM_NV },
{ NC_("RID_STRLIST_FUNCTION_NAMES", "RANDBETWEEN.NV"), SC_OPCODE_RANDBETWEEN_NV },
- { nullptr, -1 }
+ { {}, -1 }
};
-const std::pair<const char*, int> RID_STRLIST_FUNCTION_NAMES_SYMBOLS[] =
+const std::pair<const char *, int> RID_STRLIST_FUNCTION_NAMES_SYMBOLS[] =
{
{ "(" , SC_OPCODE_OPEN },
{ ")" , SC_OPCODE_CLOSE },
diff --git a/formula/inc/core_resource.hxx b/formula/inc/core_resource.hxx
index f8943f603999..f21d8fb25fd5 100644
--- a/formula/inc/core_resource.hxx
+++ b/formula/inc/core_resource.hxx
@@ -21,8 +21,8 @@
#include <rtl/ustring.hxx>
#include <formula/formuladllapi.h>
-#include <string_view>
+#include <unotools/resmgr.hxx>
-FORMULA_DLLPUBLIC OUString ForResId(std::string_view aId);
+FORMULA_DLLPUBLIC OUString ForResId(TranslateId aId);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/inc/strings.hrc b/formula/inc/strings.hrc
index a54a2f259b95..7bdc7139799a 100644
--- a/formula/inc/strings.hrc
+++ b/formula/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_OPTIONAL NC_("STR_OPTIONAL", "(optional)")
#define STR_REQUIRED NC_("STR_REQUIRED", "(required)")