[Libreoffice-commits] core.git: Branch 'aoo/trunk' - vcl/source vcl/unx

Jürgen Schmidt jsc at apache.org
Fri Jun 20 07:07:37 PDT 2014


 vcl/source/control/scrbar.cxx            |   52 +++++++++++++++++++++++--------
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |    5 ++
 2 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit a734be318f82ae1da793702cb8aee50864023b73
Author: Jürgen Schmidt <jsc at apache.org>
Date:   Fri Jun 20 12:05:03 2014 +0000

    #121627# merge fix from aoo410 branch that fixes the geometry calculations for scroll bars

diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 4f75b66..d2b7659 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -354,18 +354,33 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
             }
             else
             {
-                Size aBtnSize( aSize.Height(), aSize.Height() );
-                maBtn2Rect.Top()    = maBtn1Rect.Top();
-                maBtn2Rect.Left()   = aSize.Width()-aSize.Height();
-                maBtn1Rect.SetSize( aBtnSize );
-                maBtn2Rect.SetSize( aBtnSize );
+                if (aBtn1Region.IsEmpty() && aBtn2Region.IsEmpty())
+                {
+                    Size aBtnSize( aSize.Height(), aSize.Height() );
+                    maBtn2Rect.Top() = maBtn1Rect.Top();
+                    maBtn2Rect.Left() = aSize.Width()-aSize.Height();
+                    maBtn1Rect.SetSize( aBtnSize );
+                    maBtn2Rect.SetSize( aBtnSize );
+                }
+                else
+                {
+                    maBtn1Rect.SetEmpty();
+                    maBtn2Rect.SetEmpty();
+                }
             }
 
             if ( GetNativeControlRegion( CTRL_SCROLLBAR, PART_TRACK_HORZ_AREA,
                      aControlRegion, 0, ImplControlValue(), rtl::OUString(), aBoundingRegion, aTrackRegion ) )
+            {
                 maTrackRect = aTrackRegion;
+            }
             else
-                maTrackRect = Rectangle( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() );
+            {
+                if ( ! maBtn1Rect.IsEmpty())
+                    maTrackRect = Rectangle( maBtn1Rect.TopRight(), maBtn2Rect.BottomLeft() );
+                else
+                    maTrackRect = aControlRegion;
+            }
 
             // Check if available space is big enough for thumb ( min thumb size = ScrBar width/height )
             mnThumbPixRange = maTrackRect.Right() - maTrackRect.Left();
@@ -395,18 +410,31 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
             }
             else
             {
-                const Size aBtnSize( aSize.Width(), aSize.Width() );
-                maBtn2Rect.Left()   = maBtn1Rect.Left();
-                maBtn2Rect.Top()    = aSize.Height()-aSize.Width();
-                maBtn1Rect.SetSize( aBtnSize );
-                maBtn2Rect.SetSize( aBtnSize );
+                if (aBtn1Region.IsEmpty() && aBtn2Region.IsEmpty())
+                {
+                    const Size aBtnSize( aSize.Width(), aSize.Width() );
+                    maBtn2Rect.Left()   = maBtn1Rect.Left();
+                    maBtn2Rect.Top()    = aSize.Height()-aSize.Width();
+                    maBtn1Rect.SetSize( aBtnSize );
+                    maBtn2Rect.SetSize( aBtnSize );
+                }
+                else
+                {
+                    maBtn1Rect.SetEmpty();
+                    maBtn2Rect.SetEmpty();
+                }
             }
 
             if ( GetNativeControlRegion( CTRL_SCROLLBAR, PART_TRACK_VERT_AREA,
                      aControlRegion, 0, ImplControlValue(), rtl::OUString(), aBoundingRegion, aTrackRegion ) )
                 maTrackRect = aTrackRegion;
             else
-                maTrackRect = Rectangle( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() );
+            {
+                if ( ! maBtn1Rect.IsEmpty())
+                    maTrackRect = Rectangle( maBtn1Rect.BottomLeft()+Point(0,1), maBtn2Rect.TopRight() );
+                else
+                    maTrackRect = aControlRegion;
+            }
 
             // Check if available space is big enough for thumb
             mnThumbPixRange = maTrackRect.Bottom() - maTrackRect.Top();
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index bf5065b..47b8bcd 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -982,7 +982,10 @@ sal_Bool GtkSalGraphics::getNativeControlRegion(  ControlType nType,
         rNativeBoundingRegion = NWGetScrollButtonRect( m_nScreen, nPart, rControlRegion );
         rNativeContentRegion = rNativeBoundingRegion;
 
-        returnVal = sal_True;
+        if (rNativeBoundingRegion.GetWidth()>0 && rNativeBoundingRegion.GetHeight()>0)
+            returnVal = sal_True;
+        else
+            returnVal = sal_False;
     }
     if( (nType == CTRL_MENUBAR) && (nPart == PART_ENTIRE_CONTROL) )
     {


More information about the Libreoffice-commits mailing list