[Libreoffice-commits] core.git: sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 12 19:10:53 UTC 2021


 sw/source/core/text/txtfld.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit c44b0df04c798e0a0fa094b14b9ed62ebc7594df
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Feb 27 11:33:50 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Fri Mar 12 20:10:08 2021 +0100

    tdf#135774 Char highlight: numbering: don't clear existing mxBackColor
    
    If the numbering had a specified w:shd in numbering.xml,
    then that character background should apply to the bullet point.
    However, SetDiffFnt automatically clears mxBackColor (and I'm not
    sure why - but that has been true since way back to original import).
    Well, in this section the paragraph marker properties should
    only apply if the numbering doesn't have direct formatting already.
    
    So a special step is needed to check if the font has an mxBackColor,
    and since that direct formatting has priority, re-apply it
    after SetDiffFnt has finished.
    
    (P.S. This had been done earlier for GetHighlightColor, but it was
    reverted in 7.0. From my testing, I haven't seen an example where
    it was needed, but it too is reset to null - only it isn't optional.)
    
    Again, a unit test will be challenging here, since this is a
    visual change only.
    
    Change-Id: I2be129b11b6f746ba11c19d69bf01f3174c1b64b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111675
    Tested-by: Jenkins
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 7e5073eb9d6f..3d1bd5845bce 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -521,7 +521,15 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
         }
         pItem = aIter.NextItem();
     };
+
+    // SetDiffFnt resets the background color (why?), so capture it and re-apply if it had a value,
+    // because an existing value should override anything inherited from the paragraph marker.
+    const std::optional<Color> oFontBackColor = pNumFnt->GetBackColor();
+
     pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
+
+    if (oFontBackColor)
+        pNumFnt->SetBackColor(oFontBackColor);
 }
 
 static const SwRangeRedline* lcl_GetRedlineAtNodeInsertionOrDeletion( const SwTextNode& rTextNode )


More information about the Libreoffice-commits mailing list