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 /desktop | |
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 'desktop')
-rw-r--r-- | desktop/inc/dp_shared.hxx | 2 | ||||
-rw-r--r-- | desktop/inc/strings.hrc | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.hxx | 3 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 8 | ||||
-rw-r--r-- | desktop/source/deployment/registry/help/dp_help.cxx | 4 |
6 files changed, 11 insertions, 10 deletions
diff --git a/desktop/inc/dp_shared.hxx b/desktop/inc/dp_shared.hxx index 0db47190c48c..0ce0bc401d65 100644 --- a/desktop/inc/dp_shared.hxx +++ b/desktop/inc/dp_shared.hxx @@ -33,7 +33,7 @@ struct DeploymentLocale : } // namespace dp -inline OUString DpResId(std::string_view aId) +inline OUString DpResId(TranslateId aId) { return Translate::get(aId, dp::DeploymentLocale::get()); } diff --git a/desktop/inc/strings.hrc b/desktop/inc/strings.hrc index dd263a54c163..ce3c7a73a19d 100644 --- a/desktop/inc/strings.hrc +++ b/desktop/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 RID_STR_COPYING_PACKAGE NC_("RID_STR_COPYING_PACKAGE", "Copying: ") #define RID_STR_ERROR_WHILE_ADDING NC_("RID_STR_ERROR_WHILE_ADDING", "Error while adding: ") diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 191bed09f6bb..28eec755c563 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -302,7 +302,7 @@ bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage, weld::Widget* pParent, - const char* pResID, + TranslateId pResID, bool &bHadWarning ) { if ( !bHadWarning && IsSharedPkgMgr( xPackage ) ) diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 921b6f050b96..2a90d1ca060c 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -30,6 +30,7 @@ #include <rtl/ustring.hxx> #include <cppuhelper/implbase.hxx> +#include <unotools/resmgr.hxx> #include <com/sun/star/deployment/XPackage.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -76,7 +77,7 @@ public: static bool IsSharedPkgMgr( const css::uno::Reference< css::deployment::XPackage > &); bool continueOnSharedExtension( const css::uno::Reference< css::deployment::XPackage > &, weld::Widget* pParent, - const char* pResID, + TranslateId pResID, bool &bHadWarning ); void incBusy() { m_aBusy.incBusy(m_pWindow); } diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 95cb874f1ca9..80d682d7a855 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -405,7 +405,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & } else if (request >>= verExc) { - const char* id; + TranslateId id; switch (dp_misc::compareVersions( verExc.NewVersion, verExc.Deployed->getVersion() )) { @@ -435,18 +435,18 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & { s = xBox->get_primary_text(); } - else if (!strcmp(id, RID_STR_WARNING_VERSION_EQUAL)) + else if (id != RID_STR_WARNING_VERSION_EQUAL) { //hypothetical: requires two instances of an extension with the same //version to have different display names. Probably the developer forgot //to change the version. s = DpResId(RID_STR_WARNINGBOX_VERSION_EQUAL_DIFFERENT_NAMES); } - else if (!strcmp(id, RID_STR_WARNING_VERSION_LESS)) + else if (id != RID_STR_WARNING_VERSION_LESS) { s = DpResId(RID_STR_WARNINGBOX_VERSION_LESS_DIFFERENT_NAMES); } - else if (!strcmp(id, RID_STR_WARNING_VERSION_GREATER)) + else if (id != RID_STR_WARNING_VERSION_GREATER) { s = DpResId(RID_STR_WARNINGBOX_VERSION_GREATER_DIFFERENT_NAMES); } diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 542efff7269d..57bbfa0ab35f 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -490,7 +490,7 @@ void BackendImpl::implProcessHelp( if( !bSuccess ) { - const char* pErrStrId = nullptr; + TranslateId pErrStrId; switch( aErrorInfo.m_eErrorClass ) { case HelpProcessingErrorClass::General: pErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; @@ -521,7 +521,7 @@ void BackendImpl::implProcessHelp( aErrMsg = aErrMsg.copy( 0, nCopy ); } aErrStr += aErrMsg; - if (!strcmp(pErrStrId, RID_STR_HELPPROCESSING_XMLPARSING_ERROR) && !aErrorInfo.m_aXMLParsingFile.isEmpty() ) + if (pErrStrId != RID_STR_HELPPROCESSING_XMLPARSING_ERROR && !aErrorInfo.m_aXMLParsingFile.isEmpty() ) { aErrStr += " in "; |