use more Color in UnoControls..canvas

Change-Id: I8dda18f9630b4e59ead83fa7471525bdf4eaeda0
Reviewed-on: https://gerrit.libreoffice.org/50863
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2018-03-07 09:10:26 +02:00
parent 39a13fa68c
commit dbcf5b28aa
12 changed files with 47 additions and 47 deletions

View File

@@ -144,7 +144,7 @@ void SAL_CALL ProgressBar::setForegroundColor( sal_Int32 nColor )
MutexGuard aGuard (m_aMutex); MutexGuard aGuard (m_aMutex);
// Safe color for later use. // Safe color for later use.
m_nForegroundColor = nColor; m_nForegroundColor = Color(nColor);
// Repaint control // Repaint control
impl_paint ( 0, 0, impl_getGraphicsPeer() ); impl_paint ( 0, 0, impl_getGraphicsPeer() );
@@ -158,7 +158,7 @@ void SAL_CALL ProgressBar::setBackgroundColor ( sal_Int32 nColor )
MutexGuard aGuard (m_aMutex); MutexGuard aGuard (m_aMutex);
// Safe color for later use. // Safe color for later use.
m_nBackgroundColor = nColor; m_nBackgroundColor = Color(nColor);
// Repaint control // Repaint control
impl_paint ( 0, 0, impl_getGraphicsPeer() ); impl_paint ( 0, 0, impl_getGraphicsPeer() );
@@ -316,13 +316,13 @@ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGra
// Clear background // Clear background
// (same color for line and fill) // (same color for line and fill)
rGraphics->setFillColor ( m_nBackgroundColor ); rGraphics->setFillColor ( sal_Int32(m_nBackgroundColor) );
rGraphics->setLineColor ( m_nBackgroundColor ); rGraphics->setLineColor ( sal_Int32(m_nBackgroundColor) );
rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() ); rGraphics->drawRect ( nX, nY, impl_getWidth(), impl_getHeight() );
// same color for line and fill for blocks // same color for line and fill for blocks
rGraphics->setFillColor ( m_nForegroundColor ); rGraphics->setFillColor ( sal_Int32(m_nForegroundColor) );
rGraphics->setLineColor ( m_nForegroundColor ); rGraphics->setLineColor ( sal_Int32(m_nForegroundColor) );
sal_Int32 nBlockStart = 0; // = left site of new block sal_Int32 nBlockStart = 0; // = left site of new block
sal_Int32 nBlockCount = m_nBlockValue!=0.00 ? static_cast<sal_Int32>((m_nValue-m_nMinRange)/m_nBlockValue) : 0; // = number of next block sal_Int32 nBlockCount = m_nBlockValue!=0.00 ? static_cast<sal_Int32>((m_nValue-m_nMinRange)/m_nBlockValue) : 0; // = number of next block

View File

@@ -138,8 +138,8 @@ private:
bool m_bHorizontal; // orientation for steps [true=horizontal/false=vertical] bool m_bHorizontal; // orientation for steps [true=horizontal/false=vertical]
css::awt::Size m_aBlockSize; // width and height of a block [>=0,0] css::awt::Size m_aBlockSize; // width and height of a block [>=0,0]
sal_Int32 m_nForegroundColor; // (alpha,r,g,b) Color m_nForegroundColor; // (alpha,r,g,b)
sal_Int32 m_nBackgroundColor; // (alpha,r,g,b) Color m_nBackgroundColor; // (alpha,r,g,b)
sal_Int32 m_nMinRange; // lowest value = 0% [long, <_nMaxRange] sal_Int32 m_nMinRange; // lowest value = 0% [long, <_nMaxRange]
sal_Int32 m_nMaxRange; // highest value = 100% [long, >_nMinRange] sal_Int32 m_nMaxRange; // highest value = 100% [long, >_nMinRange]
double m_nBlockValue; // value for one block [long, >0] double m_nBlockValue; // value for one block [long, >0]

View File

@@ -478,12 +478,12 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground( )
SolarMethodGuard aGuard(getMutex()); SolarMethodGuard aGuard(getMutex());
ensureIsAlive(); ensureIsAlive();
sal_Int32 nColor = 0; Color nColor;
vcl::Window* pInst = mpBrowseBox->GetWindowInstance(); vcl::Window* pInst = mpBrowseBox->GetWindowInstance();
if ( pInst ) if ( pInst )
{ {
if ( pInst->IsControlForeground() ) if ( pInst->IsControlForeground() )
nColor = pInst->GetControlForeground().GetColor(); nColor = pInst->GetControlForeground();
else else
{ {
vcl::Font aFont; vcl::Font aFont;
@@ -491,11 +491,11 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground( )
aFont = pInst->GetControlFont(); aFont = pInst->GetControlFont();
else else
aFont = pInst->GetFont(); aFont = pInst->GetFont();
nColor = aFont.GetColor().GetColor(); nColor = aFont.GetColor();
} }
} }
return nColor; return sal_Int32(nColor);
} }
sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground( ) sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground( )
@@ -503,17 +503,17 @@ sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground( )
SolarMethodGuard aGuard(getMutex()); SolarMethodGuard aGuard(getMutex());
ensureIsAlive(); ensureIsAlive();
sal_Int32 nColor = 0; Color nColor;
vcl::Window* pInst = mpBrowseBox->GetWindowInstance(); vcl::Window* pInst = mpBrowseBox->GetWindowInstance();
if ( pInst ) if ( pInst )
{ {
if ( pInst->IsControlBackground() ) if ( pInst->IsControlBackground() )
nColor = pInst->GetControlBackground().GetColor(); nColor = pInst->GetControlBackground();
else else
nColor = pInst->GetBackground().GetColor().GetColor(); nColor = pInst->GetBackground().GetColor();
} }
return nColor; return sal_Int32(nColor);
} }

View File

@@ -392,12 +392,12 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( )
ensureIsAlive(); ensureIsAlive();
sal_Int32 nColor = 0; Color nColor;
vcl::Window* pInst = m_aTable.GetWindowInstance(); vcl::Window* pInst = m_aTable.GetWindowInstance();
if ( pInst ) if ( pInst )
{ {
if ( pInst->IsControlForeground() ) if ( pInst->IsControlForeground() )
nColor = pInst->GetControlForeground().GetColor(); nColor = pInst->GetControlForeground();
else else
{ {
vcl::Font aFont; vcl::Font aFont;
@@ -405,10 +405,10 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( )
aFont = pInst->GetControlFont(); aFont = pInst->GetControlFont();
else else
aFont = pInst->GetFont(); aFont = pInst->GetFont();
nColor = aFont.GetColor().GetColor(); nColor = aFont.GetColor();
} }
} }
return nColor; return sal_Int32(nColor);
} }
sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( )
@@ -416,16 +416,16 @@ sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( )
SolarMutexGuard aSolarGuard; SolarMutexGuard aSolarGuard;
ensureIsAlive(); ensureIsAlive();
sal_Int32 nColor = 0; Color nColor;
vcl::Window* pInst = m_aTable.GetWindowInstance(); vcl::Window* pInst = m_aTable.GetWindowInstance();
if ( pInst ) if ( pInst )
{ {
if ( pInst->IsControlBackground() ) if ( pInst->IsControlBackground() )
nColor = pInst->GetControlBackground().GetColor(); nColor = pInst->GetControlBackground();
else else
nColor = pInst->GetBackground().GetColor().GetColor(); nColor = pInst->GetBackground().GetColor();
} }
return nColor; return sal_Int32(nColor);
} }

View File

@@ -414,11 +414,11 @@ namespace accessibility
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0; Color nColor;
if ( m_pTabBar ) if ( m_pTabBar )
{ {
if ( m_pTabBar->IsControlForeground() ) if ( m_pTabBar->IsControlForeground() )
nColor = m_pTabBar->GetControlForeground().GetColor(); nColor = m_pTabBar->GetControlForeground();
else else
{ {
vcl::Font aFont; vcl::Font aFont;
@@ -426,11 +426,11 @@ namespace accessibility
aFont = m_pTabBar->GetControlFont(); aFont = m_pTabBar->GetControlFont();
else else
aFont = m_pTabBar->GetFont(); aFont = m_pTabBar->GetFont();
nColor = aFont.GetColor().GetColor(); nColor = aFont.GetColor();
} }
} }
return nColor; return sal_Int32(nColor);
} }
@@ -438,16 +438,16 @@ namespace accessibility
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0; Color nColor;
if ( m_pTabBar ) if ( m_pTabBar )
{ {
if ( m_pTabBar->IsControlBackground() ) if ( m_pTabBar->IsControlBackground() )
nColor = m_pTabBar->GetControlBackground().GetColor(); nColor = m_pTabBar->GetControlBackground();
else else
nColor = m_pTabBar->GetBackground().GetColor().GetColor(); nColor = m_pTabBar->GetBackground().GetColor();
} }
return nColor; return sal_Int32(nColor);
} }

View File

@@ -277,9 +277,9 @@ sal_Int32 OAccessibleMenuComponent::getForeground( )
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
sal_Int32 nColor = rStyleSettings.GetMenuTextColor().GetColor(); Color nColor = rStyleSettings.GetMenuTextColor();
return nColor; return sal_Int32(nColor);
} }

View File

@@ -336,7 +336,7 @@ Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
OutputDevice* pDev = Application::GetDefaultDevice(); OutputDevice* pDev = Application::GetDefaultDevice();
if ( pDev ) if ( pDev )
{ {
aValue.Value <<= static_cast< sal_Int32 >(pDev->GetSettings().GetStyleSettings().GetFieldTextColor().GetColor()); aValue.Value <<= pDev->GetSettings().GetStyleSettings().GetFieldTextColor();
} }
} }
break; break;

View File

@@ -185,7 +185,7 @@ sal_Int32 VCLXAccessibleMenuBar::getBackground( )
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
return Application::GetSettings().GetStyleSettings().GetMenuBarColor().GetColor(); return sal_Int32(Application::GetSettings().GetStyleSettings().GetMenuBarColor());
} }

View File

@@ -78,7 +78,7 @@ sal_Int32 VCLXAccessiblePopupMenu::getBackground( )
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
return Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor(); return sal_Int32(Application::GetSettings().GetStyleSettings().GetMenuColor());
} }

View File

@@ -170,8 +170,8 @@ Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( s
{ {
vcl::Font aFont = GetWindow()->GetControlFont(); vcl::Font aFont = GetWindow()->GetControlFont();
sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor(); Color nBackColor = GetWindow()->GetControlBackground();
sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor(); Color nColor = GetWindow()->GetControlForeground();
// MT: Code with default font was introduced with the IA2 CWS, but I am not convinced that this is the correct font... // MT: Code with default font was introduced with the IA2 CWS, but I am not convinced that this is the correct font...
// Decide what to do when we have a concrete issue. // Decide what to do when we have a concrete issue.
@@ -222,7 +222,7 @@ Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( s
} }
*/ */
aValues = CharacterAttributesHelper( aFont, nBackColor, nColor ) aValues = CharacterAttributesHelper( aFont, sal_Int32(nBackColor), sal_Int32(nColor) )
.GetCharacterAttributes( aRequestedAttributes ); .GetCharacterAttributes( aRequestedAttributes );
} }

View File

@@ -582,22 +582,22 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getForeground( )
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0; Color nColor;
if ( m_pToolBox ) if ( m_pToolBox )
nColor = m_pToolBox->GetControlForeground().GetColor(); nColor = m_pToolBox->GetControlForeground();
return nColor; return sal_Int32(nColor);
} }
sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( ) sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( )
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
sal_Int32 nColor = 0; Color nColor;
if ( m_pToolBox ) if ( m_pToolBox )
nColor = m_pToolBox->GetControlBackground().GetColor(); nColor = m_pToolBox->GetControlBackground();
return nColor; return sal_Int32(nColor);
} }
// XAccessibleExtendedComponent // XAccessibleExtendedComponent

View File

@@ -908,7 +908,7 @@ namespace canvas
pCols[2] = rColor.GetBlue(); pCols[2] = rColor.GetBlue();
pCols[3] = 255-rColor.GetTransparency(); pCols[3] = 255-rColor.GetTransparency();
#else #else
*reinterpret_cast<sal_Int32*>(pCols) = rColor.GetColor(); *reinterpret_cast<sal_Int32*>(pCols) = sal_Int32(rColor);
#endif #endif
return aRet; return aRet;
} }