diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-12-10 11:52:18 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-12-10 20:35:11 +0100 |
commit | 837902468522531c8d0ad35612dce53d4facb668 (patch) | |
tree | b911c89b8f65adddcce31c912f0c9cc3083e7181 /editeng/source/items/justifyitem.cxx | |
parent | d7e9db93aec2d1c698e01893fbcaadd6d1207167 (diff) |
reorganize enum based translation
Change-Id: I5615b07d6c1280119f52622566a9c60c46cd5f7a
Reviewed-on: https://gerrit.libreoffice.org/84820
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng/source/items/justifyitem.cxx')
-rw-r--r-- | editeng/source/items/justifyitem.cxx | 79 |
1 files changed, 9 insertions, 70 deletions
diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx index 4c813a591aa7..9b2c2be3b947 100644 --- a/editeng/source/items/justifyitem.cxx +++ b/editeng/source/items/justifyitem.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/table/CellVertJustify2.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> +#include <strings.hrc> SfxPoolItem* SvxHorJustifyItem::CreateDefault() { return new SvxHorJustifyItem(SvxCellHorJustify::Standard, 0) ;} SfxPoolItem* SvxVerJustifyItem::CreateDefault() { return new SvxVerJustifyItem(SvxCellVerJustify::Standard, 0) ;} @@ -57,7 +58,7 @@ bool SvxHorJustifyItem::GetPresentation MapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper&) const { - rText = GetValueText( GetValue() ); + rText = GetValueText(GetValue()); return true; } @@ -158,37 +159,12 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return true; } - -OUString SvxHorJustifyItem::GetValueText( SvxCellHorJustify nVal ) +OUString SvxHorJustifyItem::GetValueText(SvxCellHorJustify 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; + assert(nVal <= SvxCellHorJustify::Repeat && "enum overflow!"); + return EditResId(RID_SVXITEMS_HORJUST[static_cast<size_t>(nVal)]); } - SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const { return new SvxHorJustifyItem( *this ); @@ -308,53 +284,28 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return true; } - OUString SvxVerJustifyItem::GetValueText( SvxCellVerJustify nVal ) { - DBG_ASSERT( nVal <= SvxCellVerJustify::Bottom, "enum overflow!" ); - - 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; - case SvxCellVerJustify::Block: - sRet = EditResId(RID_SVXITEMS_VERJUST_BLOCK); - break; - } - return sRet; + assert(nVal <= SvxCellVerJustify::Block && "enum overflow!"); + return EditResId(RID_SVXITEMS_VERJUST[static_cast<size_t>(nVal)]); } - SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const { return new SvxVerJustifyItem( *this ); } - sal_uInt16 SvxVerJustifyItem::GetValueCount() const { return static_cast<sal_uInt16>(SvxCellVerJustify::Bottom) + 1; // Last Enum value + 1 } - SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify, const sal_uInt16 nId ) : SfxEnumItem( nId, eJustify ) { } - bool SvxJustifyMethodItem::GetPresentation ( SfxItemPresentation /*ePres*/, @@ -402,29 +353,17 @@ bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId return true; } - OUString SvxJustifyMethodItem::GetValueText( SvxCellJustifyMethod 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; + assert(nVal <= SvxCellJustifyMethod::Distribute && "enum overflow!"); + return EditResId(RID_SVXITEMS_JUSTMETHOD[static_cast<size_t>(nVal)]); } - SfxPoolItem* SvxJustifyMethodItem::Clone( SfxItemPool* ) const { return new SvxJustifyMethodItem( *this ); } - sal_uInt16 SvxJustifyMethodItem::GetValueCount() const { return static_cast<sal_uInt16>(SvxCellJustifyMethod::Distribute) + 1; // Last Enum value + 1 |