diff options
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/page-background.docx | bin | 0 -> 10041 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 3 | ||||
-rw-r--r-- | writerfilter/source/ooxml/model.xml | 2 |
6 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/page-background.docx b/sw/qa/extras/ooxmlimport/data/page-background.docx Binary files differnew file mode 100644 index 000000000000..8c1f2ebdb239 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/page-background.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index e9f4839f85c4..adbe8723740c 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -113,6 +113,7 @@ public: void testN592908_Picture(); void testN779630(); void testIndentation(); + void testPageBackground(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -194,6 +195,7 @@ void Test::run() {"n592908-picture.docx", &Test::testN592908_Picture}, {"n779630.docx", &Test::testN779630}, {"indentation.docx", &Test::testIndentation}, + {"page-background.docx", &Test::testPageBackground}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1379,6 +1381,13 @@ void Test::testIndentation() CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, getProperty<sal_Int16>(xPropertySet, "WritingMode")); } +void Test::testPageBackground() +{ + // The problem was that <w:background w:color="92D050"/> was ignored. + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0be87b7fee49..cfc7c1ad68bd 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1445,6 +1445,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_SdtListItem_value: m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue); break; + case NS_ooxml::LN_CT_Background_color: + m_pImpl->m_oBackgroundColor.reset(nIntValue); + break; default: { #if OSL_DEBUG_LEVEL > 0 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index b7da3a937a95..fba658aafb3f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -684,6 +684,9 @@ public: bool m_bInTableStyleRunProps; SdtHelper* m_pSdtHelper; + + /// Document background color, applied to every page style. + boost::optional<sal_Int32> m_oBackgroundColor; }; } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 9e22551ff686..2ab0ff5b77dc 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -889,6 +889,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) = uno::makeAny( m_nLeftMargin ); operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = uno::makeAny( m_nRightMargin ); + if (rDM_Impl.m_oBackgroundColor) + operator[](PropertyDefinition(PROP_BACK_COLOR, false)) = uno::makeAny(*rDM_Impl.m_oBackgroundColor); + /*** if headers/footers are available then the top/bottom margins of the header/footer are copied to the top/bottom margin of the page */ diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 0e11017cc142..cdafa91e89bf 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -14997,7 +14997,7 @@ <ref name="CT_PictureBase"/> <optional> <attribute name="color"> - <text/> + <ref name="ST_HexColor"/> <xs:documentation>Background Color</xs:documentation> </attribute> </optional> |