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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 11 17:02:44 UTC 2019


 cui/source/tabpages/align.cxx        |    5 ++
 editeng/source/items/justifyitem.cxx |   64 +++++++++++++++++++++++++++++++----
 include/editeng/justifyitem.hxx      |    2 -
 3 files changed, 64 insertions(+), 7 deletions(-)

New commits:
commit d0551164a5cf4b76047a94c34fd22bbc94b95463
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 20:15:27 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 11 18:01:57 2019 +0100

    tdf#129300 If it would create no change, don't force it
    
    otherwise a bogus "change" from the parent style is shown in the organizer
    
    this dates to...
    
    commit 755ad6834625488c5d31d4bacc9370eae7ffd8f3
    Date:   Tue Oct 5 11:15:56 2010 -0400
    
        Ported calc-distributed-cell-text-*.diff from ooo-build.
    
    Change-Id: I49fc654a232d3c0f43f8add9a9f9fee34a6c5add
    Reviewed-on: https://gerrit.libreoffice.org/84895
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index e79a39607d73..cdd87f0cf2a4 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -90,6 +90,11 @@ void lcl_SetJustifyMethodToItemSet(SfxItemSet& rSet, sal_uInt16 nWhichJM, const
     if (rLB.get_active() == nListPos)
         eJM = SvxCellJustifyMethod::Distribute;
 
+    // tdf#129300 If it would create no change, don't force it
+    const SvxJustifyMethodItem& rOldItem = static_cast<const SvxJustifyMethodItem&>(rSet.Get(nWhichJM));
+    if (rOldItem.GetValue() == eJM)
+        return;
+
     SvxJustifyMethodItem aItem(eJM, nWhichJM);
     rSet.Put(aItem);
 }
commit c250f7dac3067bb75ee5a8e07e8cf2e1247ad525
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 11:37:25 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 11 18:01:33 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/84813
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.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 2d862ff7d35e..e087f85be141 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