summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-01-15 14:49:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-16 10:07:07 +0100
commit63a68064bb33f180b8a231f7524d99405d910226 (patch)
tree7ecf05b057c5ca4d80a48af045998a4b34484561 /writerfilter/source/dmapper
parentd534a4c7b45ff254b339e806c6a11f13d9ff0043 (diff)
make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place, and add a clang plugin to detect when the value passed to the existing constructor may contain transparency/alpha data. i.e. we leave expressions like Color(0xffffff) alone, but warn about any non-constant expression, and any expression like Color(0xff000000) Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r--writerfilter/source/dmapper/BorderHandler.cxx2
-rw-r--r--writerfilter/source/dmapper/CellColorHandler.cxx6
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx2
-rw-r--r--writerfilter/source/dmapper/TDefTableHandler.cxx2
4 files changed, 6 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx
index 5769daa5b335..0045805d6e85 100644
--- a/writerfilter/source/dmapper/BorderHandler.cxx
+++ b/writerfilter/source/dmapper/BorderHandler.cxx
@@ -66,7 +66,7 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal)
break;
case NS_ooxml::LN_CT_Border_color:
m_nLineColor = nIntValue;
- appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
+ appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nIntValue))));
break;
case NS_ooxml::LN_CT_Border_space: // border distance in points
m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue * 20 );
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index 805f6e1bb6da..193477a31fc2 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -107,7 +107,7 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
}
break;
case NS_ooxml::LN_CT_Shd_fill:
- createGrabBag("fill", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
+ createGrabBag("fill", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nIntValue)))));
if( nIntValue == sal_Int32(COL_AUTO) )
nIntValue = 0xffffff; //fill color auto means white
else
@@ -117,7 +117,7 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
m_bFillSpecified = true;
break;
case NS_ooxml::LN_CT_Shd_color:
- createGrabBag("color", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue))));
+ createGrabBag("color", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nIntValue)))));
if( nIntValue == sal_Int32(COL_AUTO) )
nIntValue = 0; //shading color auto means black
//color of the shading
@@ -286,7 +286,7 @@ TablePropertyMapPtr CellColorHandler::getProperties()
pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
: PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
- createGrabBag("originalColor", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(nApplyColor))));
+ createGrabBag("originalColor", uno::makeAny(OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency, nApplyColor)))));
return pPropertyMap;
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index c3d246523a12..74502be05b3f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -328,7 +328,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Color_val:
if (m_pImpl->GetTopContext())
m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR, uno::makeAny( nIntValue ) );
- m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
+ m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "val", OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency,nIntValue))));
break;
case NS_ooxml::LN_CT_Underline_color:
if (m_pImpl->GetTopContext())
diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx
index deac21075535..9d7059feece6 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -284,7 +284,7 @@ void TDefTableHandler::lcl_attribute(Id rName, Value & rVal)
appendGrabBag("val", TDefTableHandler::getBorderTypeString(nIntValue));
break;
case NS_ooxml::LN_CT_Border_color:
- appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(nIntValue)));
+ appendGrabBag("color", OUString::fromUtf8(msfilter::util::ConvertColor(Color(ColorTransparency,nIntValue))));
m_nLineColor = nIntValue;
break;
case NS_ooxml::LN_CT_Border_space: