sw/qa/extras/ooxmlexport/data/tdf137683_charHighlightTests.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 8 ++++++++ writerfilter/source/dmapper/DomainMapper.cxx | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-)
New commits: commit 81ecdd52ef2f3d390327a0bf6b6fa906805843f7 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Sat Nov 21 11:41:38 2020 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Nov 30 11:01:03 2020 +0100 tdf#137683 writerfilter Char highlight: import "none" Importing a charHighlight of NONE is critical, since charHighlight can be set on a higher para-style, and so there needs to be a way to cancel it with direct formatting. DOC already imports NONE. This adds it for RTF and DOCX. (None of the formats EXPORT it though. So that needs to be done, but try not to spam NONE settings where they are not necessary, please.) Change-Id: Ic5d03ceb81a3a079c827b81561deb9068ae8259e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106314 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf137683_charHighlightTests.docx b/sw/qa/extras/ooxmlexport/data/tdf137683_charHighlightTests.docx new file mode 100644 index 000000000000..7d1e3be60f67 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137683_charHighlightTests.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 0425e05bab32..65baba8fdb99 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -719,6 +719,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf136441_commentInFootnote, "tdf136441_ // (MS Word's UI doesn't allow adding comments to a footnote.) } +DECLARE_OOXMLEXPORT_TEST(testTdf137683_charHighlightTests, "tdf137683_charHighlightTests.docx") +{ + uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(10), 2, "no highlight"), uno::UNO_QUERY_THROW); + // This test was failing with a cyan charHighlight of 65535 (0x00FFFF), instead of COL_TRANSPARENT (0xFFFFFFFF) + if ( !mbExported ) //TODO: export COL_TRANSPARENT + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO), getProperty<sal_Int32>(xRun, "CharHighlight")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index aac420a97500..91b68dd1db77 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3801,7 +3801,7 @@ void DomainMapper::handleParaJustification(const sal_Int32 nIntValue, const ::to bool DomainMapper::getColorFromId(const Id nId, sal_Int32 &nColor) { nColor = 0; - if ((nId < NS_ooxml::LN_Value_ST_HighlightColor_black) || (nId > NS_ooxml::LN_Value_ST_HighlightColor_lightGray)) + if ((nId < NS_ooxml::LN_Value_ST_HighlightColor_black) || (nId > NS_ooxml::LN_Value_ST_HighlightColor_none)) return false; switch (nId) @@ -3822,6 +3822,7 @@ bool DomainMapper::getColorFromId(const Id nId, sal_Int32 &nColor) case NS_ooxml::LN_Value_ST_HighlightColor_darkYellow: nColor=0x808000; break; case NS_ooxml::LN_Value_ST_HighlightColor_darkGray: nColor=0x808080; break; case NS_ooxml::LN_Value_ST_HighlightColor_lightGray: nColor=0xC0C0C0; break; + case NS_ooxml::LN_Value_ST_HighlightColor_none: nColor=0xFFFFFFFF; break; //COL_AUTO default: return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits