sw/source/uibase/shells/tabsh.cxx |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

New commits:
commit d74738ef156b6c468fd8aa0fb9e0528f04cf5c07
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Dec 22 23:10:55 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Dec 22 20:31:35 2024 +0100

    tdf#132111: don't claim a number format for multiselection / no set format
    
    The "not set" state for RES_BOXATR_FORMAT is handled explicitly in many
    places, e.g., in SwTableBox::HasNumContent. This allows to detect number
    entered into cells without explicit format. Thus, this state is not the
    same as "text" number format, and it must not be selected in the Number
    Format dialog. The same is for multiselection with different formats.
    
    Change-Id: I4f4aa66a2cbfd1bf2efa8b99a6e7a2cf9c119712
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179177
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 57e066669db7..e75bb001df08 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -697,16 +697,12 @@ void SwTableShell::Execute(SfxRequest &rReq)
                      aBoxSet( *pCoreSet->GetPool() );
                 rSh.GetTableBoxFormulaAttrs( aBoxSet );
 
-                SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
-                if(eState == SfxItemState::DEFAULT)
-                {
-                    pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
-                    pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
-                }
-                else
-                    pCoreSet->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
-                                    aBoxSet.Get(
-                                    RES_BOXATR_FORMAT ).GetValue() ));
+                // tdf#132111: if RES_BOXATR_FORMAT state is DEFAULT (no 
number format set to cell
+                // explicitly), it's not equal to any specific format (the 
rules are special, e.g.
+                // it's considered numeric for empty or number text in 
SwTableBox::HasNumContent).
+                // For multiselection, it's INVALID, also not equal to any 
single format.
+                if (auto pFormat = aBoxSet.GetItemIfSet(RES_BOXATR_FORMAT))
+                    pCoreSet->Put(SfxUInt32Item(SID_ATTR_NUMBERFORMAT_VALUE, 
pFormat->GetValue()));
 
                 pCoreSet->Put( SvxNumberInfoItem( pFormatter,
                                     aBoxSet.Get(

Reply via email to