sw/source/core/text/txtfld.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 27df5ef405826875340645b9b979bd5c2c0b92cc Author: Justin Luth <jl...@mail.com> AuthorDate: Mon Feb 27 10:52:53 2023 -0500 Commit: Justin Luth <jl...@mail.com> CommitDate: Tue Feb 28 14:32:21 2023 +0000 tdf#146168 tdf#150613 list attributes: limit hack to RTF This fixes an ODT regression from LO 7.2's commit 0a32371cc2f93fad7954e0fe9c48976aae6c5b9f. The hack applies the last character formatting in the paragraph to the numbering characters. This was a hack that existed for DOC and DOCX and RTF in various troublesome modes for quite a while. However, recently since 6.4ish era there have been some improvements for DOC and DOCX, so these have been excluded and now only RTF remains. Most of the time an RTF file also looks like a DOC (from a compat settings point of view), so even RTF files usually don't have this clause apply. In fact, I looked for the RTF files that this hack still applies to, but couldn't find a single example. Really? Did something change? I also looked for examples of files I will be excluding (!isOnlyRTF) and only found tdf135973.odt and tdf146955.odt. Neither one has character formatting on their numbered lists, so they can't be used effectively for a unit test. It is somewhat pointless to make a test. I don't even think we can round-trip an RTF that has these characteristics. Likely the best thing is to just drop the hack altogether, especially since it would pass the unit tests now. (I'm sure it was failing before.) If we can't round-trip it, is there any point in having this non-import hack in place? Change-Id: I2f95c10e1d0a9dc53b01027e9c97e5ded29c6750 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147939 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 1c05055c2ddc..5a4e7229334b 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -435,7 +435,16 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm // TODO remove this fallback for RTF bool isDOC = pIDSA->get(DocumentSettingId::ADD_FLY_OFFSETS); bool isDOCX = pIDSA->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS); - if (!isDOC && !isDOCX && !pSet) + // 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);