diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-15 14:49:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-16 10:07:07 +0100 |
commit | 63a68064bb33f180b8a231f7524d99405d910226 (patch) | |
tree | 7ecf05b057c5ca4d80a48af045998a4b34484561 /sc/source/core | |
parent | d534a4c7b45ff254b339e806c6a11f13d9ff0043 (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 'sc/source/core')
-rw-r--r-- | sc/source/core/tool/appoptio.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/viewopti.cxx | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx index d71d59a3b66b..fda7236be3c6 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -422,16 +422,16 @@ ScAppCfg::ScAppCfg() : switch(nProp) { case SCREVISOPT_CHANGE: - if (pValues[nProp] >>= nIntVal) SetTrackContentColor( Color(nIntVal) ); + if (pValues[nProp] >>= nIntVal) SetTrackContentColor( Color(ColorTransparency, nIntVal) ); break; case SCREVISOPT_INSERTION: - if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( Color(nIntVal) ); + if (pValues[nProp] >>= nIntVal) SetTrackInsertColor( Color(ColorTransparency, nIntVal) ); break; case SCREVISOPT_DELETION: - if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( Color(nIntVal) ); + if (pValues[nProp] >>= nIntVal) SetTrackDeleteColor( Color(ColorTransparency, nIntVal) ); break; case SCREVISOPT_MOVEDENTRY: - if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( Color(nIntVal) ); + if (pValues[nProp] >>= nIntVal) SetTrackMoveColor( Color(ColorTransparency, nIntVal) ); break; } } diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index 3678e1866a17..45b06b47a1fa 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -294,9 +294,12 @@ ScViewCfg::ScViewCfg() : switch(nProp) { case SCLAYOUTOPT_GRIDCOLOR: - if ( pValues[nProp] >>= nIntVal ) - SetGridColor( Color(nIntVal), EMPTY_OUSTRING ); + { + Color aColor; + if ( pValues[nProp] >>= aColor ) + SetGridColor( aColor, EMPTY_OUSTRING ); break; + } case SCLAYOUTOPT_GRIDLINES: SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); break; |