summaryrefslogtreecommitdiff
path: root/svtools/source
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 /svtools/source
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 'svtools/source')
-rw-r--r--svtools/source/config/colorcfg.cxx4
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx8
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx2
3 files changed, 7 insertions, 7 deletions
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index bbb2f3ba1cfc..6a17045de74a 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -225,9 +225,9 @@ void ColorConfig_Impl::Load(const OUString& rScheme)
{
if(pColors[nIndex].hasValue())
{
- sal_Int32 nTmp(0);
+ Color nTmp;
pColors[nIndex] >>= nTmp;
- m_aConfigValues[i].nColor = Color(nTmp);
+ m_aConfigValues[i].nColor = nTmp;
}
else
m_aConfigValues[i].nColor = COL_AUTO;
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 18a2ab4a00a7..f975ee9fc8af 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -332,18 +332,18 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
case PROPERTYHANDLE_STRIPE_COLOR_A:
{
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
- sal_Int32 nValue = 0;
+ Color nValue;
seqValues[nProperty] >>= nValue;
- m_bStripeColorA = Color(nValue);
+ m_bStripeColorA = nValue;
}
break;
case PROPERTYHANDLE_STRIPE_COLOR_B:
{
DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
- sal_Int32 nValue = 0;
+ Color nValue;
seqValues[nProperty] >>= nValue;
- m_bStripeColorB = Color(nValue);
+ m_bStripeColorB = nValue;
}
break;
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index f069cad74cc9..96f3722b994c 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -653,7 +653,7 @@ namespace svt::table
{
::std::vector< ::Color > aColors( aAPIColors.getLength() );
std::transform(aAPIColors.begin(), aAPIColors.end(), aColors.begin(),
- [](const css::util::Color& rAPIColor) -> ::Color { return Color(rAPIColor); });
+ [](const css::util::Color& rAPIColor) -> ::Color { return Color(ColorTransparency, rAPIColor); });
m_aRowColors = aColors;
}
}