sc/inc/patattr.hxx | 1 + sc/source/core/data/patattr.cxx | 5 +++++ sc/source/ui/view/tabvwsha.cxx | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-)
New commits: commit f58d07397bd90c16c7b4d576ec9b4e6ee7ee367e Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Dec 23 11:13:26 2024 +0500 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Tue Dec 24 12:18:24 2024 +0100 tdf#42989: don't set fake ATTR_VALUE_FORMAT for multi-format selection Change-Id: Iaed133b19c4d870ff85fd9d2dd69db36318bb28e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179190 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit e6d71b9381aba8531c0ebf635c11508e5389fdc6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179200 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 44b7e370bf32..67d2b9f2d9b3 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -261,6 +261,7 @@ public: with text encoding RTL_TEXTENC_SYMBOL */ bool IsSymbolFont() const; + bool HasNumberFormat() const; // Returns false e.g. for multiformat selection SC_DLLPUBLIC sal_uInt32 GetNumberFormat( SvNumberFormatter* ) const; sal_uInt32 GetNumberFormat( const ScInterpreterContext& rContext ) const; sal_uInt32 GetNumberFormat( SvNumberFormatter* pFormatter, diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index 59c5753633f0..6f69739ed491 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -1626,6 +1626,11 @@ LanguageType getLanguageType(const SfxItemSet& rSet) } +bool ScPatternAttr::HasNumberFormat() const +{ + return GetItemSet().HasItem(ATTR_VALUE_FORMAT); +} + sal_uInt32 ScPatternAttr::GetNumberFormatKey() const { if (!mxNumberFormatKey.has_value()) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index b796a05d9821..63e930928439 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -599,8 +599,9 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OUString &rNam xOldSet->Put( *aLineInner ); // Generate NumberFormat Value from Value and Language and box it. - xOldSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, - pOldAttrs->GetNumberFormat( rDoc.GetFormatTable() ) ) ); + if (pOldAttrs->HasNumberFormat()) // tdf#42989: don't set it for multi-format selection + xOldSet->Put( + SfxUInt32Item(ATTR_VALUE_FORMAT, pOldAttrs->GetNumberFormat(rDoc.GetFormatTable()))); std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem = MakeNumberInfoItem(rDoc, GetViewData()); xOldSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO );