summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-05-18 13:49:47 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-05-18 13:59:40 +0200
commit14e1af63faa67c0ec800a8416671e9a9cb1db359 (patch)
tree12c58fb3a8a3b61a060a0924a404b79976dca6e6 /sc
parentreally use a dashed line (diff)
downloadcore-14e1af63faa67c0ec800a8416671e9a9cb1db359.tar.gz
core-14e1af63faa67c0ec800a8416671e9a9cb1db359.zip
paint gradients in data bars
Change-Id: I2b5488296d3ca8aee92f7999bd4d82a9c9eada88
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/colorscale.cxx2
-rw-r--r--sc/source/ui/view/output.cxx23
2 files changed, 22 insertions, 3 deletions
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 501a094eca03..975e6e9a92de 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -657,6 +657,8 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const
else
pInfo->maColor = mpFormatData->maPositiveColor;
+ pInfo->mbGradient = mpFormatData->mbGradient;
+
return pInfo;
}
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index c48b4f0faaff..0cb0f006a375 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -50,6 +50,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <svx/sdr/contact/objectcontacttools.hxx>
#include <vcl/lineinfo.hxx>
+#include <vcl/gradient.hxx>
#include <svx/unoapi.hxx>
#include "output.hxx"
@@ -830,9 +831,25 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
else
return;
- //TODO: improve this for gradient fill
- pDev->SetFillColor(pOldDataBarInfo->maColor);
- pDev->DrawRect(aPaintRect);
+ if(pOldDataBarInfo->mbGradient)
+ {
+ pDev->SetLineColor(pOldDataBarInfo->maColor);
+ Gradient aGradient(GRADIENT_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT);
+
+ if(pOldDataBarInfo->mnLength < 0)
+ aGradient.SetAngle(2700);
+ else
+ aGradient.SetAngle(900);
+
+ pDev->DrawGradient(aPaintRect, aGradient);
+
+ pDev->SetLineColor();
+ }
+ else
+ {
+ pDev->SetFillColor(pOldDataBarInfo->maColor);
+ pDev->DrawRect(aPaintRect);
+ }
//draw axis
if(pOldDataBarInfo->mnZero)