summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2020-11-21 11:41:38 +0300
committerMiklos Vajna <vmiklos@collabora.com>2020-11-30 11:01:03 +0100
commit81ecdd52ef2f3d390327a0bf6b6fa906805843f7 (patch)
tree3b4947a40f34e929c47311951a60b5721d891d61
parent7f477f8dd85c84c9c1a9e673b685dc0e03d1d45a (diff)
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_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf137683_charHighlightTests.docxbin0 -> 9877 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx3
3 files changed, 10 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf137683_charHighlightTests.docx
Binary files 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;
}