summaryrefslogtreecommitdiff
path: root/chart2
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 /chart2
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 'chart2')
-rw-r--r--chart2/inc/chart.hrc4
-rw-r--r--chart2/inc/strings.hrc2
-rw-r--r--chart2/source/controller/dialogs/dlg_CreationWizard.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.cxx6
-rw-r--r--chart2/source/controller/dialogs/tp_Scale.hxx3
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx2
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx2
-rw-r--r--chart2/source/inc/ResId.hxx4
-rw-r--r--chart2/source/tools/ResId.cxx3
9 files changed, 14 insertions, 14 deletions
diff --git a/chart2/inc/chart.hrc b/chart2/inc/chart.hrc
index 4620a78be366..a43ce2a78993 100644
--- a/chart2/inc/chart.hrc
+++ b/chart2/inc/chart.hrc
@@ -9,9 +9,9 @@
#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))
-const char* CHART_TYPE[] =
+const TranslateId CHART_TYPE[] =
{
NC_("tp_ChartType|liststore1", "Bar"),
NC_("tp_ChartType|liststore1", "Cylinder"),
diff --git a/chart2/inc/strings.hrc b/chart2/inc/strings.hrc
index 163b0f44e902..ab6ca48c8376 100644
--- a/chart2/inc/strings.hrc
+++ b/chart2/inc/strings.hrc
@@ -19,7 +19,7 @@
#ifndef CHART_STRINGS_HRC
#define CHART_STRINGS_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))
#define STR_DLG_CHART_WIZARD NC_("STR_DLG_CHART_WIZARD", "Chart Wizard")
#define STR_DLG_SMOOTH_LINE_PROPERTIES NC_("STR_DLG_SMOOTH_LINE_PROPERTIES", "Smooth Lines")
diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
index da073c2f9956..e35dfb8a166e 100644
--- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
+++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx
@@ -171,7 +171,7 @@ void CreationWizard::setValidPage(BuilderPage* pTabPage)
OUString CreationWizard::getStateDisplayName( WizardState nState ) const
{
- const char* pResId = nullptr;
+ TranslateId pResId;
switch( nState )
{
case STATE_CHARTTYPE:
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index db2ba248ee8e..e605b17c9891 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -395,7 +395,7 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
nStepFmt = 0;
weld::Widget* pControl = nullptr;
- const char* pErrStrId = nullptr;
+ TranslateId pErrStrId;
double fDummy;
fMax = m_xFmtFldMax->GetFormatter().GetValue();
@@ -583,9 +583,9 @@ void ScaleTabPage::ShowAxisOrigin( bool bShowOrigin )
m_bShowAxisOrigin = true;
}
-bool ScaleTabPage::ShowWarning(const char* pResIdMessage, weld::Widget* pControl /* = nullptr */)
+bool ScaleTabPage::ShowWarning(TranslateId pResIdMessage, weld::Widget* pControl /* = nullptr */)
{
- if (pResIdMessage == nullptr)
+ if (!pResIdMessage)
return false;
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx
index 101e6df1cede..b90d3ef20211 100644
--- a/chart2/source/controller/dialogs/tp_Scale.hxx
+++ b/chart2/source/controller/dialogs/tp_Scale.hxx
@@ -19,6 +19,7 @@
#pragma once
#include <sfx2/tabdlg.hxx>
+#include <unotools/resmgr.hxx>
namespace chart
{
@@ -98,7 +99,7 @@ private:
@return false, if nResIdMessage was 0, true otherwise
*/
- bool ShowWarning(const char* pResIdMessage, weld::Widget* pControl);
+ bool ShowWarning(TranslateId pResIdMessage, weld::Widget* pControl);
void HideAllControls();
};
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 093cbcdaeac8..0515bc84ccb7 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -725,7 +725,7 @@ bool ChartController::executeDispatch_Delete()
ObjectIdentifier::getObjectPropertySet( aCID, getModel() ));
if( xErrorBarProp.is())
{
- const char* pId;
+ TranslateId pId;
if ( aObjectType == OBJECTTYPE_DATA_ERRORS_X )
pId = STR_OBJECT_ERROR_BARS_X;
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 545f600f36a2..1de375c1f281 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -73,7 +73,7 @@ bool DrawCommandDispatch::isFeatureSupported( const OUString& rCommandURL )
return parseCommandURL( rCommandURL, &nFeatureId, &aBaseCommand, &aCustomShapeType );
}
-static ::basegfx::B2DPolyPolygon getPolygon(const char* pResId, const SdrModel& rModel)
+static ::basegfx::B2DPolyPolygon getPolygon(TranslateId pResId, const SdrModel& rModel)
{
::basegfx::B2DPolyPolygon aReturn;
XLineEndListRef pLineEndList = rModel.GetLineEndList();
diff --git a/chart2/source/inc/ResId.hxx b/chart2/source/inc/ResId.hxx
index 91dc561e2cb9..48baf852ab04 100644
--- a/chart2/source/inc/ResId.hxx
+++ b/chart2/source/inc/ResId.hxx
@@ -20,11 +20,11 @@
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
-#include <string_view>
+#include <unotools/resmgr.hxx>
namespace chart
{
-OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(std::string_view aId);
+OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(TranslateId aId);
} // namespace chart
diff --git a/chart2/source/tools/ResId.cxx b/chart2/source/tools/ResId.cxx
index 7a19075a57b3..aaa1d840c95c 100644
--- a/chart2/source/tools/ResId.cxx
+++ b/chart2/source/tools/ResId.cxx
@@ -18,11 +18,10 @@
*/
#include <ResId.hxx>
-#include <unotools/resmgr.hxx>
namespace chart
{
- OUString SchResId(std::string_view aId)
+ OUString SchResId(TranslateId aId)
{
return Translate::get(aId, Translate::Create("chart"));
}