[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - editeng/source include/editeng

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 12 03:06:17 UTC 2019


 editeng/source/items/justifyitem.cxx |   64 +++++++++++++++++++++++++++++++----
 include/editeng/justifyitem.hxx      |    2 -
 2 files changed, 59 insertions(+), 7 deletions(-)

New commits:
commit 844c56230fde10bd62269ed14aa7f7e10edb2ea2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 11:37:25 2019 +0000
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Dec 12 04:05:25 2019 +0100

    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/84814
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx
index 1b9701356bdc..976226e97671 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 c53a7b83b744..7f619e4120b5 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


More information about the Libreoffice-commits mailing list