summaryrefslogtreecommitdiff
path: root/uui
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 /uui
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 'uui')
-rw-r--r--uui/inc/ids.hrc6
-rw-r--r--uui/inc/strings.hrc2
-rw-r--r--uui/source/iahndl-ssl.cxx4
-rw-r--r--uui/source/iahndl.cxx2
-rw-r--r--uui/source/iahndl.hxx5
-rw-r--r--uui/source/passworddlg.cxx6
6 files changed, 13 insertions, 12 deletions
diff --git a/uui/inc/ids.hrc b/uui/inc/ids.hrc
index 6ab1882b3611..89fb6bda1dcb 100644
--- a/uui/inc/ids.hrc
+++ b/uui/inc/ids.hrc
@@ -25,9 +25,9 @@
#include "ids.hxx"
-#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*, ErrCode> RID_UUI_ERRHDL[] =
+const std::pair<TranslateId, ErrCode> RID_UUI_ERRHDL[] =
{
{ NC_("RID_UUI_ERRHDL", "The operation executed on $(ARG1) was aborted."),
ERRCODE_UUI_IO_ABORT },
@@ -159,7 +159,7 @@ const std::pair<const char*, ErrCode> RID_UUI_ERRHDL[] =
ERRCODE_UUI_LOCKING_LOCK_EXPIRED },
{ NC_("RID_UUI_ERRHDL", "Component cannot be loaded, possibly broken or incomplete installation.\nFull error message:\n\n $(ARG1)."),
ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY },
- { nullptr, ERRCODE_NONE }
+ { {}, ERRCODE_NONE }
};
#define STR_UUI_UNKNOWNAUTH_UNTRUSTED NC_("STR_UUI_UNKNOWNAUTH_UNTRUSTED", "Unable to verify the identity of $(ARG1) site.\n\nBefore accepting this certificate, you should examine this site's certificate carefully. Are you willing to accept this certificate for the purpose of identifying the Web site $(ARG1)?")
diff --git a/uui/inc/strings.hrc b/uui/inc/strings.hrc
index 096d7ef977a1..8eaa68cb23f6 100644
--- a/uui/inc/strings.hrc
+++ b/uui/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_ENTER_PASSWORD_TO_OPEN NC_("STR_ENTER_PASSWORD_TO_OPEN", "Enter password to open file: \n")
#define STR_ENTER_PASSWORD_TO_MODIFY NC_("STR_ENTER_PASSWORD_TO_MODIFY", "Enter password to modify file: \n")
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index df156bc44e3a..b0bdbb98eb38 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -176,8 +176,8 @@ executeSSLWarnDialog(
// Get correct resource string
std::vector< OUString > aArguments_1;
- char const * pMessageKey = nullptr;
- char const * pTitleKey = nullptr;
+ TranslateId pMessageKey;
+ TranslateId pTitleKey;
switch( failure )
{
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 2897a582c3e9..2c6465c9e0ff 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -1246,7 +1246,7 @@ UUIInteractionHelper::handleBrokenPackageRequest(
// ErrorResource Implementation
bool ErrorResource::getString(ErrCode nErrorCode, OUString &rString) const
{
- for (const std::pair<const char*, ErrCode>* pStringArray = m_pStringArray; pStringArray->first != nullptr; ++pStringArray)
+ for (const std::pair<TranslateId, ErrCode>* pStringArray = m_pStringArray; pStringArray->first; ++pStringArray)
{
if (nErrorCode.StripWarningAndDynamic() == pStringArray->second.StripWarningAndDynamic())
{
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index 8dc828a7dd5f..5a8227b990a5 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/task/InteractionClassification.hpp>
#include <vcl/errcode.hxx>
+#include <unotools/resmgr.hxx>
#include <unordered_map>
#include <vector>
@@ -251,10 +252,10 @@ private:
class ErrorResource
{
- const std::pair<const char*, ErrCode>* m_pStringArray;
+ const std::pair<TranslateId, ErrCode>* m_pStringArray;
const std::locale& m_rResLocale;
public:
- explicit ErrorResource(const std::pair<const char*, ErrCode>* pStringArray, const std::locale& rResLocale)
+ explicit ErrorResource(const std::pair<TranslateId, ErrCode>* pStringArray, const std::locale& rResLocale)
: m_pStringArray(pStringArray)
, m_rResLocale(rResLocale)
{
diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx
index 694e717216b1..fb4c95e623f6 100644
--- a/uui/source/passworddlg.cxx
+++ b/uui/source/passworddlg.cxx
@@ -46,8 +46,8 @@ PasswordDialog::PasswordDialog(weld::Window* pParent,
if( nDialogMode == task::PasswordRequestMode_PASSWORD_REENTER )
{
- const char* pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
- const char* pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId;
+ TranslateId pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
+ TranslateId pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId;
OUString aErrorMsg(Translate::get(pErrStrId, rResLocale));
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg));
@@ -76,7 +76,7 @@ PasswordDialog::PasswordDialog(weld::Window* pParent,
m_xDialog->set_title(aTitle);
- const char* pStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN;
+ TranslateId pStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN;
OUString aMessage(Translate::get(pStrId, rResLocale));
INetURLObject url(aDocURL);