path: root/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
diff options
authorJustin Luth <>2020-11-21 13:51:47 +0300
committerMiklos Vajna <>2020-12-01 10:52:35 +0100
commit2622cd9c31a5db423c6f878f990a41191d0079af (patch)
treeca24e65054bb5c0a25ebd574d3798eb6efd3902a /sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
parent12142490cd43f8568ab29e0ddfa75b334d6d39d5 (diff)
tdf#137683 sw ms formats Char highlight: export "none"
NONE settings need to be exported in order to cancel out a CharHighlight set at a higher style level. This patch has two main parts. 1.) Export none for DOCX/DOC/RTF 2.) Only export necessary "none" highlights. I am unpleasantly surprised that I did not find any existing functions that avoided spamming unnecessary settings into the export. Perhaps in the default case things are more complicated, but in this case, only paragraph styles are expected to have any hierarchical impact. This could be made into a more general function at some point, but at the moment I don't have anywhere else to apply it, and I would be terribly afraid to try to add it at some general level... Imagine the regressions. Change-Id: I83e5e3496e3ad78c8e2698a6b331c871f842f259 Reviewed-on: Tested-by: Jenkins Reviewed-by: Justin Luth <> Reviewed-by: Miklos Vajna <>
Diffstat (limited to 'sw/qa/extras/ooxmlexport/ooxmlexport15.cxx')
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 65baba8fdb99..1170bdc44d11 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -721,10 +721,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf136441_commentInFootnote, "tdf136441_
DECLARE_OOXMLEXPORT_TEST(testTdf137683_charHighlightTests, "tdf137683_charHighlightTests.docx")
+ // Don't export unnecessary w:highlight="none" (Unnecessary one intentionally hand-added to original .docx)
+ xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
+ if (pXmlStyles)
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:rPr/w:highlight", 0);
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"));
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO), getProperty<sal_Int32>(xRun, "CharHighlight"));
DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx")