summaryrefslogtreecommitdiff
path: root/sfx2
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 /sfx2
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 'sfx2')
-rw-r--r--sfx2/inc/dinfdlg.hrc6
-rw-r--r--sfx2/inc/doctempl.hrc4
-rw-r--r--sfx2/source/appl/opengrf.cxx2
-rw-r--r--sfx2/source/bastyp/sfxresid.cxx3
-rw-r--r--sfx2/source/control/msgpool.cxx6
-rw-r--r--sfx2/source/devtools/DevToolsStrings.hrc3
-rw-r--r--sfx2/source/dialog/styfitem.cxx4
-rw-r--r--sfx2/source/doc/doctempl.cxx2
-rw-r--r--sfx2/source/doc/doctemplates.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx2
10 files changed, 17 insertions, 17 deletions
diff --git a/sfx2/inc/dinfdlg.hrc b/sfx2/inc/dinfdlg.hrc
index a99ead5b6b91..5b838ce56652 100644
--- a/sfx2/inc/dinfdlg.hrc
+++ b/sfx2/inc/dinfdlg.hrc
@@ -20,9 +20,9 @@
#ifndef INCLUDED_SFX2_INC_DINFDLG_HRC
#define INCLUDED_SFX2_INC_DINFDLG_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* SFX_CB_PROPERTY_STRINGARRAY[] =
+const TranslateId SFX_CB_PROPERTY_STRINGARRAY[] =
{
NC_("SFX_CB_PROPERTY_STRINGARRAY", "Checked by"),
NC_("SFX_CB_PROPERTY_STRINGARRAY", "Client"),
@@ -64,7 +64,7 @@ const char* SFX_CB_PROPERTY_STRINGARRAY[] =
#define CUSTOM_TYPE_DURATION 5
#define CUSTOM_TYPE_DATETIME 6
-const std::pair<const char*, int> SFX_LB_PROPERTY_STRINGARRAY[] =
+const std::pair<TranslateId, int> SFX_LB_PROPERTY_STRINGARRAY[] =
{
{ NC_("SFX_CB_PROPERTY_STRINGARRAY", "Text") , CUSTOM_TYPE_TEXT },
{ NC_("SFX_CB_PROPERTY_STRINGARRAY", "DateTime") , CUSTOM_TYPE_DATETIME },
diff --git a/sfx2/inc/doctempl.hrc b/sfx2/inc/doctempl.hrc
index 46773035e9b7..ef2310d860de 100644
--- a/sfx2/inc/doctempl.hrc
+++ b/sfx2/inc/doctempl.hrc
@@ -20,9 +20,9 @@
#ifndef INCLUDED_SFX2_INC_DOCTEMPL_HRC
#define INCLUDED_SFX2_INC_DOCTEMPL_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* TEMPLATE_LONG_NAMES_ARY[] =
+const TranslateId TEMPLATE_LONG_NAMES_ARY[] =
{
NC_("TEMPLATE_LONG_NAMES_ARY", "My Templates"),
NC_("TEMPLATE_LONG_NAMES_ARY", "Styles"),
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 59bf0e13c261..325c50422479 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -46,7 +46,7 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
using namespace ::cppu;
-static const char* SvxOpenGrfErr2ResId( ErrCode err )
+static TranslateId SvxOpenGrfErr2ResId( ErrCode err )
{
if (err == ERRCODE_GRFILTER_OPENERROR)
return RID_SVXSTR_GRFILTER_OPENERROR;
diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx
index 2c60a31fe6e8..1bc6d68bbee4 100644
--- a/sfx2/source/bastyp/sfxresid.cxx
+++ b/sfx2/source/bastyp/sfxresid.cxx
@@ -18,8 +18,7 @@
*/
#include <sfx2/sfxresid.hxx>
-#include <unotools/resmgr.hxx>
-OUString SfxResId(std::string_view aId) { return Translate::get(aId, Translate::Create("sfx")); }
+OUString SfxResId(TranslateId aId) { return Translate::get(aId, Translate::Create("sfx")); }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index be4ebdaa67f9..f7a94203e6b7 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -51,7 +51,7 @@ SfxSlotPool::~SfxSlotPool()
namespace
{
- const char* getGidResId(SfxGroupId nId)
+ TranslateId getGidResId(SfxGroupId nId)
{
if (nId == SfxGroupId::Intern)
return STR_GID_INTERN;
@@ -105,7 +105,7 @@ namespace
return STR_GID_DRAWING;
else if (nId == SfxGroupId::Controls)
return STR_GID_CONTROLS;
- return nullptr;
+ return {};
}
}
@@ -193,7 +193,7 @@ OUString SfxSlotPool::SeekGroup( sal_uInt16 nNo )
}
}
- const char* pResId = getGidResId(_vGroups[_nCurGroup]);
+ TranslateId pResId = getGidResId(_vGroups[_nCurGroup]);
if (!pResId)
{
OSL_FAIL( "GroupId-Name not defined in SFX!" );
diff --git a/sfx2/source/devtools/DevToolsStrings.hrc b/sfx2/source/devtools/DevToolsStrings.hrc
index 764ae78712a0..4c3f3e9ceb33 100644
--- a/sfx2/source/devtools/DevToolsStrings.hrc
+++ b/sfx2/source/devtools/DevToolsStrings.hrc
@@ -9,7 +9,8 @@
*/
#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_TEXT_PORTION NC_("STR_TEXT_PORTION", "Text Portion %1")
#define STR_PARAGRAPH NC_("STR_PARAGRAPH", "Paragraph %1")
diff --git a/sfx2/source/dialog/styfitem.cxx b/sfx2/source/dialog/styfitem.cxx
index 5ae3017260eb..489c4d2df5e5 100644
--- a/sfx2/source/dialog/styfitem.cxx
+++ b/sfx2/source/dialog/styfitem.cxx
@@ -22,12 +22,12 @@
SfxStyleFamilyItem::SfxStyleFamilyItem(
SfxStyleFamily nFamily_, const OUString& rName, const OUString& rImage,
- const std::pair<const char*, SfxStyleSearchBits>* pStringArray, const std::locale& rResLocale)
+ const std::pair<TranslateId, SfxStyleSearchBits>* pStringArray, const std::locale& rResLocale)
: nFamily(nFamily_)
, aText(rName)
, aImage(rImage)
{
- for (const std::pair<const char*, SfxStyleSearchBits>* pItem = pStringArray; pItem->first;
+ for (const std::pair<TranslateId, SfxStyleSearchBits>* pItem = pStringArray; pItem->first;
++pItem)
aFilterList.emplace_back(Translate::get(pItem->first, rResLocale), pItem->second);
}
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index b4de76f63a38..bc2a2b34570c 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -494,7 +494,7 @@ OUString SfxDocumentTemplates::ConvertResourceString(const OUString& rString)
u"" STR_TEMPLATE_NAME30_DEF
};
- const char* STR_TEMPLATE_NAME[] =
+ TranslateId STR_TEMPLATE_NAME[] =
{
STR_TEMPLATE_NAME1,
STR_TEMPLATE_NAME2,
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index a35ce5269782..f381b8b7bcf1 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -2740,7 +2740,7 @@ OUString DocTemplLocaleHelper::GetStandardGroupString()
std::vector<OUString> DocTemplLocaleHelper::GetBuiltInGroupNames()
{
std::vector<OUString> aGroups;
- for(auto aGroupName : TEMPLATE_LONG_NAMES_ARY)
+ for(auto const & aGroupName : TEMPLATE_LONG_NAMES_ARY)
aGroups.push_back(SfxResId(aGroupName));
return aGroups;
}
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 75b77ef2cd2e..e7c9001e5b49 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3026,7 +3026,7 @@ HiddenInformation SfxObjectShell::GetHiddenInformationState( HiddenInformation n
sal_Int16 SfxObjectShell::QueryHiddenInformation(HiddenWarningFact eFact, weld::Window* pParent)
{
sal_Int16 nRet = RET_YES;
- const char* pResId = nullptr;
+ TranslateId pResId;
SvtSecurityOptions::EOption eOption = SvtSecurityOptions::EOption();
switch ( eFact )