summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport21.cxx3
-rw-r--r--sw/source/filter/ww8/docxexport.cxx21
2 files changed, 22 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 224f8f2aa27d..d2bd3440a90b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -377,10 +377,9 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_noPageBitmap, "tdf126533_noPageBitmap.doc
getProperty<drawing::FillStyle>(xPageStyle, "FillStyle"));
}
-CPPUNIT_TEST_FIXTURE(Test, testTdf126533_pageGradient)
+DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageGradient, "fill.docx")
{
// given a document with a gradient page background
- loadFromFile(u"fill.docx");
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 466fe652d5dd..787c90e32b12 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -55,6 +55,7 @@
#include <oox/ole/olehelper.hxx>
#include <svx/svdpage.hxx>
+#include <svx/xfillit0.hxx>
#include <svx/xflbmtit.hxx>
#include <map>
@@ -1916,6 +1917,7 @@ void DocxExport::WriteMainText()
msfilter::util::ConvertColor(oBrush->GetColor()));
const SwAttrSet& rPageStyleAttrSet = m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet();
+ const drawing::FillStyle eFillType = rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue();
const GraphicObject* pGraphicObj = oBrush->GetGraphicObject();
if (pGraphicObj) // image/pattern/texture
{
@@ -1934,6 +1936,25 @@ void DocxExport::WriteMainText()
m_pDocumentFS->endElementNS(XML_v, XML_background);
}
}
+ else if (eFillType == drawing::FillStyle_GRADIENT)
+ {
+ SfxItemSetFixed<XATTR_FILL_FIRST, XATTR_FILL_LAST> aSet(m_rDoc.GetAttrPool());
+ aSet.Set(rPageStyleAttrSet);
+
+ // Collect all of the gradient attributes into SdrExporter() AttrLists
+ m_pAttrOutput->OutputStyleItemSet(aSet, /*TestForDefault=*/true);
+ assert(SdrExporter().getFlyAttrList().is() && "type and fillcolor are always provided");
+ assert(SdrExporter().getFlyFillAttrList().is() && "color2 is always provided");
+
+ rtl::Reference<FastAttributeList> xFlyAttrList(SdrExporter().getFlyAttrList());
+ rtl::Reference<FastAttributeList> xFillAttrList(SdrExporter().getFlyFillAttrList());
+ m_pDocumentFS->startElementNS(XML_v, XML_background, xFlyAttrList);
+ m_pDocumentFS->singleElementNS(XML_v, XML_fill, xFillAttrList);
+ m_pDocumentFS->endElementNS(XML_v, XML_background);
+
+ SdrExporter().getFlyAttrList().clear();
+ SdrExporter().getFlyFillAttrList().clear();
+ }
m_pDocumentFS->endElementNS(XML_w, XML_background);
}