sc/source/core/data/patattr.cxx |    5 +++--
 sc/source/ui/view/tabvwsha.cxx  |    2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit ae245ce3147468449dc5c3844245d4eed654d3c6
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Jun 22 19:18:28 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Jun 22 18:07:16 2025 +0200

    tdf#167161: different ATTR_LANGUAGE_FORMAT mean different number formats
    
    Extend ScPatternAttr::HasNumberFormat to check ATTR_LANGUAGE_FORMAT
    when detecting different number formats, which will disable controls
    in SvxNumberFormatTabPage::Reset (see handling of pValFmtAttr there).
    Also invalidate ATTR_VALUE_FORMAT explicitly in ExecuteCellFormatDlg,
    when HasNumberFormat returned false.
    
    Change-Id: I7c415903e71149f4fabb98840fae36e2379d4830
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186794
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 2a1528456c8e..3a0a6aa2d6ae 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1651,9 +1651,10 @@ LanguageType getLanguageType(const SfxItemSet& rSet)
 
 bool ScPatternAttr::HasNumberFormat() const
 {
-    // If ATTR_VALUE_FORMAT is invalid in the pattern,
+    // If either ATTR_VALUE_FORMAT or ATTR_LANGUAGE_FORMAT are invalid in the 
pattern,
     // it means a multiselection with different formats
-    return GetItemSet().GetItemState(ATTR_VALUE_FORMAT) != 
SfxItemState::INVALID;
+    return GetItemSet().GetItemState(ATTR_VALUE_FORMAT) != 
SfxItemState::INVALID
+           && GetItemSet().GetItemState(ATTR_LANGUAGE_FORMAT) != 
SfxItemState::INVALID;
 }
 
 sal_uInt32 ScPatternAttr::GetNumberFormatKey() const
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index c96e9494d49d..461d363d0f3a 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -601,6 +601,8 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, 
const OUString &rNam
     if (pOldAttrs->HasNumberFormat()) // tdf#42989: don't set it for 
multi-format selection
         xOldSet->Put(
             SfxUInt32Item(ATTR_VALUE_FORMAT, 
pOldAttrs->GetNumberFormat(rDoc.GetFormatTable())));
+    else // Make sure it's invalid, when ATTR_LANGUAGE_FORMAT is invalid
+        xOldSet->InvalidateItem(ATTR_VALUE_FORMAT);
 
     std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem = 
MakeNumberInfoItem(rDoc, GetViewData());
     xOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, 
SID_ATTR_NUMBERFORMAT_INFO );

Reply via email to