From 14cfff500e93f0d6cbf8412065feea85c01ea81d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 19 Jul 2021 13:18:49 +0200 Subject: 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 --- filter/inc/strings.hrc | 2 +- filter/source/pdf/impdialog.cxx | 2 +- filter/source/t602/t602filter.cxx | 2 +- filter/source/t602/t602filter.hxx | 3 ++- filter/source/xsltdialog/xmlfiltercommon.hxx | 3 ++- filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 2 +- filter/source/xsltdialog/xmlfiltertabdialog.cxx | 7 ++++--- 7 files changed, 12 insertions(+), 9 deletions(-) (limited to 'filter') diff --git a/filter/inc/strings.hrc b/filter/inc/strings.hrc index b1bea27dec47..eecfdb33e2d0 100644 --- a/filter/inc/strings.hrc +++ b/filter/inc/strings.hrc @@ -19,7 +19,7 @@ #pragma once -#define NC_(Context, String) reinterpret_cast(Context "\004" u8##String) +#define NC_(Context, String) TranslateId(Context, reinterpret_cast(u8##String)) #define STR_UNKNOWN_APPLICATION NC_("STR_UNKNOWN_APPLICATION", "Unknown") #define STR_IMPORT_ONLY NC_("STR_IMPORT_ONLY", "import filter") diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index a1a8978e04ff..0e5a4441907e 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -42,7 +42,7 @@ #include #include -static OUString PDFFilterResId(std::string_view aId) +static OUString PDFFilterResId(TranslateId aId) { return Translate::get(aId, Translate::Create("flt")); } diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 8fd52e72fed5..a8df18768b3a 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -1078,7 +1078,7 @@ sal_Int16 SAL_CALL T602ImportFilterDialog::execute() return css::ui::dialogs::ExecutableDialogResults::CANCEL; } -OUString T602ImportFilterDialog::getResStr(const char* resid) +OUString T602ImportFilterDialog::getResStr(TranslateId resid) { return Translate::get(resid, maResLocale); } diff --git a/filter/source/t602/t602filter.hxx b/filter/source/t602/t602filter.hxx index e9ec3a58e4e3..04376a1f3c26 100644 --- a/filter/source/t602/t602filter.hxx +++ b/filter/source/t602/t602filter.hxx @@ -34,6 +34,7 @@ #include #include #include +#include namespace T602ImportFilter { @@ -85,7 +86,7 @@ class T602ImportFilterDialog : public cppu::WeakImplHelper < LanguageTag maLocale; std::locale maResLocale; bool OptionsDlg(); - OUString getResStr(const char* resid); + OUString getResStr(TranslateId resid); virtual ~T602ImportFilterDialog() override; diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index c8b8ea7bfa67..0d340fa12e0f 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -77,6 +78,6 @@ struct application_info_impl extern std::vector< application_info_impl > const & getApplicationInfos(); extern OUString getApplicationUIName( std::u16string_view rServiceName ); extern const application_info_impl* getApplicationInfo( std::u16string_view rServiceName ); -OUString XsltResId(std::string_view pId); +OUString XsltResId(TranslateId pId); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index a31eba952173..66e35f186c5d 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -58,7 +58,7 @@ using namespace com::sun::star::util; using ::rtl::Uri; -OUString XsltResId(std::string_view aId) +OUString XsltResId(TranslateId aId) { return Translate::get(aId, Translate::Create("flt")); } diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 306cf0abf23f..ea73c486ae1f 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "xmlfiltertabdialog.hxx" @@ -69,7 +70,7 @@ bool XMLFilterTabDialog::onOk() mpBasicPage->FillInfo( mpNewInfo.get() ); OString sErrorPage; - const char* pErrorId = nullptr; + TranslateId pErrorId; weld::Widget* pFocusWindow = nullptr; OUString aReplace1; OUString aReplace2; @@ -128,7 +129,7 @@ bool XMLFilterTabDialog::onOk() sal_Int32 nFilter; Sequence< PropertyValue > aValues; - for( nFilter = 0; (nFilter < nCount) && (pErrorId == nullptr); nFilter++, pFilterName++ ) + for( nFilter = 0; (nFilter < nCount) && !pErrorId; nFilter++, pFilterName++ ) { Any aAny( xFilterContainer->getByName( *pFilterName ) ); if( !(aAny >>= aValues) ) @@ -138,7 +139,7 @@ bool XMLFilterTabDialog::onOk() PropertyValue* pValues = aValues.getArray(); sal_Int32 nValue; - for( nValue = 0; (nValue < nValueCount) && (pErrorId == nullptr); nValue++, pValues++ ) + for( nValue = 0; (nValue < nValueCount) && !pErrorId; nValue++, pValues++ ) { if ( pValues->Name == "UIName" ) { -- cgit