tdf#129300 alignment enums not translated in organizer
because they used the trick that the original ids
were contiguous integers
Change-Id: I4405100f26241dd84c26155529d3961d5082ee9e
Reviewed-on: https://gerrit.libreoffice.org/84813
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx
index 1b97013..976226e 100644
--- a/editeng/source/items/justifyitem.cxx
+++ b/editeng/source/items/justifyitem.cxx
@@ -57,7 +57,7 @@ bool SvxHorJustifyItem::GetPresentation
MapUnit /*ePresUnit*/,
OUString& rText, const IntlWrapper&) const
{
rText = GetValueText( static_cast<sal_uInt16>(GetValue()) );
rText = GetValueText( GetValue() );
return true;
}
@@ -159,10 +159,33 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
OUString SvxHorJustifyItem::GetValueText( sal_uInt16 nVal )
OUString SvxHorJustifyItem::GetValueText( SvxCellHorJustify nVal )
{
DBG_ASSERT( nVal <= sal_uInt16(SvxCellHorJustify::Repeat), "enum overflow!" );
return EditResId(RID_SVXITEMS_HORJUST_STANDARD + nVal);
DBG_ASSERT( nVal <= SvxCellHorJustify::Repeat, "enum overflow!" );
OUString sRet;
switch (nVal)
{
case SvxCellHorJustify::Standard:
sRet = EditResId(RID_SVXITEMS_HORJUST_STANDARD);
break;
case SvxCellHorJustify::Left:
sRet = EditResId(RID_SVXITEMS_HORJUST_LEFT);
break;
case SvxCellHorJustify::Center:
sRet = EditResId(RID_SVXITEMS_HORJUST_CENTER);
break;
case SvxCellHorJustify::Right:
sRet = EditResId(RID_SVXITEMS_HORJUST_RIGHT);
break;
case SvxCellHorJustify::Block:
sRet = EditResId(RID_SVXITEMS_HORJUST_BLOCK);
break;
case SvxCellHorJustify::Repeat:
sRet = EditResId(RID_SVXITEMS_HORJUST_REPEAT);
break;
}
return sRet;
}
@@ -289,7 +312,26 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
OUString SvxVerJustifyItem::GetValueText( SvxCellVerJustify nVal )
{
DBG_ASSERT( nVal <= SvxCellVerJustify::Bottom, "enum overflow!" );
return EditResId(RID_SVXITEMS_VERJUST_STANDARD + static_cast<int>(nVal));
OUString sRet;
switch (nVal)
{
case SvxCellVerJustify::Standard:
sRet = EditResId(RID_SVXITEMS_VERJUST_STANDARD);
break;
case SvxCellVerJustify::Top:
sRet = EditResId(RID_SVXITEMS_VERJUST_TOP);
break;
case SvxCellVerJustify::Center:
sRet = EditResId(RID_SVXITEMS_VERJUST_CENTER);
break;
case SvxCellVerJustify::Bottom:
sRet = EditResId(RID_SVXITEMS_VERJUST_BOTTOM);
break;
default:
break;
}
return sRet;
}
@@ -362,7 +404,17 @@ bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId
OUString SvxJustifyMethodItem::GetValueText( SvxCellJustifyMethod nVal )
{
return EditResId(RID_SVXITEMS_JUSTMETHOD_AUTO + static_cast<int>(nVal));
OUString sRet;
switch (nVal)
{
case SvxCellJustifyMethod::Auto:
sRet = EditResId(RID_SVXITEMS_JUSTMETHOD_AUTO);
break;
case SvxCellJustifyMethod::Distribute:
sRet = EditResId(RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE);
break;
}
return sRet;
}
diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx
index 2d862ff7..e087f85 100644
--- a/include/editeng/justifyitem.hxx
+++ b/include/editeng/justifyitem.hxx
@@ -45,7 +45,7 @@ public:
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
virtual sal_uInt16 GetValueCount() const override;
static OUString GetValueText( sal_uInt16 nVal );
static OUString GetValueText( SvxCellHorJustify nVal );
virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
SvxHorJustifyItem(SvxHorJustifyItem const &) = default; // SfxPoolItem copy function dichotomy