sc/source/core/data/patattr.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c5914045a830e7b3a349d41ff558ae1a873bd71c
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Jun 22 18:38:27 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Jun 22 17:46:55 2025 +0200

    tdf#167062: fix ScPatternAttr::HasNumberFormat implementation
    
    It must only return false, when respective item is invalidated.
    
    See ScViewFunc::ApplyAttributes, which may avoid setting cell
    number format, when only language has changed; this may create
    cells having ATTR_LANGUAGE_FORMAT, but not ATTR_VALUE_FORMAT.
    This case must be handled as "having a number format", for the
    purposes of preparing item set for number format dialog. See
    ScTabViewShell::ExecuteCellFormatDlg, where it is checked and
    prepared.
    
    Change-Id: Ida0c8495ce582739a3ddfa0ced392b3d9c7651de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186793
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 2dfcf5383771..2a1528456c8e 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1651,7 +1651,9 @@ LanguageType getLanguageType(const SfxItemSet& rSet)
 
 bool ScPatternAttr::HasNumberFormat() const
 {
-    return GetItemSet().HasItem(ATTR_VALUE_FORMAT);
+    // If ATTR_VALUE_FORMAT is invalid in the pattern,
+    // it means a multiselection with different formats
+    return GetItemSet().GetItemState(ATTR_VALUE_FORMAT) != 
SfxItemState::INVALID;
 }
 
 sal_uInt32 ScPatternAttr::GetNumberFormatKey() const

Reply via email to