sw/source/core/text/txtfrm.cxx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
New commits: commit b4d41f6b0deb0299cd01173c150c5b94568c9a21 Author: László Németh <nem...@numbertext.org> AuthorDate: Mon Feb 3 00:48:15 2025 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon Feb 3 11:26:55 2025 +0100 tdf#164932 sw inline heading: fix frame AutoSize at list offset Calculation of AutoSize of text frames was incomplete, resulting narrower frame width and e.g. two-line numbered inline heading instead of a single one, if the left offset of the numbering level in the attached list style was not zero. This is a general fix for all text frames, not only for text frames with Inline Heading frame style. Regression from commit 56588663a0fddc005c12afaa7d3f8874d036875f "tdf#131728 sw inline heading: fix DOCX paragraph layout interoperability". Follow-up to commit 7a35f3dc7419d833b8f47069c4df63e900ccb880 "tdf#48459 sw inline heading: apply it on the selected words", commit d87cf67f8f3346a1e380383917a3a4552fd9248e "tdf#131728 sw inline heading: fix missing/broken DOCX export", commit a1dcbd1d1ce6071d48bb5df26d7839aeb21b75a8 "tdf48459 sw inline heading: add Inline Heading frame style" Change-Id: I4aea651d6982db61af0e423f25152b1401dc16c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181025 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 77ab42f41895..08b62b18e7db 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -3692,7 +3692,34 @@ SwTwips SwTextFrame::CalcFitToContent() SetPara( pOldPara ); - return nMax; + // tdf#164932 handle numbering list offset + const SwTextNode* pTextNode( GetTextNodeForParaProps() ); + SwTwips nNumOffset = 0; + if ( pTextNode->IsNumbered(getRootFrame()) && + pTextNode->IsCountedInList() && pTextNode->GetNumRule() ) + { + int nListLevel = pTextNode->GetActualListLevel(); + + if (nListLevel < 0) + nListLevel = 0; + + if (nListLevel >= MAXLEVEL) + nListLevel = MAXLEVEL - 1; + + const SwNumFormat& rNumFormat = + pTextNode->GetNumRule()->Get( o3tl::narrowing<sal_uInt16>(nListLevel) ); + if ( rNumFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) + { + const SwAttrSet& rSet = pTextNode->GetSwAttrSet(); + ::sw::ListLevelIndents const indents(pTextNode->AreListLevelIndentsApplicable()); + SvxTextLeftMarginItem leftMargin(rSet.GetTextLeftMargin()); + if (indents & ::sw::ListLevelIndents::LeftMargin) + leftMargin.SetTextLeft(SvxIndentValue::twips(rNumFormat.GetAbsLSpace())); + nNumOffset = leftMargin.ResolveTextLeft(/*metrics*/ {}); + } + } + + return nMax + nNumOffset; } /**