summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-12-04 16:16:14 +0000
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-01-11 01:01:06 +0000
commitc5c22a10d41ae79b43edbf36962245c824a32e17 (patch)
tree78219bb906951a7b6ae4ace875646edcf44dfe9d
parent90fe1b210025c19e885b093bf2f556d5b62f9dd4 (diff)
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@gmail.com> Tested-by: Kohei Yoshida <kohei.yoshida@gmail.com>
-rw-r--r--vcl/inc/vcl/scrbar.hxx3
-rw-r--r--vcl/source/control/scrbar.cxx11
2 files changed, 11 insertions, 3 deletions
diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx
index 8dbe27008bcc..7c62d941d5fe 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 9e90362d7fb9..b99ff260188c 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);