summaryrefslogtreecommitdiff
path: root/svtools/source/table
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2012-09-03 12:20:27 -0500
committerMiklos Vajna <vmiklos@suse.cz>2012-09-14 09:38:47 +0200
commitfe08068cf9ba35105955244b8d9cd9e64e3ebb88 (patch)
treee32e2bd869f03df3421fd4190d6ef76d24533bda /svtools/source/table
parent5200140683c461e7439d8f2b5a625391350a2cef (diff)
gridfixes: #i117398# allow to specify selection colors in table/grid
Conflicts: toolkit/inc/toolkit/helper/property.hxx toolkit/source/controls/grid/defaultgriddatamodel.cxx Change-Id: Ie863aa7cecb4c7bda230ab829e6090689518dab8
Diffstat (limited to 'svtools/source/table')
-rw-r--r--svtools/source/table/gridtablerenderer.cxx27
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx16
2 files changed, 36 insertions, 7 deletions
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index 67ddb52aabaa..8e227b6ab9b6 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -330,13 +330,17 @@ namespace svt { namespace table
::Color backgroundColor = _rStyle.GetFieldColor();
- ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
+ ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+ ::Color const activeSelectionBackColor =
+ lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionBackColor(), _rStyle, &StyleSettings::GetHighlightColor );
if ( _bSelected )
{
// selected rows use the background color from the style
- backgroundColor = i_hasControlFocus ? _rStyle.GetHighlightColor() : _rStyle.GetDeactiveColor();
+ backgroundColor = i_hasControlFocus
+ ? activeSelectionBackColor
+ : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor );
if ( !aLineColor )
lineColor = backgroundColor;
}
@@ -353,7 +357,7 @@ namespace svt { namespace table
}
else
{
- Color hilightColor = _rStyle.GetHighlightColor();
+ Color hilightColor = activeSelectionBackColor;
hilightColor.SetRed( 9 * ( fieldColor.GetRed() - hilightColor.GetRed() ) / 10 + hilightColor.GetRed() );
hilightColor.SetGreen( 9 * ( fieldColor.GetGreen() - hilightColor.GetGreen() ) / 10 + hilightColor.GetGreen() );
hilightColor.SetBlue( 9 * ( fieldColor.GetBlue() - hilightColor.GetBlue() ) / 10 + hilightColor.GetBlue() );
@@ -419,14 +423,16 @@ namespace svt { namespace table
StyleSettings const & rStyle;
ColPos const nColumn;
bool const bSelected;
+ bool const bHasControlFocus;
CellRenderContext( OutputDevice& i_device, Rectangle const & i_contentArea,
- StyleSettings const & i_style, ColPos const i_column, bool const i_selected )
+ StyleSettings const & i_style, ColPos const i_column, bool const i_selected, bool const i_hasControlFocus )
:rDevice( i_device )
,aContentArea( i_contentArea )
,rStyle( i_style )
,nColumn( i_column )
,bSelected( i_selected )
+ ,bHasControlFocus( i_hasControlFocus )
{
}
};
@@ -438,7 +444,7 @@ namespace svt { namespace table
_rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
Rectangle const aContentArea( lcl_getContentArea( *m_pImpl, _rArea ) );
- CellRenderContext const aRenderContext( _rDevice, aContentArea, _rStyle, i_column, _bSelected );
+ CellRenderContext const aRenderContext( _rDevice, aContentArea, _rStyle, i_column, _bSelected, i_hasControlFocus );
impl_paintCellContent( aRenderContext );
if ( m_pImpl->bUseGridLines )
@@ -449,7 +455,9 @@ namespace svt { namespace table
if ( _bSelected && !aLineColor )
{
// if no line color is specified by the model, use the usual selection color for lines in selected cells
- lineColor = i_hasControlFocus ? _rStyle.GetHighlightColor() : _rStyle.GetDeactiveColor();
+ lineColor = i_hasControlFocus
+ ? lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionBackColor(), _rStyle, &StyleSettings::GetHighlightColor )
+ : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor );
}
_rDevice.SetLineColor( lineColor );
@@ -534,7 +542,12 @@ namespace svt { namespace table
void GridTableRenderer::impl_paintCellText( CellRenderContext const & i_context, ::rtl::OUString const & i_text )
{
if ( i_context.bSelected )
- i_context.rDevice.SetTextColor( i_context.rStyle.GetHighlightTextColor() );
+ {
+ ::Color const textColor = i_context.bHasControlFocus
+ ? lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionTextColor(), i_context.rStyle, &StyleSettings::GetHighlightTextColor )
+ : lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionTextColor(), i_context.rStyle, &StyleSettings::GetDeactiveTextColor );
+ i_context.rDevice.SetTextColor( textColor );
+ }
else
{
::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), i_context.rStyle, &StyleSettings::GetFieldTextColor );
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index a9539cbd7aca..521bb2d79e9f 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -182,6 +182,22 @@ namespace svt { namespace table
{
return ::boost::optional< ::Color >();
}
+ virtual ::boost::optional< ::Color > getActiveSelectionBackColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getInactiveSelectionBackColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getActiveSelectionTextColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
+ virtual ::boost::optional< ::Color > getInactiveSelectionTextColor() const
+ {
+ return ::boost::optional< ::Color >();
+ }
virtual ::boost::optional< ::Color > getTextColor() const
{
return ::boost::optional< ::Color >();