Kaydet (Commit) a0a57a35 authored tarafından Noel Grandin's avatar Noel Grandin

use more Color in toolkit

Change-Id: I88860e4180db2c46acda1739235c248a38bb068d
Reviewed-on: https://gerrit.libreoffice.org/50798Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst f02b1ba1
......@@ -132,15 +132,15 @@ namespace toolkit
const VclPtr<vcl::Window>& pWindow = i_rData.pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return (aStyleSettings.*i_pGetter)().GetColor();
return sal_Int32((aStyleSettings.*i_pGetter)());
}
void lcl_setStyleColor( WindowStyleSettings_Data const & i_rData, void (StyleSettings::*i_pSetter)( Color const & ), const sal_Int32 i_nColor )
void lcl_setStyleColor( WindowStyleSettings_Data const & i_rData, void (StyleSettings::*i_pSetter)( Color const & ), sal_Int32 i_nColor )
{
VclPtr<vcl::Window> pWindow = i_rData.pOwningWindow->GetWindow();
AllSettings aAllSettings = pWindow->GetSettings();
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
(aStyleSettings.*i_pSetter)( Color( i_nColor ) );
(aStyleSettings.*i_pSetter)( Color(i_nColor) );
aAllSettings.SetStyleSettings( aStyleSettings );
pWindow->SetSettings( aAllSettings );
}
......@@ -383,7 +383,7 @@ namespace toolkit
const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetFaceGradientColor().GetColor();
return sal_Int32(aStyleSettings.GetFaceGradientColor());
}
......@@ -673,7 +673,7 @@ namespace toolkit
const VclPtr<vcl::Window>& pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetSeparatorColor().GetColor();
return sal_Int32(aStyleSettings.GetSeparatorColor());
}
......
......@@ -720,12 +720,12 @@ sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( )
{
OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0;
Color nColor;
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
if ( pWindow->IsControlForeground() )
nColor = pWindow->GetControlForeground().GetColor();
nColor = pWindow->GetControlForeground();
else
{
vcl::Font aFont;
......@@ -733,31 +733,31 @@ sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( )
aFont = pWindow->GetControlFont();
else
aFont = pWindow->GetFont();
nColor = aFont.GetColor().GetColor();
nColor = aFont.GetColor();
// COL_AUTO is not very meaningful for AT
if ( nColor == sal_Int32(COL_AUTO))
nColor = pWindow->GetTextColor().GetColor();
if ( nColor == COL_AUTO)
nColor = pWindow->GetTextColor();
}
}
return nColor;
return sal_Int32(nColor);
}
sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( )
{
OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0;
Color nColor;
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
{
if ( pWindow->IsControlBackground() )
nColor = pWindow->GetControlBackground().GetColor();
nColor = pWindow->GetControlBackground();
else
nColor = pWindow->GetBackground().GetColor().GetColor();
nColor = pWindow->GetBackground().GetColor();
}
return nColor;
return sal_Int32(nColor);
}
// XAccessibleExtendedComponent
......
......@@ -192,28 +192,28 @@ void VCLXGraphics::setTextColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
maTextColor = Color( static_cast<sal_uInt32>(nColor) );
maTextColor = Color( nColor );
}
void VCLXGraphics::setTextFillColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
maTextFillColor = Color( static_cast<sal_uInt32>(nColor) );
maTextFillColor = Color( nColor );
}
void VCLXGraphics::setLineColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
maLineColor = Color( static_cast<sal_uInt32>(nColor) );
maLineColor = Color( nColor );
}
void VCLXGraphics::setFillColor( sal_Int32 nColor )
{
SolarMutexGuard aGuard;
maFillColor = Color( static_cast<sal_uInt32>(nColor) );
maFillColor = Color( nColor );
}
void VCLXGraphics::setRasterOp( awt::RasterOperation eROP )
......@@ -459,7 +459,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_
if( mpOutputDevice )
{
InitOutputDevice( InitOutDevFlags::COLORS );
Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), rGradient.StartColor, rGradient.EndColor);
Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(rGradient.StartColor), Color(rGradient.EndColor));
aGradient.SetAngle(rGradient.Angle);
aGradient.SetBorder(rGradient.Border);
aGradient.SetOfsX(rGradient.XOffset);
......
......@@ -1157,7 +1157,7 @@ void VCLXWindow::setBackground( sal_Int32 nColor )
if ( GetWindow() )
{
Color aColor( static_cast<sal_uInt32>(nColor) );
Color aColor = Color(nColor);
GetWindow()->SetBackground( aColor );
GetWindow()->SetControlBackground( aColor );
......@@ -1231,8 +1231,7 @@ void VCLXWindow::setForeground( sal_Int32 nColor )
if ( GetWindow() )
{
Color aColor( static_cast<sal_uInt32>(nColor) );
GetWindow()->SetControlForeground( aColor );
GetWindow()->SetControlForeground( Color(nColor) );
}
}
......@@ -1257,15 +1256,15 @@ void VCLXWindow::getStyles( sal_Int16 nType, css::awt::FontDescriptor& Font, sal
case css::awt::Style::FRAME:
{
Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor();
BackgroundColor = rStyleSettings.GetWindowColor().GetColor();
ForegroundColor = sal_Int32(rStyleSettings.GetWindowTextColor());
BackgroundColor = sal_Int32(rStyleSettings.GetWindowColor());
}
break;
case css::awt::Style::DIALOG:
{
Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor();
BackgroundColor = rStyleSettings.GetDialogColor().GetColor();
ForegroundColor = sal_Int32(rStyleSettings.GetDialogTextColor());
BackgroundColor = sal_Int32(rStyleSettings.GetDialogColor());
}
break;
default: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" );
......@@ -1281,7 +1280,7 @@ namespace toolkit
{
sal_Int32 nColor = 0;
if ( !( _rValue >>= nColor ) )
nColor = (Application::GetSettings().GetStyleSettings().*pGetter)().GetColor();
nColor = sal_Int32((Application::GetSettings().GetStyleSettings().*pGetter)());
AllSettings aSettings = _pWindow->GetSettings();
StyleSettings aStyleSettings = aSettings.GetStyleSettings();
......@@ -1638,7 +1637,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
sal_Int32 nColor = 0;
if ( Value >>= nColor )
{
Color aColor( nColor );
Color aColor = Color( nColor );
pWindow->SetControlBackground( aColor );
pWindow->SetBackground( aColor );
switch ( eWinType )
......@@ -1668,7 +1667,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
sal_Int32 nColor = 0;
if ( Value >>= nColor )
{
Color aColor( nColor );
Color aColor = Color( nColor );
pWindow->SetTextColor( aColor );
pWindow->SetControlForeground( aColor );
}
......@@ -1684,7 +1683,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
sal_Int32 nColor = 0;
if ( Value >>= nColor )
{
Color aColor( nColor );
Color aColor = Color( nColor );
pWindow->SetTextLineColor( aColor );
}
}
......@@ -1697,7 +1696,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
sal_Int32 nColor = 0;
if ( Value >>= nColor )
{
Color aColor( nColor );
Color aColor = Color( nColor );
pWindow->SetFillColor( aColor );
}
}
......@@ -1710,7 +1709,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any&
sal_Int32 nColor = 0;
if ( Value >>= nColor )
{
Color aColor( nColor );
Color aColor = Color( nColor );
pWindow->SetLineColor( aColor );
}
}
......@@ -2021,10 +2020,10 @@ css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName )
}
break;
case BASEPROPERTY_BACKGROUNDCOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetControlBackground().GetColor());
aProp <<= GetWindow()->GetControlBackground();
break;
case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetDisplayBackground().GetColor().GetColor());
aProp <<= GetWindow()->GetDisplayBackground().GetColor();
break;
case BASEPROPERTY_FONTRELIEF:
aProp <<= static_cast<sal_Int16>(GetWindow()->GetControlFont().GetRelief());
......@@ -2033,16 +2032,16 @@ css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName )
aProp <<= static_cast<sal_Int16>(GetWindow()->GetControlFont().GetEmphasisMark());
break;
case BASEPROPERTY_TEXTCOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetControlForeground().GetColor());
aProp <<= GetWindow()->GetControlForeground();
break;
case BASEPROPERTY_TEXTLINECOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetTextLineColor().GetColor());
aProp <<= GetWindow()->GetTextLineColor();
break;
case BASEPROPERTY_FILLCOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetFillColor().GetColor());
aProp <<= GetWindow()->GetFillColor();
break;
case BASEPROPERTY_LINECOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetLineColor().GetColor());
aProp <<= GetWindow()->GetLineColor();
break;
case BASEPROPERTY_BORDER:
{
......@@ -2139,11 +2138,11 @@ css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName )
break;
case BASEPROPERTY_SYMBOL_COLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor());
aProp <<= GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor();
break;
case BASEPROPERTY_BORDERCOLOR:
aProp <<= static_cast<sal_Int32>(GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor());
aProp <<= GetWindow()->GetSettings().GetStyleSettings().GetMonoColor();
break;
}
}
......
......@@ -117,12 +117,12 @@ namespace toolkit
{
sal_Int32 nBackgroundColor = 0;
_rColorValue >>= nBackgroundColor;
aStyleSettings.SetFaceColor( nBackgroundColor );
aStyleSettings.SetFaceColor( Color(nBackgroundColor) );
// for the real background (everything except the buttons and the thumb),
// use an average between the desired color and "white"
Color aWhite( COL_WHITE );
Color aBackground( nBackgroundColor );
Color aBackground = Color( nBackgroundColor );
aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 );
aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
......@@ -131,19 +131,19 @@ namespace toolkit
sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance();
sal_Int32 nWhiteLuminance = COL_WHITE.GetLuminance();
Color aLightShadow( nBackgroundColor );
Color aLightShadow = Color( nBackgroundColor );
aLightShadow.IncreaseLuminance( static_cast<sal_uInt8>( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) );
aStyleSettings.SetLightBorderColor( aLightShadow );
Color aLight( nBackgroundColor );
Color aLight = Color( nBackgroundColor );
aLight.IncreaseLuminance( static_cast<sal_uInt8>( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) );
aStyleSettings.SetLightColor( aLight );
Color aShadow( nBackgroundColor );
Color aShadow = Color( nBackgroundColor );
aShadow.DecreaseLuminance( static_cast<sal_uInt8>( nBackgroundLuminance * 1 / 3 ) );
aStyleSettings.SetShadowColor( aShadow );
Color aDarkShadow( nBackgroundColor );
Color aDarkShadow = Color( nBackgroundColor );
aDarkShadow.DecreaseLuminance( static_cast<sal_uInt8>( nBackgroundLuminance * 2 / 3 ) );
aStyleSettings.SetDarkShadowColor( aDarkShadow );
}
......@@ -154,8 +154,8 @@ namespace toolkit
Any getButtonLikeFaceColor( const vcl::Window* _pWindow )
{
sal_Int32 nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
return makeAny( nBackgroundColor );
Color nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor();
return makeAny( sal_Int32(nBackgroundColor) );
}
static void adjustBooleanWindowStyle( const Any& _rValue, vcl::Window* _pWindow, WinBits _nBits, bool _bInverseSemantics )
......@@ -2394,7 +2394,7 @@ void SAL_CALL VCLXDialog::setProperty(
}
else if ( bVoid || !xGraphic.is() )
{
Color aColor = pDialog->GetControlBackground().GetColor();
Color aColor = pDialog->GetControlBackground();
if ( aColor == COL_AUTO )
aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
......@@ -2551,7 +2551,7 @@ void SAL_CALL VCLXMultiPage::setProperty(
}
else if ( bVoid || !xGraphic.is() )
{
Color aColor = pTabControl->GetControlBackground().GetColor();
Color aColor = pTabControl->GetControlBackground();
if ( aColor == COL_AUTO )
aColor = pTabControl->GetSettings().GetStyleSettings().GetDialogColor();
......@@ -2776,7 +2776,7 @@ void SAL_CALL VCLXTabPage::setProperty(
}
else if ( bVoid || !xGraphic.is() )
{
Color aColor = pTabPage->GetControlBackground().GetColor();
Color aColor = pTabPage->GetControlBackground();
if ( aColor == COL_AUTO )
aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
......
......@@ -303,11 +303,11 @@ namespace toolkit
OContextEntryGuard aGuard( this );
VclPtr< vcl::Window > pWindow = implGetWindow();
sal_Int32 nColor = 0;
Color nColor;
if ( pWindow )
{
if ( pWindow->IsControlForeground() )
nColor = pWindow->GetControlForeground().GetColor();
nColor = pWindow->GetControlForeground();
else
{
vcl::Font aFont;
......@@ -315,10 +315,10 @@ namespace toolkit
aFont = pWindow->GetControlFont();
else
aFont = pWindow->GetFont();
nColor = aFont.GetColor().GetColor();
nColor = aFont.GetColor();
}
}
return nColor;
return sal_Int32(nColor);
}
......@@ -329,16 +329,16 @@ namespace toolkit
OContextEntryGuard aGuard( this );
VclPtr< vcl::Window > pWindow = implGetWindow();
sal_Int32 nColor = 0;
Color nColor;
if ( pWindow )
{
if ( pWindow->IsControlBackground() )
nColor = pWindow->GetControlBackground().GetColor();
nColor = pWindow->GetControlBackground();
else
nColor = pWindow->GetBackground().GetColor().GetColor();
nColor = pWindow->GetBackground().GetColor();
}
return nColor;
return sal_Int32(nColor);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment