summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-08-05 20:21:13 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-16 11:50:02 +0000
commit834ae34d7f16f37078bf0065af8bff29f9d5c422 (patch)
tree4d644e870d2ceb3fdc7d6ab50095c6eb2dacdad0
parent804c46020f03d06331928e43b9ba1e694b0d473c (diff)
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 <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 2a174c2f6fd58a31eb150b84de83e5ba1c4d3fed) Reviewed-on: https://gerrit.libreoffice.org/28155
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf97090.docxbin0 -> 29899 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx18
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.cxx9
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.hxx1
4 files changed, 27 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf97090.docx b/sw/qa/extras/ooxmlexport/data/tdf97090.docx
new file mode 100644
index 000000000000..3ba402718e95
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf97090.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4bb34edb9382..cb20af147ff1 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 6845c8a4d62b..47d329d245fa 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 98fe7916b181..98c8aaf18ddf 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;