summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-08-22 09:25:37 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-09-05 10:17:32 +0200
commit7d9e9ecd5bb5d5abec338c2ceb61ad623d2ac5cb (patch)
tree1117a7f8fdbe9a6264f2a81392cb5020e028cc5e /writerfilter/source
parent1d4f03114f3fb04fc1b493193e3eddee07cdabb8 (diff)
tdf#90906 writerfilter: Allow COL_AUTO to override non-auto
If the inherited properties define a non-auto color, then a specified COL_AUTO needs to be returned in order to override the inherited color. This affects three areas. Character fill, Paragraph fill, and table cell fill. The unit tests cover all three areas. This patch depends on the commits for tdf#91292 Change-Id: I1a043d2224b164c6c411ce2e46d899212f2b7f3d Reviewed-on: https://gerrit.libreoffice.org/59313 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.cxx12
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.hxx1
2 files changed, 10 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index 968c1b1f553f..a19a984d6e7e 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -39,6 +39,7 @@ m_nShadingPattern( drawing::ShadingPattern::CLEAR ),
m_nColor( 0xffffffff ),
m_nFillColor( 0xffffffff ),
m_bAutoFillColor( true ),
+m_bFillSpecified( false ),
m_OutputFormat( Form )
{
}
@@ -116,6 +117,7 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
m_bAutoFillColor = false;
m_nFillColor = nIntValue;
+ m_bFillSpecified = true;
break;
case NS_ooxml::LN_CT_Shd_color:
createGrabBag("color", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
@@ -205,7 +207,10 @@ TablePropertyMapPtr CellColorHandler::getProperties()
if( !nWW8BrushStyle )
{
// Clear-Brush
- nApplyColor = m_nFillColor;
+ if ( m_bFillSpecified && m_bAutoFillColor )
+ nApplyColor = sal_Int32(COL_AUTO);
+ else
+ nApplyColor = m_nFillColor;
}
else
{
@@ -273,13 +278,14 @@ TablePropertyMapPtr CellColorHandler::getProperties()
if (m_OutputFormat == Paragraph)
{
- // 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));
+ else if ( m_bFillSpecified && m_bAutoFillColor )
+ pPropertyMap->Insert(PROP_FILL_STYLE, uno::makeAny(drawing::FillStyle_NONE));
pPropertyMap->Insert(PROP_FILL_COLOR, uno::makeAny(nApplyColor));
}
- else if (nWW8BrushStyle || !m_bAutoFillColor)
+ else if ( nWW8BrushStyle || !m_bAutoFillColor || m_bFillSpecified )
pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
: PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
diff --git a/writerfilter/source/dmapper/CellColorHandler.hxx b/writerfilter/source/dmapper/CellColorHandler.hxx
index 7a1d0e1cd643..fb72be4262bb 100644
--- a/writerfilter/source/dmapper/CellColorHandler.hxx
+++ b/writerfilter/source/dmapper/CellColorHandler.hxx
@@ -38,6 +38,7 @@ private:
sal_Int32 m_nColor;
sal_Int32 m_nFillColor;
bool m_bAutoFillColor;
+ bool m_bFillSpecified;
OutputFormat m_OutputFormat;
OUString m_aInteropGrabBagName;