[PATCH] Change in core[libreoffice-4-0]: Resolves: fdo#58301 make sure ScrollBar OptimalSize is up to...

Caolán McNamara (via_Code_Review) gerrit at gerrit.libreoffice.org
Thu Jan 10 07:52:14 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1630

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/30/1630/1

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
---
M vcl/inc/vcl/scrbar.hxx
M vcl/source/control/scrbar.cxx
2 files changed, 11 insertions(+), 3 deletions(-)



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 @@
     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 @@
     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 @@
 
         mbCalcSize = sal_False;
 
-        Size aNewSize = GetOptimalSize(WINDOWSIZE_PREFERRED);
+        Size aNewSize = getCurrentCalcSize();
         if (aOldSize != aNewSize)
         {
             queue_resize();
@@ -1509,6 +1509,13 @@
 
 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);

-- 
To view, visit https://gerrit.libreoffice.org/1630
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I12e95c3594ffbb508c7f79bd512e07aaf44a6eab
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Caolán McNamara <caolanm at redhat.com>



More information about the LibreOffice mailing list