sw/qa/extras/globalfilter/globalfilter.cxx                      |    2 +-
 sw/qa/extras/ooxmlexport/data/tdf138345_numberingHighlight.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx                      |    8 ++++++++
 sw/source/core/unocore/unomap1.cxx                              |    2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit f370f7be397af54bf56fd7a6703aae4c38113234
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Sat Feb 27 13:29:50 2021 +0200
Commit:     Justin Luth <justin_l...@sil.org>
CommitDate: Sat Feb 27 15:34:23 2021 +0100

    tdf#138345 Char highlight: numbering needs charstyle props highlight
    
    Although a true character style should ignore RES_CHRATR_HIGHLIGHT
    (and it does on import), the numbering style also uses this map entry,
    so it shouldn't have been removed.
    
    I'm glad I found this example. This partially reverts
    my 7.2 commit 20574b4023952c8fbfa728590f3bdcf603633cca.
    
    When I removed it, Miklos said I should have added API CHANGE
    to the subject. Well, this is still the same 7.2, so the
    net effect is no api change.
    
    Since the attribute now exists, it returns the default of
    COL_TRANSPARENT when queried for CharHighlight.
    So the globalfilter revert was also necessary.
    
    Change-Id: I803e590233ce6db89ac5de246702f02b84692a6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111676
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>

diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 8915ed808232..f84bc2ffc9bd 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -613,7 +613,7 @@ void Test::testCharStyleHighlight()
         const sal_Int32 nBackColor(0xFFDBB6); //orange-y
 
         // Always export character style's background colour as shading, never 
as highlighting.
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), false, 
hasProperty(xCharStyle,"CharHighlight"));
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(COL_TRANSPARENT), 
getProperty<sal_Int32>(xCharStyle,"CharHighlight"));
         CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), nBackColor, 
getProperty<sal_Int32>(xCharStyle,"CharBackColor"));
     }
 }
diff --git a/sw/qa/extras/ooxmlexport/data/tdf138345_numberingHighlight.docx 
b/sw/qa/extras/ooxmlexport/data/tdf138345_numberingHighlight.docx
new file mode 100644
index 000000000000..0083b1b38dd0
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf138345_numberingHighlight.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 7e9b7d403e1e..3fa4c0f94d93 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -789,6 +789,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138345_charStyleHighlight, 
"tdf138345_charStyleH
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_TRANSPARENT), 
getProperty<sal_Int32>(xRun,"CharBackColor"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf138345_numberingHighlight, 
"tdf138345_numberingHighlight.docx")
+{
+    // Before the fix, the highlight was completely lost.
+    xmlDocUniquePtr pXmlStyles = parseExport("word/numbering.xml");
+    if (pXmlStyles)
+        assertXPath(pXmlStyles, 
"/w:numbering/w:abstractNum[@w:abstractNumId='1']/w:lvl[@w:ilvl='0']/w:rPr/w:highlight",
 "val", "red");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")
 {
     CPPUNIT_ASSERT_EQUAL(2, getPages());
diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index 253da09f67f1..8262630c08b0 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -185,7 +185,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetCharStylePropertyMa
         { u"" UNO_NAME_CHAR_AUTO_KERNING, RES_CHRATR_AUTOKERN  ,  
cppu::UnoType<bool>::get()  ,       PROPERTY_NONE,     0},
         { u"" UNO_NAME_CHAR_BACK_TRANSPARENT, RES_CHRATR_BACKGROUND,  
cppu::UnoType<bool>::get(),         PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT      
 },
         { u"" UNO_NAME_CHAR_BACK_COLOR, RES_CHRATR_BACKGROUND,    
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE ,MID_BACK_COLOR        
},
-        // RES_CHRATR_HIGHLIGHT was only here for MS compatibility, but MS 
ignores highlighting in char-styles
+        { u"" UNO_NAME_CHAR_HIGHLIGHT, RES_CHRATR_HIGHLIGHT, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_BACK_COLOR },
         { u"" UNO_NAME_CHAR_CASE_MAP, RES_CHRATR_CASEMAP,     
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},
         { u"" UNO_NAME_CHAR_COLOR, RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},
         { u"" UNO_NAME_CHAR_TRANSPARENCE, RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA},
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to