sc/source/ui/view/tabview.cxx     |    8 +-
 svtools/source/control/tabbar.cxx |  131 ++++++++------------------------------
 2 files changed, 33 insertions(+), 106 deletions(-)

New commits:
commit 77fd06e18d29daca5194342fe630f4d595f7bd10
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com>
Date:   Sun Sep 14 21:18:22 2014 +0200

    Remove shadows in tabs to make them look more flat.
    
    Change-Id: I7c125c10538a641ec723d95be987ad77cdebc9ba

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 6535462..771667c 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -1137,48 +1137,6 @@ public:
         mrParent.DrawPolygon(maPoly);
     }
 
-    void drawLeftShadow()
-    {
-        Point p1 = maPoly[0], p2 = maPoly[1];
-        p1.X()++;
-        p2.X()++;
-        p2.Y()--;
-        mrParent.DrawLine(p1, p2);
-    }
-
-    void drawRightShadow()
-    {
-        Point p1 = maPoly[2];
-        Point p2 = maPoly[3];
-        p1.X()--;
-        p2.X()--;
-        mrParent.DrawLine(p1, p2);
-    }
-
-    void drawTopInnerShadow()
-    {
-        Point p1 = maPoly[0], p2 = maPoly[3];
-        p1.Y()++;
-        p2.Y()++;
-        mrParent.DrawLine(p1, p2);
-    }
-
-    void drawBottomShadow(bool bColored)
-    {
-        Point p1 = maPoly[1], p2 = maPoly[2];
-        p1.X() += 1;
-        p1.Y() -= 1;
-        p2.X() -= 1;
-        p2.Y() -= 1;
-        mrParent.DrawLine(p1, p2);
-        if (bColored)
-        {
-            p1 += Point(-1, -1);
-            p2 += Point(1, -1);
-            mrParent.DrawLine(p1, p2);
-        }
-    }
-
     void drawText(const OUString& aText)
     {
         Rectangle aRect = maRect;
@@ -1197,7 +1155,8 @@ public:
 
     void drawOverTopBorder(bool b3DTab)
     {
-        Point p1 = maPoly[0], p2 = maPoly[3];
+        Point p1 = maPoly[0];
+        Point p2 = maPoly[3];
         p1.X() += 1;
         p2.X() -= 1;
         Rectangle aDelRect(p1, p2);
@@ -1229,34 +1188,6 @@ public:
         }
 
         drawOuterFrame();
-
-        // If this is the current tab, draw the left inner shadow the default 
color,
-        // otherwise make it the same as the custom background color
-        Color aColor = mpStyleSettings->GetLightColor();
-        if (mbCustomColored && !mbSelected)
-            aColor = maCustomColor;
-
-        mrParent.SetLineColor(aColor);
-        drawLeftShadow();
-
-        if ( !mbSelected )
-            drawTopInnerShadow();
-
-        mrParent.SetLineColor( mpStyleSettings->GetShadowColor() );
-        drawRightShadow();
-        if ( mbCustomColored && mbSelected )
-        {
-            mrParent.SetLineColor(maCustomColor);
-            drawBottomShadow(true);
-        }
-        else
-            drawBottomShadow(false);
-
-        // Draw the outer frame once more.  In some environments, the outer 
frame
-        // gets overpainted.
-        mrParent.SetLineColor( mpStyleSettings->GetDarkShadowColor() );
-        mrParent.SetFillColor();
-        drawOuterFrame();
     }
 
     void drawPlusImage()
commit f9c77344c6352bd8fd4acc1fd87d55f8f5087061
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com>
Date:   Sun Sep 14 20:03:33 2014 +0200

    Make tab label padding dependent on font height.
    
    Change-Id: I7de52945bdf3062174b49e12e2f05075632c7e4a

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 3ac9f99..6535462 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -36,7 +36,6 @@
 #include <limits>
 
 
-#define TABBAR_PADDING          24
 #define TABBAR_DRAG_SCROLLOFF   5
 #define TABBAR_MINSIZE          5
 
@@ -607,7 +606,10 @@ bool TabBar::ImplCalcWidth()
         {
             pItem->mbShort = false;
         }
-        nNewWidth += TABBAR_PADDING;
+
+        // Padding is dependent on font height - bigger font = bigger padding
+        long nFontWidth = aFont.GetHeight();
+        nNewWidth += nFontWidth * 2;
 
         if ( pItem->mnWidth != nNewWidth )
         {
commit 1a2b2d2cf4017ffb2dd73740fc6cd0e39c32ceeb
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com>
Date:   Sun Sep 14 19:01:02 2014 +0200

    Change tabs (sheets in Calc) to better looking rectangle shape.
    
    Change-Id: Ib0b2812792ac7447bfb1d9e3d4d404bc5d5afb0b

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 9183f73..3ac9f99 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -36,9 +36,7 @@
 #include <limits>
 
 
-
-#define TABBAR_OFFSET_X         7
-#define TABBAR_OFFSET_X2        2
+#define TABBAR_PADDING          24
 #define TABBAR_DRAG_SCROLLOFF   5
 #define TABBAR_MINSIZE          5
 
@@ -588,9 +586,7 @@ bool TabBar::ImplCalcWidth()
         mnCurMaxWidth = mnMaxPageWidth;
     else if ( mbAutoMaxWidth )
     {
-        mnCurMaxWidth = mnLastOffX-mnOffX-
-                        TABBAR_OFFSET_X-TABBAR_OFFSET_X-
-                        TABBAR_OFFSET_X2-TABBAR_OFFSET_X2-TABBAR_OFFSET_X2;
+        mnCurMaxWidth = mnLastOffX - mnOffX;
         if ( mnCurMaxWidth < 1 )
             mnCurMaxWidth = 1;
     }
@@ -608,8 +604,11 @@ bool TabBar::ImplCalcWidth()
             nNewWidth = mnCurMaxWidth;
         }
         else
+        {
             pItem->mbShort = false;
-        nNewWidth += TABBAR_OFFSET_X+TABBAR_OFFSET_X2;
+        }
+        nNewWidth += TABBAR_PADDING;
+
         if ( pItem->mnWidth != nNewWidth )
         {
             pItem->mnWidth = nNewWidth;
@@ -650,8 +649,8 @@ void TabBar::ImplFormat()
                 pItem->maRect.Left() = x;
                 x += pItem->mnWidth;
             }
-            pItem->maRect.Right() = x+TABBAR_OFFSET_X+TABBAR_OFFSET_X2;
-            pItem->maRect.Bottom() = maWinSize.Height()-1;
+            pItem->maRect.Right() = x;
+            pItem->maRect.Bottom() = maWinSize.Height() - 1;
 
             if( mbMirrored )
             {
@@ -679,7 +678,7 @@ sal_uInt16 TabBar::ImplGetLastFirstPos()
         return 0;
 
     sal_uInt16  nLastFirstPos = nCount-1;
-    long    nWinWidth = mnLastOffX-mnOffX-TABBAR_OFFSET_X-ADDNEWPAGE_AREAWIDTH;
+    long    nWinWidth = mnLastOffX - mnOffX - ADDNEWPAGE_AREAWIDTH;
     long    nWidth = (*mpItemList)[ nLastFirstPos ]->mnWidth;
     while ( nLastFirstPos && (nWidth < nWinWidth) )
     {
@@ -793,8 +792,7 @@ void TabBar::ImplShowPage( sal_uInt16 nPos )
 {
     // calculate width
     long nWidth = GetOutputSizePixel().Width();
-    if ( nWidth >= TABBAR_OFFSET_X )
-        nWidth -= TABBAR_OFFSET_X;
+
     ImplTabBarItem* pItem = (*mpItemList)[ nPos ];
     if ( nPos < mnFirstPos )
         SetFirstPageId( pItem->mnId );
@@ -1280,9 +1278,9 @@ public:
         long nOffY = mrParent.GetPageArea().getY();
 
         // first draw filled polygon
-        maPoly[0] = Point( rRect.Left(), nOffY );
-        maPoly[1] = Point( rRect.Left()+TABBAR_OFFSET_X, rRect.Bottom() );
-        maPoly[2] = Point( rRect.Right()-TABBAR_OFFSET_X, rRect.Bottom() );
+        maPoly[0] = Point( rRect.Left(),  nOffY );
+        maPoly[1] = Point( rRect.Left(),  rRect.Bottom() );
+        maPoly[2] = Point( rRect.Right(), rRect.Bottom() );
         maPoly[3] = Point( rRect.Right(), nOffY );
     }
 
@@ -1363,8 +1361,10 @@ void TabBar::Paint( const Rectangle& rect )
 
     TabBarPaintGuard aGuard(*this);
     TabDrawer aDrawer(*this);
+
     aDrawer.setSelectedFillColor(aSelectColor);
     aDrawer.setUnselectedFillColor(aFaceColor);
+
     aDrawer.drawOutputAreaBorder();
 
     // Now, start drawing the tabs.
@@ -1594,8 +1594,7 @@ void TabBar::RequestHelp( const HelpEvent& rHEvt )
         {
             sal_uInt16 nPos = GetPagePos( nItemId );
             ImplTabBarItem* pItem = (*mpItemList)[ nPos ];
-            if ( pItem->mbShort ||
-                (pItem->maRect.Right()-TABBAR_OFFSET_X-5 > mnLastOffX) )
+            if ( pItem->mbShort || (pItem->maRect.Right() - 5 > mnLastOffX) )
             {
                 Rectangle aItemRect = GetPageRect( nItemId );
                 Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
@@ -1792,11 +1791,9 @@ Rectangle TabBar::ImplGetInsertTabRect(ImplTabBarItem* 
pItem) const
     {
         Rectangle aInsTabRect = pItem->maRect;
         if ( !mbMirrored )
-            aInsTabRect.setX(
-                aInsTabRect.getX() + aInsTabRect.getWidth() - TABBAR_OFFSET_X 
- TABBAR_OFFSET_X2);
+            aInsTabRect.setX(aInsTabRect.getX() + aInsTabRect.getWidth());
         else
-            aInsTabRect.setX(
-                aInsTabRect.getX() - 3*TABBAR_OFFSET_X - TABBAR_OFFSET_X2);
+            aInsTabRect.setX(aInsTabRect.getX());
         aInsTabRect.setWidth(32);
         return aInsTabRect;
     }
@@ -2146,8 +2143,6 @@ void TabBar::SetCurPageId( sal_uInt16 nPageId )
             {
                 // calculate visible width
                 long nWidth = mnLastOffX;
-                if ( nWidth > TABBAR_OFFSET_X )
-                    nWidth -= TABBAR_OFFSET_X;
                 if ( nWidth > ADDNEWPAGE_AREAWIDTH )
                     nWidth -= ADDNEWPAGE_AREAWIDTH;
 
@@ -2204,8 +2199,6 @@ void TabBar::MakeVisible( sal_uInt16 nPageId )
 
             // calculate visible area
             long nWidth = mnLastOffX;
-            if ( nWidth > TABBAR_OFFSET_X )
-                nWidth -= TABBAR_OFFSET_X;
 
             if ( mbFormat || pItem->maRect.IsEmpty() )
             {
@@ -2332,8 +2325,8 @@ bool TabBar::StartEditMode( sal_uInt16 nPageId )
 
         mpEdit = new TabBarEdit( this, WB_CENTER );
         Rectangle aRect = GetPageRect( mnEditId );
-        long nX = aRect.Left()+TABBAR_OFFSET_X+(TABBAR_OFFSET_X2/2);
-        long nWidth = aRect.GetWidth()-(TABBAR_OFFSET_X*2)-TABBAR_OFFSET_X2;
+        long nX = aRect.Left();
+        long nWidth = aRect.GetWidth();
         if ( mnEditId != GetCurPageId() )
             nX += 1;
         if ( nX+nWidth > mnLastOffX )
@@ -2646,7 +2639,7 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
     if ( mnDropPos < nItemCount )
     {
         pItem = (*mpItemList)[ mnDropPos ];
-        nX = pItem->maRect.Left()+TABBAR_OFFSET_X;
+        nX = pItem->maRect.Left();
         if ( mnDropPos == nCurPos )
             nX--;
         else
@@ -2661,7 +2654,7 @@ sal_uInt16 TabBar::ShowDropPos( const Point& rPos )
     if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
     {
         pItem = (*mpItemList)[ mnDropPos-1 ];
-        nX = pItem->maRect.Right()-TABBAR_OFFSET_X;
+        nX = pItem->maRect.Right();
         if ( mnDropPos == nCurPos )
             nX++;
         if ( !pItem->IsDefaultTabBgColor() && !pItem->mbSelect)
@@ -2689,7 +2682,7 @@ void TabBar::HideDropPos()
         if ( mnDropPos < nItemCount )
         {
             pItem = (*mpItemList)[ mnDropPos ];
-            nX = pItem->maRect.Left()+TABBAR_OFFSET_X;
+            nX = pItem->maRect.Left();
             // immediately call Paint, as it is not possible during drag and 
drop
             Rectangle aRect( nX-1, nY1, nX+3, nY2 );
             Region aRegion( aRect );
@@ -2700,7 +2693,7 @@ void TabBar::HideDropPos()
         if ( (mnDropPos > 0) && (mnDropPos < nItemCount+1) )
         {
             pItem = (*mpItemList)[ mnDropPos-1 ];
-            nX = pItem->maRect.Right()-TABBAR_OFFSET_X;
+            nX = pItem->maRect.Right();
             // immediately call Paint, as it is not possible during drag and 
drop
             Rectangle aRect( nX-2, nY1, nX+1, nY2 );
             Region aRegion( aRect );
@@ -2787,7 +2780,6 @@ Size TabBar::CalcWindowSizePixel() const
             ImplTabBarItem* pItem = (*mpItemList)[ i ];
             nWidth += pItem->mnWidth;
         }
-        nWidth += TABBAR_OFFSET_X+TABBAR_OFFSET_X2;
     }
 
     return Size( nWidth, GetSettings().GetStyleSettings().GetScrollBarSize() );
commit 066c7cc53b51d16b9230b5eef2a09b90b2c0adfd
Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com>
Date:   Sat Sep 13 22:52:56 2014 +0200

    sc: adjust tab height a bit
    
    Change-Id: I82b20bb7f17b59fdd925d3e5da95b63c2839bda7

diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 1b2520b..40c41d5 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -53,8 +53,10 @@
 
 #include <basegfx/tools/zoomtools.hxx>
 
-#define SPLIT_MARGIN    30
-#define SPLIT_HANDLE_SIZE   5
+#define SPLIT_MARGIN      30
+#define SPLIT_HANDLE_SIZE 5
+#define WIDTH_MARGIN      5
+
 #define SC_ICONSIZE     36
 
 using namespace ::com::sun::star;
@@ -340,7 +342,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& 
rSize, bool bInner )
 
     const StyleSettings& rStyleSettings = 
pFrameWin->GetSettings().GetStyleSettings();
 
-    sal_Int32 nTabWidth = pFrameWin->GetFont().GetHeight() + 4;
+    sal_Int32 nTabWidth = pFrameWin->GetFont().GetHeight() + WIDTH_MARGIN;
 
     if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to