summaryrefslogtreecommitdiff
path: root/editeng
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 /editeng
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 'editeng')
-rw-r--r--editeng/inc/strings.hrc8
-rw-r--r--editeng/source/editeng/eerdll.cxx2
-rw-r--r--editeng/source/items/borderline.cxx4
-rw-r--r--editeng/source/items/charhiddenitem.cxx3
-rw-r--r--editeng/source/items/frmitems.cxx22
-rw-r--r--editeng/source/items/itemtype.cxx6
-rw-r--r--editeng/source/items/paraitem.cxx10
-rw-r--r--editeng/source/items/textitem.cxx34
-rw-r--r--editeng/source/misc/splwrap.cxx2
-rw-r--r--editeng/source/misc/unolingu.cxx2
10 files changed, 47 insertions, 46 deletions
diff --git a/editeng/inc/strings.hrc b/editeng/inc/strings.hrc
index 813fa1f92591..a7195a1d2e4e 100644
--- a/editeng/inc/strings.hrc
+++ b/editeng/inc/strings.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* RID_SVXITEMS_HORJUST[] =
+const TranslateId RID_SVXITEMS_HORJUST[] =
{
// enum SvxCellHorJustify ----------------------------------------------------
NC_("RID_SVXITEMS_HORJUST_STANDARD", "Horizontal alignment default"),
@@ -22,7 +22,7 @@ const char* RID_SVXITEMS_HORJUST[] =
NC_("RID_SVXITEMS_HORJUST_REPEAT", "Repeat alignment")
};
-const char* RID_SVXITEMS_VERJUST[] =
+const TranslateId RID_SVXITEMS_VERJUST[] =
{
// enum SvxCellVerJustify ----------------------------------------------------
NC_("RID_SVXITEMS_VERJUST_STANDARD", "Vertical alignment default"),
@@ -32,7 +32,7 @@ const char* RID_SVXITEMS_VERJUST[] =
NC_("RID_SVXITEMS_HORJUST_BLOCK", "Justify vertically")
};
-const char* RID_SVXITEMS_JUSTMETHOD[] =
+const TranslateId RID_SVXITEMS_JUSTMETHOD[] =
{
// enum SvxCellJustifyMethod ----------------------------------------------------
NC_("RID_SVXITEMS_JUSTMETHOD_AUTO", "Automatic Justify"),
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 8141c6481f86..0e0540bf1244 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -188,7 +188,7 @@ uno::Reference< linguistic2::XLanguageGuessing > const & GlobalEditData::GetLang
return xLanguageGuesser;
}
-OUString EditResId(std::string_view aId)
+OUString EditResId(TranslateId aId)
{
return Translate::get(aId, Translate::Create("editeng"));
}
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 9037eeba9015..1b06258b20a8 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -622,7 +622,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit,
const IntlWrapper* pIntl,
bool bMetricStr) const
{
- static const char* aStyleIds[] =
+ static TranslateId aStyleIds[] =
{
RID_SOLID,
RID_DOTTED,
@@ -647,7 +647,7 @@ OUString SvxBorderLine::GetValueString(MapUnit eSrcUnit,
if ( static_cast<int>(m_nStyle) < int(SAL_N_ELEMENTS(aStyleIds)) )
{
- const char* pResId = aStyleIds[static_cast<int>(m_nStyle)];
+ TranslateId pResId = aStyleIds[static_cast<int>(m_nStyle)];
aStr += EditResId(pResId);
}
else
diff --git a/editeng/source/items/charhiddenitem.cxx b/editeng/source/items/charhiddenitem.cxx
index 8d0753c91e68..ec2a0af3c703 100644
--- a/editeng/source/items/charhiddenitem.cxx
+++ b/editeng/source/items/charhiddenitem.cxx
@@ -20,6 +20,7 @@
#include <editeng/charhiddenitem.hxx>
#include <editeng/editrids.hrc>
#include <editeng/eerdll.hxx>
+#include <unotools/resmgr.hxx>
SvxCharHiddenItem::SvxCharHiddenItem( const bool bHidden, const sal_uInt16 nId ) :
@@ -41,7 +42,7 @@ bool SvxCharHiddenItem::GetPresentation
const IntlWrapper & /*rIntl*/
) const
{
- const char* pId = RID_SVXITEMS_CHARHIDDEN_FALSE;
+ TranslateId pId = RID_SVXITEMS_CHARHIDDEN_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_CHARHIDDEN_TRUE;
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 7027ae7c2914..add9c3654f65 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -904,7 +904,7 @@ bool SvxPrintItem::GetPresentation
OUString& rText, const IntlWrapper&
) const
{
- const char* pId = RID_SVXITEMS_PRINT_FALSE;
+ TranslateId pId = RID_SVXITEMS_PRINT_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_PRINT_TRUE;
@@ -925,7 +925,7 @@ bool SvxOpaqueItem::GetPresentation
OUString& rText, const IntlWrapper&
) const
{
- const char* pId = RID_SVXITEMS_OPAQUE_FALSE;
+ TranslateId pId = RID_SVXITEMS_OPAQUE_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_OPAQUE_TRUE;
@@ -993,7 +993,7 @@ bool SvxProtectItem::GetPresentation
OUString& rText, const IntlWrapper&
) const
{
- const char* pId = RID_SVXITEMS_PROT_CONTENT_FALSE;
+ TranslateId pId = RID_SVXITEMS_PROT_CONTENT_FALSE;
if ( bCntnt )
pId = RID_SVXITEMS_PROT_CONTENT_TRUE;
@@ -1185,7 +1185,7 @@ sal_uInt16 SvxShadowItem::CalcShadowSpace( SvxShadowItemSide nShadow ) const
return nSpace;
}
-static const char* RID_SVXITEMS_SHADOW[] =
+static TranslateId RID_SVXITEMS_SHADOW[] =
{
RID_SVXITEMS_SHADOW_NONE,
RID_SVXITEMS_SHADOW_TOPLEFT,
@@ -1207,7 +1207,7 @@ bool SvxShadowItem::GetPresentation
case SfxItemPresentation::Nameless:
{
rText = ::GetColorString( aShadowColor ) + cpDelim;
- const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE;
+ TranslateId pId = RID_SVXITEMS_TRANSPARENT_FALSE;
if ( aShadowColor.IsTransparent() )
pId = RID_SVXITEMS_TRANSPARENT_TRUE;
@@ -1224,7 +1224,7 @@ bool SvxShadowItem::GetPresentation
::GetColorString( aShadowColor ) +
cpDelim;
- const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE;
+ TranslateId pId = RID_SVXITEMS_TRANSPARENT_FALSE;
if ( aShadowColor.IsTransparent() )
pId = RID_SVXITEMS_TRANSPARENT_TRUE;
rText += EditResId(pId) +
@@ -2571,7 +2571,7 @@ bool SvxFormatBreakItem::GetPresentation
OUString SvxFormatBreakItem::GetValueTextByPos( sal_uInt16 nPos )
{
- static const char* RID_SVXITEMS_BREAK[] =
+ static TranslateId RID_SVXITEMS_BREAK[] =
{
RID_SVXITEMS_BREAK_NONE,
RID_SVXITEMS_BREAK_COLUMN_BEFORE,
@@ -2655,7 +2655,7 @@ bool SvxFormatKeepItem::GetPresentation
OUString& rText, const IntlWrapper&
) const
{
- const char* pId = RID_SVXITEMS_FMTKEEP_FALSE;
+ TranslateId pId = RID_SVXITEMS_FMTKEEP_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_FMTKEEP_TRUE;
@@ -3113,7 +3113,7 @@ bool SvxBrushItem::GetPresentation
if ( GPOS_NONE == eGraphicPos )
{
rText = ::GetColorString( aColor ) + cpDelim;
- const char* pId = RID_SVXITEMS_TRANSPARENT_FALSE;
+ TranslateId pId = RID_SVXITEMS_TRANSPARENT_FALSE;
if ( aColor.IsTransparent() )
pId = RID_SVXITEMS_TRANSPARENT_TRUE;
@@ -3366,9 +3366,9 @@ SvxFrameDirectionItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const
return new SvxFrameDirectionItem( *this );
}
-const char* getFrmDirResId(size_t nIndex)
+TranslateId getFrmDirResId(size_t nIndex)
{
- const char* const RID_SVXITEMS_FRMDIR[] =
+ TranslateId const RID_SVXITEMS_FRMDIR[] =
{
RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP,
RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP,
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index 5cf463173063..cbb83c83be35 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -152,7 +152,7 @@ OUString GetColorString( const Color& rCol )
nColor += 1;
}
- static const char* RID_SVXITEMS_COLORS[] =
+ static TranslateId RID_SVXITEMS_COLORS[] =
{
RID_SVXITEMS_COLOR_BLACK,
RID_SVXITEMS_COLOR_BLUE,
@@ -188,9 +188,9 @@ OUString GetColorString( const Color& rCol )
return sStr;
}
-const char* GetMetricId( MapUnit eUnit )
+TranslateId GetMetricId( MapUnit eUnit )
{
- const char* pId = RID_SVXITEMS_METRIC_MM;
+ TranslateId pId = RID_SVXITEMS_METRIC_MM;
switch ( eUnit )
{
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 9bc05843bd22..4dc508a6939f 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -435,7 +435,7 @@ sal_uInt16 SvxAdjustItem::GetValueCount() const
OUString SvxAdjustItem::GetValueTextByPos( sal_uInt16 nPos )
{
- static const char* RID_SVXITEMS_ADJUST[] =
+ static TranslateId RID_SVXITEMS_ADJUST[] =
{
RID_SVXITEMS_ADJUST_LEFT,
RID_SVXITEMS_ADJUST_RIGHT,
@@ -648,7 +648,7 @@ bool SvxHyphenZoneItem::GetPresentation
{
case SfxItemPresentation::Nameless:
{
- const char* pId = RID_SVXITEMS_HYPHEN_FALSE;
+ TranslateId pId = RID_SVXITEMS_HYPHEN_FALSE;
if ( bHyphen )
pId = RID_SVXITEMS_HYPHEN_TRUE;
@@ -665,7 +665,7 @@ bool SvxHyphenZoneItem::GetPresentation
}
case SfxItemPresentation::Complete:
{
- const char* pId = RID_SVXITEMS_HYPHEN_FALSE;
+ TranslateId pId = RID_SVXITEMS_HYPHEN_FALSE;
if ( bHyphen )
pId = RID_SVXITEMS_HYPHEN_TRUE;
@@ -1008,7 +1008,7 @@ bool SvxFormatSplitItem::GetPresentation
OUString& rText, const IntlWrapper&
) const
{
- const char* pId = RID_SVXITEMS_FMTSPLIT_FALSE;
+ TranslateId pId = RID_SVXITEMS_FMTSPLIT_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_FMTSPLIT_TRUE;
@@ -1173,7 +1173,7 @@ bool SvxParaVertAlignItem::GetPresentation(
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
OUString &rText, const IntlWrapper& ) const
{
- const char* pTmp;
+ TranslateId pTmp;
switch( GetValue() )
{
case Align::Automatic: pTmp = RID_SVXITEMS_PARAVERTALIGN_AUTO; break;
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 3fd992617695..433352b4653f 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -356,7 +356,7 @@ OUString SvxPostureItem::GetValueTextByPos( sal_uInt16 nPos )
DBG_ASSERT( nPos <= sal_uInt16(ITALIC_NORMAL), "enum overflow!" );
FontItalic eItalic = static_cast<FontItalic>(nPos);
- const char* pId = nullptr;
+ TranslateId pId;
switch ( eItalic )
{
@@ -483,7 +483,7 @@ bool SvxWeightItem::GetPresentation
OUString SvxWeightItem::GetValueTextByPos( sal_uInt16 nPos )
{
- static const char* RID_SVXITEMS_WEIGHTS[] =
+ static TranslateId RID_SVXITEMS_WEIGHTS[] =
{
RID_SVXITEMS_WEIGHT_DONTKNOW,
RID_SVXITEMS_WEIGHT_THIN,
@@ -1029,7 +1029,7 @@ SvxUnderlineItem* SvxUnderlineItem::Clone( SfxItemPool * ) const
OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
{
- static const char* RID_SVXITEMS_UL[] =
+ static TranslateId RID_SVXITEMS_UL[] =
{
RID_SVXITEMS_UL_NONE,
RID_SVXITEMS_UL_SINGLE,
@@ -1070,7 +1070,7 @@ SvxOverlineItem* SvxOverlineItem::Clone( SfxItemPool * ) const
OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
{
- static const char* RID_SVXITEMS_OL[] =
+ static TranslateId RID_SVXITEMS_OL[] =
{
RID_SVXITEMS_OL_NONE,
RID_SVXITEMS_OL_SINGLE,
@@ -1147,7 +1147,7 @@ bool SvxCrossedOutItem::GetPresentation
OUString SvxCrossedOutItem::GetValueTextByPos( sal_uInt16 nPos )
{
- static const char* RID_SVXITEMS_STRIKEOUT[] =
+ static TranslateId RID_SVXITEMS_STRIKEOUT[] =
{
RID_SVXITEMS_STRIKEOUT_NONE,
RID_SVXITEMS_STRIKEOUT_SINGLE,
@@ -1216,7 +1216,7 @@ bool SvxShadowedItem::GetPresentation
OUString& rText, const IntlWrapper& /*rIntl*/
) const
{
- const char* pId = RID_SVXITEMS_SHADOWED_FALSE;
+ TranslateId pId = RID_SVXITEMS_SHADOWED_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_SHADOWED_TRUE;
@@ -1244,7 +1244,7 @@ bool SvxAutoKernItem::GetPresentation
OUString& rText, const IntlWrapper& /*rIntl*/
) const
{
- const char* pId = RID_SVXITEMS_AUTOKERN_FALSE;
+ TranslateId pId = RID_SVXITEMS_AUTOKERN_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_AUTOKERN_TRUE;
@@ -1273,7 +1273,7 @@ bool SvxWordLineModeItem::GetPresentation
OUString& rText, const IntlWrapper& /*rIntl*/
) const
{
- const char* pId = RID_SVXITEMS_WORDLINE_FALSE;
+ TranslateId pId = RID_SVXITEMS_WORDLINE_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_WORDLINE_TRUE;
@@ -1301,7 +1301,7 @@ bool SvxContourItem::GetPresentation
OUString& rText, const IntlWrapper& /*rIntl*/
) const
{
- const char* pId = RID_SVXITEMS_CONTOUR_FALSE;
+ TranslateId pId = RID_SVXITEMS_CONTOUR_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_CONTOUR_TRUE;
@@ -1467,7 +1467,7 @@ bool SvxKerningItem::GetPresentation
case SfxItemPresentation::Complete:
{
rText = EditResId(RID_SVXITEMS_KERNING_COMPLETE);
- const char* pId = nullptr;
+ TranslateId pId;
if ( GetValue() > 0 )
pId = RID_SVXITEMS_KERNING_EXPANDED;
@@ -1536,7 +1536,7 @@ bool SvxCaseMapItem::GetPresentation
OUString SvxCaseMapItem::GetValueTextByPos( sal_uInt16 nPos )
{
- static const char* RID_SVXITEMS_CASEMAP[] =
+ static TranslateId RID_SVXITEMS_CASEMAP[] =
{
RID_SVXITEMS_CASEMAP_NONE,
RID_SVXITEMS_CASEMAP_UPPERCASE,
@@ -1658,7 +1658,7 @@ bool SvxEscapementItem::GetPresentation
OUString SvxEscapementItem::GetValueTextByPos( sal_uInt16 nPos )
{
- static const char* RID_SVXITEMS_ESCAPEMENT[] =
+ static TranslateId RID_SVXITEMS_ESCAPEMENT[] =
{
RID_SVXITEMS_ESCAPEMENT_OFF,
RID_SVXITEMS_ESCAPEMENT_SUPER,
@@ -1875,7 +1875,7 @@ bool SvxBlinkItem::GetPresentation
OUString& rText, const IntlWrapper& /*rIntl*/
) const
{
- const char* pId = RID_SVXITEMS_BLINK_FALSE;
+ TranslateId pId = RID_SVXITEMS_BLINK_FALSE;
if ( GetValue() )
pId = RID_SVXITEMS_BLINK_TRUE;
@@ -1905,7 +1905,7 @@ bool SvxEmphasisMarkItem::GetPresentation
const IntlWrapper& /*rIntl*/
) const
{
- static const char* RID_SVXITEMS_EMPHASIS[] =
+ static TranslateId RID_SVXITEMS_EMPHASIS[] =
{
RID_SVXITEMS_EMPHASIS_NONE_STYLE,
RID_SVXITEMS_EMPHASIS_DOT_STYLE,
@@ -1917,11 +1917,11 @@ bool SvxEmphasisMarkItem::GetPresentation
FontEmphasisMark nVal = GetEmphasisMark();
rText = EditResId(RID_SVXITEMS_EMPHASIS[
static_cast<sal_uInt16>(static_cast<FontEmphasisMark>( nVal & FontEmphasisMark::Style ))]);
- const char* pId = ( FontEmphasisMark::PosAbove & nVal )
+ TranslateId pId = ( FontEmphasisMark::PosAbove & nVal )
? RID_SVXITEMS_EMPHASIS_ABOVE_POS
: ( FontEmphasisMark::PosBelow & nVal )
? RID_SVXITEMS_EMPHASIS_BELOW_POS
- : nullptr;
+ : TranslateId();
if( pId )
rText += EditResId( pId );
return true;
@@ -2329,7 +2329,7 @@ SvxCharReliefItem* SvxCharReliefItem::Clone( SfxItemPool * ) const
return new SvxCharReliefItem( *this );
}
-static const char* RID_SVXITEMS_RELIEF[] =
+static TranslateId RID_SVXITEMS_RELIEF[] =
{
RID_SVXITEMS_RELIEF_NONE,
RID_SVXITEMS_RELIEF_EMBOSSED,
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index b51c9c97b613..669546a8e5cb 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -342,7 +342,7 @@ bool SvxSpellWrapper::SpellNext( )
// a BODY_area done, ask for the other BODY_area
xWait.reset();
- const char* pResId = bReverse ? RID_SVXSTR_QUERY_BW_CONTINUE : RID_SVXSTR_QUERY_CONTINUE;
+ TranslateId pResId = bReverse ? RID_SVXSTR_QUERY_BW_CONTINUE : RID_SVXSTR_QUERY_CONTINUE;
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin,
VclMessageType::Question, VclButtonsType::YesNo,
EditResId(pResId)));
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index b72fae9ebb67..c5f37e74cbb4 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -731,7 +731,7 @@ short SvxDicError(weld::Window *pParent, linguistic::DictionaryError nError)
short nRes = 0;
if (linguistic::DictionaryError::NONE != nError)
{
- const char* pRid;
+ TranslateId pRid;
switch (nError)
{
case linguistic::DictionaryError::FULL : pRid = RID_SVXSTR_DIC_ERR_FULL; break;