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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Sat Mar 13 11:01:15 UTC 2021


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

New commits:
commit cb7839169ac58bc24d986f4cf5532d1d6219574d
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Sat Mar 13 09:45:27 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Sat Mar 13 12:00:31 2021 +0100

    tdf#135774 Char highlight: partial revert tdf#114799
    
    ...DOCX import: fix missing numbering highlight
    from 7.0 commit 315d56582f8a56d8f2d3ea6cda63ea4832249608.
    
    If the numbering had a specified w:highlight in numbering.xml,
    then that character background should apply to the bullet point.
    
    However, SetDiffFnt automatically clears the highlight,
    the same as it does with mxBackColor (fixed in earlier commit).
    So a special step is needed to check if the font has a highlight,
    and since that direct formatting has priority, re-apply it
    after SetDiffFnt has finished.
    
    This is slightly different from mxBackColor - which is an
    optional attribute. Highlight is reset to COL_TRANSPARENT.
    If a RES_CHRATR_HIGHLIGHT exists explicitly setting a
    COL_TRANSPARENT, then any overrides should have been removed from
    pCleanedSet, and so it never needs to SetHighlightColor(AUTO).
    
    Change-Id: Id9d88054254563706b9aee90a1d257b467139334
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112410
    Tested-by: Jenkins
    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 3d1bd5845bce..e889ada8d8d4 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -525,11 +525,15 @@ static void checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
     // 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();
+    // The same is true for the highlight color.
+    const Color aHighlight = pNumFnt->GetHighlightColor();
 
     pNumFnt->SetDiffFnt(pCleanedSet.get(), pIDSA);
 
     if (oFontBackColor)
         pNumFnt->SetBackColor(oFontBackColor);
+    if (aHighlight != COL_TRANSPARENT)
+        pNumFnt->SetHighlightColor(aHighlight);
 }
 
 static const SwRangeRedline* lcl_GetRedlineAtNodeInsertionOrDeletion( const SwTextNode& rTextNode )


More information about the Libreoffice-commits mailing list