[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 21 07:39:15 PDT 2012


 sc/source/ui/inc/tabsplit.hxx  |    8 +--
 sc/source/ui/inc/tabview.hxx   |    1 
 sc/source/ui/view/tabsplit.cxx |   92 ++++++++++++++++++++++++++++++++++++++++-
 sc/source/ui/view/tabview.cxx  |    1 
 4 files changed, 96 insertions(+), 6 deletions(-)

New commits:
commit 25ef6ea63ac2d329b510e921d013f6382b280673
Author: Matteo Casalin <matteo.casalin at gmx.com>
Date:   Sun Jul 29 16:00:22 2012 +0200

    Really draw Calc tab-splitters
    
    Change-Id: I952729487eb5d1195bbdf53c2e981685cd0c7b62
    Reviewed-on: https://gerrit.libreoffice.org/350
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/inc/tabsplit.hxx b/sc/source/ui/inc/tabsplit.hxx
index cdfa148..616bd0b 100644
--- a/sc/source/ui/inc/tabsplit.hxx
+++ b/sc/source/ui/inc/tabsplit.hxx
@@ -28,14 +28,13 @@ class ScViewData;
 class ScTabSplitter : public Splitter
 {
 private:
-    ScViewData*     pViewData;
-    sal_Bool            bFixed;
+    const ScViewData *const pViewData;
+    bool            bFixed;
 
 protected:
     virtual void    MouseMove( const MouseEvent& rMEvt );
     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
-
     virtual void    Splitting( Point& rSplitPos );
 
 public:
@@ -43,7 +42,8 @@ public:
                                     ScViewData* pData );
                     ~ScTabSplitter();
 
-    void            SetFixed(sal_Bool bSet);
+    void            SetFixed(bool bSet);
+    virtual void    Paint( const Rectangle& rPaintRect );
 };
 
 
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 6d75481..4d2a540 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -63,7 +63,6 @@ namespace chart2 { namespace data {
     struct HighlightedRange;
 }}}}}
 
-#define SPLIT_HANDLE_SIZE   3
 #define SC_FORCEMODE_NONE   0xff
 
 // ---------------------------------------------------------------------------
diff --git a/sc/source/ui/view/tabsplit.cxx b/sc/source/ui/view/tabsplit.cxx
index 05d0405..5c5f2ff 100644
--- a/sc/source/ui/view/tabsplit.cxx
+++ b/sc/source/ui/view/tabsplit.cxx
@@ -82,7 +82,7 @@ void ScTabSplitter::Splitting( Point& rSplitPos )
 }
 
 
-void ScTabSplitter::SetFixed(sal_Bool bSet)
+void ScTabSplitter::SetFixed(bool bSet)
 {
     bFixed = bSet;
     if (bSet)
@@ -93,6 +93,96 @@ void ScTabSplitter::SetFixed(sal_Bool bSet)
         SetPointer(POINTER_VSPLIT);
 }
 
+void ScTabSplitter::Paint( const Rectangle& rRect )
+{
+    const Color oldFillCol = GetFillColor();
+    const Color oldLineCol = GetLineColor();
+
+    if (IsHorizontal())
+    {
+        switch (pViewData->GetHSplitMode())
+        {
+            case SC_SPLIT_NONE:
+            {
+                // Draw 3D border
+                SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawLine(rRect.TopRight(), rRect.BottomRight());
+                DrawLine(rRect.BottomLeft(), rRect.BottomRight());
+                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
+                DrawLine(rRect.TopLeft(), rRect.TopRight());
+                DrawLine(rRect.TopLeft(), rRect.BottomLeft());
+                // Fill internal rectangle
+                SetLineColor();
+                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
+                DrawRect(Rectangle(rRect.Left()+1, rRect.Top()+1, rRect.Right()-1, rRect.Bottom()-1));
+                // Draw handle
+                SetLineColor(Color(COL_BLACK));
+                SetFillColor(Color(COL_BLACK));
+                const long xc = rRect.Right()+rRect.Left();
+                const long h4 = rRect.GetHeight()/4;
+                // First xc fraction is truncated, second one is rounded. This will draw a centered line
+                // in handlers with odd width and a centered rectangle in those with even width.
+                DrawRect(Rectangle(Point(xc/2, rRect.Top()+h4), Point((xc+1)/2, rRect.Bottom()-h4)));
+                break;
+            }
+            case SC_SPLIT_NORMAL:
+                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
+                DrawLine(rRect.TopLeft(), rRect.BottomLeft());
+                SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawLine(rRect.TopRight(), rRect.BottomRight());
+                SetLineColor();
+                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
+                DrawRect(Rectangle(Point(rRect.Left()+1, rRect.Top()), Point(rRect.Right()-1, rRect.Bottom())));
+                break;
+            case SC_SPLIT_FIX:
+                // Nothing to draw
+                break;
+        }
+    }
+    else
+    {
+        switch (pViewData->GetVSplitMode())
+        {
+            case SC_SPLIT_NONE:
+            {
+                // Draw 3D border
+                SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawLine(rRect.TopRight(), rRect.BottomRight());
+                DrawLine(rRect.BottomLeft(), rRect.BottomRight());
+                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
+                DrawLine(rRect.TopLeft(), rRect.TopRight());
+                DrawLine(rRect.TopLeft(), rRect.BottomLeft());
+                // Fill internal rectangle
+                SetLineColor();
+                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
+                DrawRect(Rectangle(rRect.Left()+1, rRect.Top()+1, rRect.Right()-1, rRect.Bottom()-1));
+                // Draw handle
+                SetLineColor(Color(COL_BLACK));
+                SetFillColor(Color(COL_BLACK));
+                const long yc = rRect.Top()+rRect.Bottom();
+                const long w4 = rRect.GetWidth()/4;
+                // First yc fraction is truncated, second one is rounded. This will draw a centered line
+                // in handlers with odd height and a centered rectangle in those with even height.
+                DrawRect(Rectangle(Point(rRect.Left()+w4, yc/2), Point(rRect.Right()-w4, (yc+1)/2)));
+                break;
+            }
+            case SC_SPLIT_NORMAL:
+                SetLineColor(GetSettings().GetStyleSettings().GetLightColor());
+                DrawLine(rRect.TopLeft(), rRect.TopRight());
+                SetLineColor(GetSettings().GetStyleSettings().GetShadowColor());
+                DrawLine(rRect.BottomLeft(), rRect.BottomRight());
+                SetLineColor();
+                SetFillColor(GetSettings().GetStyleSettings().GetFaceColor());
+                DrawRect(Rectangle(Point(rRect.Left(), rRect.Top()+1), Point(rRect.Right(), rRect.Bottom()-1)));
+                break;
+            case SC_SPLIT_FIX:
+                // Nothing to draw
+                break;
+        }
+    }
 
+    SetFillColor(oldFillCol);
+    SetLineColor(oldLineCol);
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 97701fb..4322cc9 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -91,6 +91,7 @@
 #include <basegfx/tools/zoomtools.hxx>
 
 #define SPLIT_MARGIN    30
+#define SPLIT_HANDLE_SIZE   5
 #define SC_ICONSIZE     36
 
 #define SC_SCROLLBAR_MIN    30


More information about the Libreoffice-commits mailing list