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 e6d71b9381aba8531c0ebf635c11508e5389fdc6 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Dec 23 11:13:26 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Dec 23 09:44:57 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> diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index 0e56ac981e9f..b75ee42e64f3 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 ce0092b5c723..f11cacb6c0b2 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 );