diff options
author | Justin Luth <justin.luth@collabora.com> | 2021-03-02 07:46:47 +0200 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2021-03-06 12:16:45 +0100 |
commit | 43436ef43132eb3ee6c10c0fe50971062677682a (patch) | |
tree | 5ad6b9d855cbc9155e639421aa7084be0bb702e3 /sw | |
parent | 92ca16e97856a37a96977187d349e036cd7e5493 (diff) |
tdf#135774 writerfilter Char highlight: revert tdf#117137
revert my 6.1 commit ac27f4e7abf5339f71d4f5f3fc09a13b25669fe4
tdf#117137: DOCX import: don't try to set grab-bag as UNO prop
The ultimate problems in bug 117137 seem to have been fixed
elsewhere and the unit test still passes after the revert.
(Tested in Word 2016 and 2003).
Also my entire tone was one of uncertainty in the review process.
In general, the grabbags should not be ignored, as they are supposed
to just contain import information that should be exported again.
In this specific case, CharGrabBag is needed to identify that
the background was imported as shading, so that it will still
be exported as shading instead of being converted into a highlight.
If this revert causes problems, then the grabbag will need
to remove the problematic items (or keep only the essential items).
Change-Id: I368fcdfca9057426aa6352f1caa7b552d87905d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111937
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf135774_numberingShading.docx | bin | 0 -> 5435 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport16.cxx | 28 |
2 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf135774_numberingShading.docx b/sw/qa/extras/ooxmlexport/data/tdf135774_numberingShading.docx Binary files differnew file mode 100644 index 000000000000..9f62ef2a5a21 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf135774_numberingShading.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx index b7af0c5e69b2..5555a819c00e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <editeng/escapementitem.hxx> +#include <unotools/fltrcfg.hxx> constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/"; @@ -27,6 +28,24 @@ class Test : public SwModelTestBase public: Test() : SwModelTestBase(DATA_DIRECTORY, "Office Open XML Text") {} +virtual std::unique_ptr<Resetter> preTest(const char* filename) override + { + if (OString(filename) == "tdf135774_numberingShading.docx") + { + bool bIsExportAsShading = SvtFilterOptions::Get().IsCharBackground2Shading(); + // This function is run at the end of the test - returning the filter options to normal. + std::unique_ptr<Resetter> pResetter(new Resetter( + [bIsExportAsShading] () { + if (bIsExportAsShading) + SvtFilterOptions::Get().SetCharBackground2Shading(); + })); + // For these tests, ensure exporting CharBackground as w:highlight. + SvtFilterOptions::Get().SetCharBackground2Highlighting(); + return pResetter; + } + return nullptr; + } + protected: /** * Denylist handling @@ -104,6 +123,15 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_num CPPUNIT_ASSERT_EQUAL(72.f, getProperty<float>(xStyle, "CharHeight")); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135773_numberingShading, "tdf135774_numberingShading.docx") +{ + // This test uses preTest to export CharBackground as Highlight instead of the 7.0 default of Shading. + + // Before the fix, the imported shading was converted into a red highlight. + xmlDocUniquePtr pXmlStyles = parseExport("word/numbering.xml"); + assertXPath(pXmlStyles, "/w:numbering/w:abstractNum[@w:abstractNumId='1']/w:lvl[@w:ilvl='0']/w:rPr/w:shd", "fill", "ED4C05"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf139580, "tdf139580.odt") { // Without the fix in place, this test would have crashed at export time |