diff options
author | Justin Luth <justin_luth@sil.org> | 2019-10-01 10:02:20 +0300 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-10-02 11:39:04 +0200 |
commit | e3c1be1149440fdcfea452aadce0a523af83fe5a (patch) | |
tree | 819719e69791cd2b2e9785375b307b0332f10a0e /sw | |
parent | cb5eaa791739865d54b381c16c60224c432171dc (diff) |
tdf#127862 ww8import: page style - import XATTR if defined
...which fixes losing the background color of the page. That was
broken by LO63 commit cc899c6967238877f0094bcf00627145e484ffec
since an obsolete RES_BACKGROUND was not necessarily created.
Change-Id: I944a1b3f3df1468c283f93a49ffacfbd223fb392
Reviewed-on: https://gerrit.libreoffice.org/79912
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport4.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt | bin | 0 -> 38808 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 8 |
4 files changed, 21 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index a2b2cf41c6ed..f2ce3fb3fe2a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -749,6 +749,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf38778, "tdf38778_properties_in_run_for_field.doc // w:fldCharType="end" assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[7]/w:rPr/w:sz", "val", psz); assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[7]/w:rPr/w:szCs", "val", pszCs); + + // tdf#127862: page fill color (in this case white) was lost + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle")); } DECLARE_OOXMLEXPORT_TEST(testFDO76312, "FDO76312.docx") diff --git a/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt Binary files differnew file mode 100644 index 000000000000..c382c9aa6735 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf127862_pageFillStyle.odt diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 801e77eff3f5..468021617630 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -45,7 +45,11 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d // The problem was that section protection was being enabled in addition to being read-only. // This created an explicit section with protection. There should be just the default, non-explicit section. CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), xSections->getCount()); - } + + // tdf#127862: page fill color (in this case white) was lost + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle")); +} DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") { @@ -212,6 +216,12 @@ DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xText, "ParaBackColor"))); } +DECLARE_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt") +{ + uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle")); +} + DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt") { uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"), diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index a525b2a996d0..ad5f7ef5e3d6 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4359,10 +4359,14 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection, // Only handle shape if it is a background shape if (aData.begin()->get()->nFlags & ShapeFlag::Background) { - SfxItemSet aSet(rFormat.GetAttrSet()); + SfxItemSet aSet(rFormat.GetDoc()->GetAttrPool(), + svl::Items<RES_BACKGROUND, RES_BACKGROUND,XATTR_START, XATTR_END>{}); mrReader.MatchSdrItemsIntoFlySet(pObject, aSet, mso_lineSimple, mso_lineSolid, mso_sptRectangle, aRect); - rFormat.SetFormatAttr(aSet.Get(RES_BACKGROUND)); + if ( aSet.HasItem(RES_BACKGROUND) ) + rFormat.SetFormatAttr(aSet.Get(RES_BACKGROUND)); + else + rFormat.SetFormatAttr(aSet); } } SdrObject::Free(pObject); |