sw/source/core/text/txtfld.cxx | 40 ---------------------------------------- 1 file changed, 40 deletions(-)
New commits: commit 9e365b05e7ca986f6ee4a4a58d0bb20947975864 Author: Justin Luth <jl...@mail.com> AuthorDate: Tue Feb 28 10:28:28 2023 -0500 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Mar 2 10:20:06 2023 +0000 tdf#131386 ApplyParagraphMarkFormatToNumbering remove RTF fallback This stops run-time evaluation of the last char-run properties on the paragraph - which were then applied to the numbering character itself. This was done to imitate MS Word's ability to format the CR itself - which similarly affected the numbering. This awful hack has been slowly evicted as RES_PARATR_LIST_AUTOFMT was created and rolled out to DOCX in 6.4, DOC in 7.5, and now RTF in 7.5.1. A change made in 7.2 (also made temporarily in 6.4 development) looked not only at the start == end char run, but also any run going past it/up to the end. Although the 7.2 change helped some documents, it hurt others. It can now be eliminated completely since RES_PARATR_LIST_AUTOFMT handles that situation at import time. Since this is a run-time layout adjustment, removing it should have no impact on export. Any effect made to MS Format -> ODT is likely incorrect as seen by various bug reports like tdf#146168 and tdf#150613. In the worst case, it would only be a few recent (7.2 - 7.5) DOC -> ODT or RTF -> ODT migrations that will "look different". Chalk those up to implementation errors that need to be corrected. Change-Id: I4ae76008ffcbc5f19580b6ddca08197b7074e12c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148014 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 5a4e7229334b..004a2bc17c09 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -432,46 +432,6 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm SwFormatAutoFormat const& rListAutoFormat(rInf.GetTextFrame()->GetTextNodeForParaProps()->GetAttr(RES_PARATR_LIST_AUTOFMT)); std::shared_ptr<SfxItemSet> pSet(rListAutoFormat.GetStyleHandle()); - // TODO remove this fallback for RTF - bool isDOC = pIDSA->get(DocumentSettingId::ADD_FLY_OFFSETS); - bool isDOCX = pIDSA->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS); - // tdf#146168 this hack should now only apply to RTF. Any other format (i.e. ODT) should only - // follow this fallback hack if it was created from RTF after its current implementation in 7.2. - // This can be approximated by 128197's new 6.4.7 compat for RTF MsWordCompMinLineHeightByFly - // Anything older than this which has APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING - // did not experience this hack, so it shouldn't apply to ODTs created from older RTFs either. - // In short: we don't want this hack to apply unless absolutely necessary for RTF. - const bool isOnlyRTF - = !isDOC && !isDOCX && pIDSA->get(DocumentSettingId::MS_WORD_COMP_MIN_LINE_HEIGHT_BY_FLY); - - if (isOnlyRTF && !pSet) - { - TextFrameIndex const nTextLen(rInf.GetTextFrame()->GetText().getLength()); - SwTextNode const* pNode(nullptr); - sw::MergedAttrIterReverse iter(*rInf.GetTextFrame()); - for (SwTextAttr const* pHint = iter.PrevAttr(&pNode); pHint; - pHint = iter.PrevAttr(&pNode)) - { - TextFrameIndex const nHintEnd( - rInf.GetTextFrame()->MapModelToView(pNode, pHint->GetAnyEnd())); - if (nHintEnd < nTextLen) - { - break; // only those at para end are interesting - } - // Formatting for the paragraph mark is usually set to apply only to the - // (non-existent) extra character at end of the text node, but there can be - // other hints too (ending at nTextLen), so look for all matching hints. - // Still the (non-existent) extra character at the end is preferred if it exists. - if (pHint->Which() == RES_TXTATR_AUTOFMT) - { - pSet = pHint->GetAutoFormat().GetStyleHandle(); - // When we find an empty hint (start == end) we got what we are looking for. - if (pHint->GetStart() == *pHint->End()) - break; - } - } - } - // Check each item and in case it should be ignored, then clear it. if (!pSet) return;