[Libreoffice-commits] .: 3 commits - sc/inc sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Fri May 18 05:00:49 PDT 2012


 sc/inc/colorscale.hxx              |    7 +++++++
 sc/source/core/data/colorscale.cxx |    2 ++
 sc/source/ui/view/output.cxx       |   27 +++++++++++++++++++++++----
 3 files changed, 32 insertions(+), 4 deletions(-)

New commits:
commit 24ad37bdf4edc8b9ea3af4eeb70c8487407d3472
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri May 18 13:56:47 2012 +0200

    MSVC needs new_clone for abstract class in ptr_vector
    
    See www.boost.org/doc/libs/1_49_0/libs/ptr_container/doc/tutorial.html#cloneability
    
    Change-Id: Ie5409c598f2364bc86f296dac4e9f193213d45c4

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index a9a5211..b63bc66 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -230,4 +230,11 @@ public:
     size_t size() const;
 };
 
+// see http://www.boost.org/doc/libs/1_49_0/libs/ptr_container/doc/tutorial.html#cloneability
+//for MSVC we need:
+inline ScColorFormat* new_clone( const ScColorFormat& rFormat )
+{
+    return rFormat.Clone();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 14e1af63faa67c0ec800a8416671e9a9cb1db359
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri May 18 13:49:47 2012 +0200

    paint gradients in data bars
    
    Change-Id: I2b5488296d3ca8aee92f7999bd4d82a9c9eada88

diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 501a094..975e6e9 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 c48b4f0..0cb0f00 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)
commit 9804981fa70aa12cbdbca61f1934acbb550768b8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri May 18 13:13:32 2012 +0200

    really use a dashed line
    
    Change-Id: Icbdf76c15a0b5f58f7e95029418ce79f6c9461b6

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index f0d9827..c48b4f0 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -840,7 +840,9 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con
         Point aPoint1(nPosZero, rRect.Top());
         Point aPoint2(nPosZero, rRect.Bottom());
         LineInfo aLineInfo(LINE_DASH, 1);
-        aLineInfo.SetDashCount( 5 );
+        aLineInfo.SetDashCount( 4 );
+        aLineInfo.SetDistance( 3 );
+        aLineInfo.SetDashLen( 3 );
         pDev->SetFillColor(COL_BLACK);
         pDev->SetLineColor(COL_BLACK);
         pDev->DrawLine(aPoint1, aPoint2, aLineInfo);


More information about the Libreoffice-commits mailing list