summaryrefslogtreecommitdiff
path: root/toolkit/source/awt/vclxwindow.cxx
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 /toolkit/source/awt/vclxwindow.cxx
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 'toolkit/source/awt/vclxwindow.cxx')
-rw-r--r--toolkit/source/awt/vclxwindow.cxx39
1 files changed, 14 insertions, 25 deletions
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 18ce820ab417..1e7c15918ab4 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -1126,7 +1126,7 @@ void VCLXWindow::setBackground( sal_Int32 nColor )
if ( !GetWindow() )
return;
- Color aColor(nColor);
+ Color aColor(ColorTransparency, nColor);
GetWindow()->SetBackground( aColor );
GetWindow()->SetControlBackground( aColor );
@@ -1199,7 +1199,7 @@ void VCLXWindow::setForeground( sal_Int32 nColor )
if ( GetWindow() )
{
- GetWindow()->SetControlForeground( Color(nColor) );
+ GetWindow()->SetControlForeground( Color(ColorTransparency, nColor) );
}
}
@@ -1252,7 +1252,7 @@ namespace toolkit
AllSettings aSettings = _pWindow->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
- (aStyleSettings.*pSetter)( Color( nColor ) );
+ (aStyleSettings.*pSetter)( Color( ColorTransparency, nColor ) );
aSettings.SetStyleSettings( aStyleSettings );
_pWindow->SetSettings( aSettings, true );
@@ -1597,10 +1597,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
}
else
{
- sal_Int32 nColor = 0;
- if ( Value >>= nColor )
+ Color aColor;
+ if ( Value >>= aColor )
{
- Color aColor( nColor );
pWindow->SetControlBackground( aColor );
pWindow->SetBackground( aColor );
switch ( eWinType )
@@ -1627,12 +1626,11 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
}
else
{
- sal_Int32 nColor = 0;
+ Color nColor ;
if ( Value >>= nColor )
{
- Color aColor( nColor );
- pWindow->SetTextColor( aColor );
- pWindow->SetControlForeground( aColor );
+ pWindow->SetTextColor( nColor );
+ pWindow->SetControlForeground( nColor );
}
}
break;
@@ -1643,12 +1641,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
}
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetTextLineColor( aColor );
- }
+ pWindow->SetTextLineColor( nColor );
}
break;
case BASEPROPERTY_FILLCOLOR:
@@ -1656,12 +1651,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
pWindow->SetFillColor();
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetFillColor( aColor );
- }
+ pWindow->SetFillColor( nColor );
}
break;
case BASEPROPERTY_LINECOLOR:
@@ -1669,12 +1661,9 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
pWindow->SetLineColor();
else
{
- sal_Int32 nColor = 0;
+ Color nColor;
if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetLineColor( aColor );
- }
+ pWindow->SetLineColor( nColor );
}
break;
case BASEPROPERTY_BORDER: