From 0a32371cc2f93fad7954e0fe9c48976aae6c5b9f Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Wed, 10 Mar 2021 14:41:57 +0200 Subject: tdf#108518 partial revert tdf#64222 sw: better DOCX im/export ...of paragraph marker formatting 6.4 commit 5ba30f588d6e41a13d68b1461345fca7a7ca61ac Ultimately, this just reverts back to an earlier 6.4 change (which means that this really is untested and unproven)... > Also revert the change in checkApplyParagraphMarkFormatToNumbering() > to consider hints that start before the end of the paragraph, > as it has unintended side effects as pointed out by Mike Kaganski. But those side effects were from a DOCX file, and DOCX isn't processed here anymore. The (unedited) comment (still) says: //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 So, that suggests that there is more than one possible valid autofmt, and that not ALL autofmts will have a start==end. This is being considered since it fixes the one example file that I could find that still broke when reverting OOo's 2012 hack commit 1c22545edf9085b9f2656ca92781158b6b123db3 Fix issue #i119405: Numbering text style changed after importing the *.doc The other alternative would be to // TODO remove this fallback (for WW8/RTF) Change-Id: I69b6e31fe570742b4b9dd94d2cce2b5b9850360d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112319 Tested-by: Justin Luth Reviewed-by: Justin Luth --- sw/source/core/text/txtfld.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index e889ada8d8d4..795228efd5b3 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -446,12 +446,12 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm // (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 - && pHint->GetStart() == *pHint->End()) + 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. - break; + if (pHint->GetStart() == *pHint->End()) + break; } } } -- cgit