sw/source/core/crsr/trvltbl.cxx | 8 +++++++- sw/source/core/docnode/ndtbl.cxx | 10 ++++------ 2 files changed, 11 insertions(+), 7 deletions(-)
New commits: commit 8f39134cadc14ff12941f89bbe974c4bc04670c6 Author: Oliver Specht <[email protected]> AuthorDate: Thu Jan 9 13:17:15 2025 +0100 Commit: Gabor Kelemen <[email protected]> CommitDate: Wed Mar 26 15:25:06 2025 +0100 tdf#158709 Update cell formula if cells change from value to text Modification of cells that are part of formulas notify also if numeric content is changed to text - even if they have multiple paragraphs. Change-Id: Ifb6a35f4c162388d4fadd73e5207a6d3719a9a04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183111 Reviewed-by: Gabor Kelemen <[email protected]> Tested-by: allotropia jenkins <[email protected]> diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index b16b40122a26..9c0877bf3525 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -825,8 +825,14 @@ bool SwCursorShell::CheckTableBoxContent( const SwPosition* pPos ) } // box has more than one paragraph - if( pChkBox && pSttNd->GetIndex() + SwNodeOffset(2) != pSttNd->EndOfSectionIndex() ) + if (pChkBox && pSttNd->GetIndex() + SwNodeOffset(2) != pSttNd->EndOfSectionIndex()) + { + ClearTableBoxContent(); + StartAction(); + GetDoc()->ChkBoxNumFormat( *pChkBox, true ); + EndAction(); pChkBox = nullptr; + } // destroy pointer before next action starts if( !pPos && !pChkBox ) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 523895e8e1c1..da9bd57e8ad7 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4092,7 +4092,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) // Optimization: If the Box says it's Text, it remains Text const SwTableBoxNumFormat* pNumFormatItem = rBox.GetFrameFormat()->GetItemIfSet( RES_BOXATR_FORMAT, false ); - if( pNumFormatItem && GetNumberFormatter()->IsTextFormat(pNumFormatItem->GetValue()) ) + if (pNumFormatItem && GetNumberFormatter()->IsTextFormat(pNumFormatItem->GetValue())) return ; std::unique_ptr<SwUndoTableNumFormat> pUndo; @@ -4201,10 +4201,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) bChgd = false; } - if( !bChgd ) - return; - - if( pUndo ) + if( bChgd && pUndo ) { pUndo->SetBox( rBox ); GetIDocumentUndoRedo().AppendUndo(std::move(pUndo)); @@ -4221,7 +4218,8 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) if (AUTOUPD_FIELD_AND_CHARTS == GetDocumentSettingManager().getFieldUpdateFlags(true)) pTableNd->GetTable().UpdateCharts(); } - getIDocumentState().SetModified(); + if( bChgd ) + getIDocumentState().SetModified(); } void SwDoc::SetTableBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet )
