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 commit56588663a0"tdf#131728 sw inline heading: fix DOCX paragraph layout interoperability". Follow-up to commit7a35f3dc74"tdf#48459 sw inline heading: apply it on the selected words", commitd87cf67f8f"tdf#131728 sw inline heading: fix missing/broken DOCX export", commita1dcbd1d1c"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 <nemeth@numbertext.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user