sw/qa/extras/ooxmlexport/data/tdf97090.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 18 ++++++++++++++++++ writerfilter/source/dmapper/CellColorHandler.cxx | 9 ++++++++- writerfilter/source/dmapper/CellColorHandler.hxx | 1 + 4 files changed, 27 insertions(+), 1 deletion(-)
New commits: commit 2a174c2f6fd58a31eb150b84de83e5ba1c4d3fed Author: Justin Luth <justin_l...@sil.org> Date: Fri Aug 5 20:21:13 2016 +0300 tdf#97090 writerfilter - don't fill_SOLID with auto color fixes a regression from 24077b2d52ab3d0fd0db5afb25d8b94b62386e3e <w:shd w:val="clear" w:color="auto" w:fill="auto"> seems to be the default "fill disabled" state, so don't force a solid white fill in that case. Change-Id: Ia421e52e228bbf0d3a2cd9af72e0a580042e5dcd Reviewed-on: https://gerrit.libreoffice.org/27915 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlexport/data/tdf97090.docx b/sw/qa/extras/ooxmlexport/data/tdf97090.docx new file mode 100644 index 0000000..3ba4027 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf97090.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 4bb34ed..cb20af1 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -718,6 +718,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf88583, "tdf88583.odt") CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), getProperty<sal_Int32>(getParagraph(1), "FillColor")); } +DECLARE_OOXMLEXPORT_TEST(testTdf97090, "tdf97090.docx") +{ + uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x95B3D7), getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor")); + + uno::Reference<container::XEnumerationAccess> paraEnumAccess(xTable->getCellByName("A1"), uno::UNO_QUERY); + assert( paraEnumAccess.is() ); + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + + assert( paraEnum.is() ); + uno::Reference<beans::XPropertySet> paragraphProperties(paraEnum->nextElement(), uno::UNO_QUERY); + assert( paragraphProperties.is() ); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(paragraphProperties, "FillStyle")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffff), getProperty<sal_Int32>(paragraphProperties, "FillColor")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf89791, "tdf89791.docx") { if (mbExported) diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx index 6845c8a..47d329d 100644 --- a/writerfilter/source/dmapper/CellColorHandler.cxx +++ b/writerfilter/source/dmapper/CellColorHandler.cxx @@ -37,6 +37,7 @@ LoggedProperties("CellColorHandler"), m_nShadingPattern( drawing::ShadingPattern::CLEAR ), m_nColor( 0xffffffff ), m_nFillColor( 0xffffffff ), +m_bAutoFillColor( true ), m_OutputFormat( Form ) { } @@ -110,6 +111,9 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal) createGrabBag("fill", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue, /*bAutoColor=*/true)))); if( nIntValue == OOXML_COLOR_AUTO ) nIntValue = 0xffffff; //fill color auto means white + else + m_bAutoFillColor = false; + m_nFillColor = nIntValue; break; case NS_ooxml::LN_CT_Shd_color: @@ -271,7 +275,10 @@ TablePropertyMapPtr CellColorHandler::getProperties() if (m_OutputFormat == Paragraph) { - pPropertyMap->Insert(PROP_FILL_STYLE, uno::makeAny(drawing::FillStyle_SOLID)); + // If brush style = clear and FillColor = COLOR_AUTO, then don't enable the fill style - just pre-select the default color + if (nWW8BrushStyle || !m_bAutoFillColor) + pPropertyMap->Insert(PROP_FILL_STYLE, uno::makeAny(drawing::FillStyle_SOLID)); + pPropertyMap->Insert(PROP_FILL_COLOR, uno::makeAny(nApplyColor)); } else diff --git a/writerfilter/source/dmapper/CellColorHandler.hxx b/writerfilter/source/dmapper/CellColorHandler.hxx index 98fe791..98c8aaf 100644 --- a/writerfilter/source/dmapper/CellColorHandler.hxx +++ b/writerfilter/source/dmapper/CellColorHandler.hxx @@ -37,6 +37,7 @@ private: sal_Int32 m_nShadingPattern; sal_Int32 m_nColor; sal_Int32 m_nFillColor; + bool m_bAutoFillColor; OutputFormat m_OutputFormat; OUString m_aInteropGrabBagName; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits