summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-04-16 02:22:41 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-04-16 02:23:38 +0200
commitf9f53c4a8c9e1cd2fa1a9f48576b09f1bfd023ae (patch)
treea447428fbc470cbc50f77ea0d51dbb6032e04e88
parentcb2063832dd64d39ec57d70d0637fe23412c096d (diff)
support tint for databar and colorscale colors, related tdf#90511
Change-Id: I59b00ab856583ed08f70c9c90469bbb44cb5782a
-rw-r--r--sc/source/filter/inc/condformatbuffer.hxx4
-rw-r--r--sc/source/filter/oox/condformatbuffer.cxx40
2 files changed, 34 insertions, 10 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx
index c3154ea6cdc4..31ae39ab0295 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -224,9 +224,9 @@ struct ExCfRuleModel
bool mbGradient;
OUString maAxisPosition;
// AxisColor
- sal_Int32 mnAxisColor;
+ sal_uInt32 mnAxisColor;
// NegativeFillColor
- sal_Int32 mnNegativeColor;
+ sal_uInt32 mnNegativeColor;
// Cfvo
bool mbIsLower;
OUString maColorScaleType;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 1992d3cc5131..7e0a0f5a1194 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -161,29 +161,42 @@ void ColorScaleRule::importCfvo( const AttributeList& rAttribs )
namespace {
-::Color RgbToRgbComponents( sal_Int32& nRgb )
+::Color ARgbToARgbComponents( sal_uInt32& nRgb )
{
+ sal_Int32 ornA = 255 - ((nRgb >> 24) & 0xFF);
sal_Int32 ornR = (nRgb >> 16) & 0xFF;
sal_Int32 ornG = (nRgb >> 8) & 0xFF;
sal_Int32 ornB = nRgb & 0xFF;
- return ::Color(ornR, ornG, ornB);
+ return ::Color(ornA, ornR, ornG, ornB);
}
}
void ColorScaleRule::importColor( const AttributeList& rAttribs )
{
- sal_Int32 nColor = 0;
+ sal_uInt32 nColor = 0;
if( rAttribs.hasAttribute( XML_rgb ) )
nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
else if( rAttribs.hasAttribute( XML_theme ) )
{
sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 );
nColor = getTheme().getColorByIndex( nThemeIndex );
+
}
- ::Color aColor = RgbToRgbComponents( nColor );
+ ::Color aColor;
+ double nTint = rAttribs.getDouble(XML_tint, 0.0);
+ if (nTint != 0.0)
+ {
+ oox::drawingml::Color aDMColor;
+ aDMColor.setSrgbClr(nColor);
+ aDMColor.addExcelTintTransformation(nTint);
+ nColor = aDMColor.getColor(getBaseFilter().getGraphicHelper());
+ aColor = ::Color(nColor);
+ }
+ else
+ aColor = ARgbToARgbComponents( nColor );
if(mnCol >= maColorScaleRuleEntries.size())
maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry());
@@ -239,7 +252,7 @@ DataBarRule::DataBarRule( const CondFormat& rFormat ):
void DataBarRule::importColor( const AttributeList& rAttribs )
{
- sal_Int32 nColor = 0;
+ sal_uInt32 nColor = 0;
if( rAttribs.hasAttribute( XML_rgb ) )
nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT );
else if( rAttribs.hasAttribute( XML_theme ) )
@@ -248,7 +261,18 @@ void DataBarRule::importColor( const AttributeList& rAttribs )
nColor = getTheme().getColorByIndex( nThemeIndex );
}
- ::Color aColor = RgbToRgbComponents( nColor );
+ ::Color aColor;
+ double nTint = rAttribs.getDouble(XML_tint, 0.0);
+ if (nTint != 0.0)
+ {
+ oox::drawingml::Color aDMColor;
+ aDMColor.setSrgbClr(nColor);
+ aDMColor.addExcelTintTransformation(nTint);
+ nColor = aDMColor.getColor(getBaseFilter().getGraphicHelper());
+ aColor = ::Color(nColor);
+ }
+ else
+ aColor = ARgbToARgbComponents( nColor );
mxFormat->maPositiveColor = aColor;
}
@@ -1119,13 +1143,13 @@ void ExtCfRule::finalizeImport()
case AXISCOLOR:
{
ScDataBarFormatData* pDataBar = mpTarget;
- pDataBar->maAxisColor = RgbToRgbComponents(maModel.mnAxisColor);
+ pDataBar->maAxisColor = ARgbToARgbComponents(maModel.mnAxisColor);
break;
}
case NEGATIVEFILLCOLOR:
{
ScDataBarFormatData* pDataBar = mpTarget;
- pDataBar->mpNegativeColor.reset( new ::Color( RgbToRgbComponents(maModel.mnNegativeColor) ) );
+ pDataBar->mpNegativeColor.reset( new ::Color( ARgbToARgbComponents(maModel.mnNegativeColor) ) );
pDataBar->mbNeg = true;
break;
}