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_luth@sil.org>
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index 8915ed8..f84bc2f 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 0000000..0083b1b
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf138345_numberingHighlight.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 7e9b7d4..3fa4c0f 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 253da09..8262630 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},