[Libreoffice-commits] core.git: sc/source

Eike Rathke (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 26 19:49:24 UTC 2019


 sc/source/core/data/patattr.cxx |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

New commits:
commit 4dfb22acfe30f9322ecc0ad9d01b17a3814c87a2
Author:     Eike Rathke <erack at redhat.com>
AuthorDate: Sat Oct 26 18:48:37 2019 +0200
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Sat Oct 26 21:48:35 2019 +0200

    Related: tdf#117715 tdf#128403 Couple ATTR_LANGUAGE_FORMAT ATTR_VALUE_FORMAT
    
    Do not obtain ATTR_VALUE_FORMAT from hard attribute and
    ATTR_LANGUAGE_FORMAT from conditional format. Though it doesn't
    matter in the bugs' cases it's wrong. ATTR_LANGUAGE_FORMAT belongs
    to the ATTR_VALUE_FORMAT if set.
    
    Change-Id: I9ec2d7523e22a40c3fe4a655fe9082ab6158c376
    Reviewed-on: https://gerrit.libreoffice.org/81547
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index ec3ffb74bef0..9d18777d9c77 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1263,22 +1263,30 @@ sal_uInt32 ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter,
      */
 
     const SfxPoolItem* pFormItem;
-    sal_uLong nFormat = 0;
+    sal_uInt32 nFormat;
+    const SfxPoolItem* pLangItem;
+    LanguageType eLang;
     if (GetItemSet().GetItemState(ATTR_VALUE_FORMAT, false, &pFormItem) == SfxItemState::SET)
+    {
         nFormat = static_cast<const SfxUInt32Item*>(pFormItem)->GetValue();
+        if (GetItemSet().GetItemState(ATTR_LANGUAGE_FORMAT, false, &pLangItem) == SfxItemState::SET)
+            eLang = static_cast<const SvxLanguageItem*>(pLangItem)->GetLanguage();
+        else
+            eLang = getLanguageType(GetItemSet());
+    }
     else if (pCondSet->GetItemState(ATTR_VALUE_FORMAT, true, &pFormItem) == SfxItemState::SET )
+    {
         nFormat = getNumberFormatKey(*pCondSet);
+        if (pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT, true, &pLangItem) == SfxItemState::SET)
+            eLang = getLanguageType(*pCondSet);
+        else
+            eLang = getLanguageType(GetItemSet());
+    }
     else
+    {
         nFormat = getNumberFormatKey(GetItemSet());
-
-    const SfxPoolItem* pLangItem;
-    LanguageType eLang;
-    if (GetItemSet().GetItemState(ATTR_LANGUAGE_FORMAT, false, &pLangItem) == SfxItemState::SET)
-        eLang = static_cast<const SvxLanguageItem*>(pLangItem)->GetLanguage();
-    else if (pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT, true, &pLangItem) == SfxItemState::SET)
-        eLang = getLanguageType(*pCondSet);
-    else
         eLang = getLanguageType(GetItemSet());
+    }
 
     return pFormatter->GetFormatForLanguageIfBuiltIn(nFormat, eLang);
 }


More information about the Libreoffice-commits mailing list