Author: jsc
Date: Fri Jun 20 12:05:03 2014
New Revision: 1604149

URL: http://svn.apache.org/r1604149
Log:
#121627# merge fix from aoo410 branch that fixes the geometry calculations for 
scroll bars

Modified:
    openoffice/trunk/main/vcl/source/control/scrbar.cxx
    openoffice/trunk/main/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx

Modified: openoffice/trunk/main/vcl/source/control/scrbar.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/control/scrbar.cxx?rev=1604149&r1=1604148&r2=1604149&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/control/scrbar.cxx (original)
+++ openoffice/trunk/main/vcl/source/control/scrbar.cxx Fri Jun 20 12:05:03 2014
@@ -354,18 +354,33 @@ void ScrollBar::ImplCalc( sal_Bool bUpda
             }
             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 bUpda
             }
             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();

Modified: openoffice/trunk/main/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx?rev=1604149&r1=1604148&r2=1604149&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx (original)
+++ openoffice/trunk/main/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx Fri Jun 20 
12:05:03 2014
@@ -981,8 +981,11 @@ sal_Bool GtkSalGraphics::getNativeContro
     {
         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) )
     {


Reply via email to