summaryrefslogtreecommitdiff
path: root/xmloff
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 /xmloff
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 'xmloff')
-rw-r--r--xmloff/source/chart/ColorPropertySet.cxx2
-rw-r--r--xmloff/source/style/TransGradientStyle.cxx4
-rw-r--r--xmloff/source/style/xmlnumi.cxx6
3 files changed, 5 insertions, 7 deletions
diff --git a/xmloff/source/chart/ColorPropertySet.cxx b/xmloff/source/chart/ColorPropertySet.cxx
index ea15d40161dc..6e3e046923df 100644
--- a/xmloff/source/chart/ColorPropertySet.cxx
+++ b/xmloff/source/chart/ColorPropertySet.cxx
@@ -77,7 +77,7 @@ namespace xmloff::chart
{
ColorPropertySet::ColorPropertySet( sal_Int32 nColor ) :
- m_nColor( nColor ),
+ m_nColor( ColorTransparency, nColor ),
m_nDefaultColor( 0x0099ccff ) // blue 8
{}
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index a745440a1197..110c25061e27 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -219,14 +219,14 @@ void XMLTransGradientStyleExport::exportXML(
}
// Transparency start
- Color aColor(aGradient.StartColor);
+ Color aColor(ColorTransparency, aGradient.StartColor);
sal_Int32 aStartValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
::sax::Converter::convertPercent( aOut, aStartValue );
aStrValue = aOut.makeStringAndClear();
rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
// Transparency end
- aColor = Color(aGradient.EndColor);
+ aColor = Color(ColorTransparency, aGradient.EndColor);
sal_Int32 aEndValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
::sax::Converter::convertPercent( aOut, aEndValue );
aStrValue = aOut.makeStringAndClear();
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 7688ea74ac67..80f65a55f90b 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -617,11 +617,9 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
case XML_ELEMENT(FO, XML_COLOR):
case XML_ELEMENT(FO_COMPAT, XML_COLOR):
{
- sal_Int32 nColor(0);
+ Color nColor;
if (::sax::Converter::convertColor( nColor, aIter.toView() ))
- {
- rListLevel.SetColor( Color(nColor) );
- }
+ rListLevel.SetColor( nColor );
}
break;
case XML_ELEMENT(STYLE, XML_USE_WINDOW_FONT_COLOR):