summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-12-23 11:13:26 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-12-23 09:44:57 +0100
commite6d71b9381aba8531c0ebf635c11508e5389fdc6 (patch)
tree8a418122dd89875a9282e87c69fdbaf411046891
parent750e4d32aa468a91169764144bdf9b59b3a70a31 (diff)
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.kaganski@collabora.com>
-rw-r--r--sc/inc/patattr.hxx1
-rw-r--r--sc/source/core/data/patattr.cxx5
-rw-r--r--sc/source/ui/view/tabvwsha.cxx5
3 files changed, 9 insertions, 2 deletions
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 );