[Libreoffice-commits] .: Branch 'libreoffice-4-0' - vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 10 17:01:24 PST 2013


 vcl/inc/vcl/scrbar.hxx        |    3 ++-
 vcl/source/control/scrbar.cxx |   11 +++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit c5c22a10d41ae79b43edbf36962245c824a32e17
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 4 16:16:14 2012 +0000

    Resolves: fdo#58301 make sure ScrollBar OptimalSize is up to date
    
    if the scrollbar sizes haven't been calculated yet then the optimalsize will be
    wrong, so it's necessary to enforce calculating them in that case.
    
    (cherry picked from commit f41a2804dd4a23352b7af2dd28c03df02debfb13)
    
    Change-Id: I12e95c3594ffbb508c7f79bd512e07aaf44a6eab
    Reviewed-on: https://gerrit.libreoffice.org/1630
    Reviewed-by: Kohei Yoshida <kohei.yoshida at gmail.com>
    Tested-by: Kohei Yoshida <kohei.yoshida at gmail.com>

diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx
index 8dbe270..7c62d94 100644
--- a/vcl/inc/vcl/scrbar.hxx
+++ b/vcl/inc/vcl/scrbar.hxx
@@ -83,8 +83,9 @@ private:
     SAL_DLLPRIVATE long         ImplDoAction( sal_Bool bCallEndScroll );
     SAL_DLLPRIVATE void         ImplDoMouseAction( const Point& rPos, sal_Bool bCallAction = sal_True );
     SAL_DLLPRIVATE void         ImplInvert();
-    SAL_DLLPRIVATE sal_Bool         ImplDrawNative( sal_uInt16 nDrawFlags );
+    SAL_DLLPRIVATE sal_Bool     ImplDrawNative( sal_uInt16 nDrawFlags );
     SAL_DLLPRIVATE void         ImplDragThumb( const Point& rMousePos );
+    SAL_DLLPRIVATE Size         getCurrentCalcSize() const;
     DECL_DLLPRIVATE_LINK(       ImplTimerHdl, Timer* );
     DECL_DLLPRIVATE_LINK(       ImplAutoTimerHdl, void* );
 
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 9e90362..b99ff26 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -323,7 +323,7 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
     Rectangle& maTrackRect = mpData->maTrackRect;  // TODO: remove when maTrackRect is no longer in mpData
     if ( mbCalcSize )
     {
-        Size aOldSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+        Size aOldSize = getCurrentCalcSize();
 
         const Rectangle aControlRegion( Point(0,0), aSize );
         Rectangle aBtn1Region, aBtn2Region, aTrackRegion, aBoundingRegion;
@@ -416,7 +416,7 @@ void ScrollBar::ImplCalc( sal_Bool bUpdate )
 
         mbCalcSize = sal_False;
 
-        Size aNewSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+        Size aNewSize = getCurrentCalcSize();
         if (aOldSize != aNewSize)
         {
             queue_resize();
@@ -1509,6 +1509,13 @@ void ScrollBar::SetVisibleSize( long nNewSize )
 
 Size ScrollBar::GetOptimalSize(WindowSizeType) const
 {
+    if (mbCalcSize)
+        const_cast<ScrollBar*>(this)->ImplCalc(sal_False);
+    return getCurrentCalcSize();
+}
+
+Size ScrollBar::getCurrentCalcSize() const
+{
     Rectangle aCtrlRegion;
     aCtrlRegion.Union(maBtn1Rect);
     aCtrlRegion.Union(maBtn2Rect);


More information about the Libreoffice-commits mailing list