diff options
-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 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 3 |
3 files changed, 29 insertions, 2 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 diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 2143f3b2f04c..ac8a9a4216eb 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -165,10 +165,9 @@ static bool IgnoreForCharStyle(std::u16string_view aStr, const bool bIsSymbol) //Names found in PropertyIds.cxx, Lines 56-396 return (aStr==u"Adjust" || aStr==u"IndentAt" || aStr==u"FirstLineIndent" || aStr==u"FirstLineOffset" || aStr==u"LeftMargin" - || aStr==u"CharInteropGrabBag" || aStr==u"ParaInteropGrabBag" || // We need font names when they are different for the bullet and for the text. // But leave symbols alone, we only want to keep the font style for letters and numbers. - (bIsSymbol && aStr==u"CharFontName") + || (bIsSymbol && aStr==u"CharFontName") ); } uno::Sequence< beans::PropertyValue > ListLevel::GetCharStyleProperties( ) |