[Libreoffice-commits] .: Branch 'feature/calc-dp-unlimited-fields' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Dec 15 14:19:29 PST 2010


 sc/source/ui/dbgui/fieldwnd.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 926dfc3a1a09b53aa53711ac4f3bf176d67ab8be
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Dec 15 17:18:17 2010 -0500

    Show the scroll bars only when necessary, otherwise hide them.

diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 2d0b812..e0bdf66 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -721,7 +721,7 @@ ScDPHorFieldControl::ScDPHorFieldControl(
 {
     maScroll.SetScrollHdl( LINK(this, ScDPHorFieldControl, ScrollHdl) );
     maScroll.SetEndScrollHdl( LINK(this, ScDPHorFieldControl, EndScrollHdl) );
-    maScroll.Show();
+    maScroll.Hide();
 
     AppendPaintable(&maScroll);
 }
@@ -931,7 +931,11 @@ void ScDPHorFieldControl::ResetScrollBar()
         static_cast<double>(GetFieldCount()) / static_cast<double>(mnFieldBtnRowCount));
 
     if (nOldMax != nNewMax)
+    {
         maScroll.SetRangeMax(nNewMax);
+        bool bShow = mnFieldBtnColCount*mnFieldBtnRowCount < GetFieldCount();
+        maScroll.Show(bShow);
+    }
 }
 
 bool ScDPHorFieldControl::GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize)
@@ -1012,7 +1016,7 @@ ScDPRowFieldControl::ScDPRowFieldControl(
 {
     maScroll.SetScrollHdl( LINK(this, ScDPRowFieldControl, ScrollHdl) );
     maScroll.SetEndScrollHdl( LINK(this, ScDPRowFieldControl, EndScrollHdl) );
-    maScroll.Show();
+    maScroll.Show(false);
 
     AppendPaintable(&maScroll);
 }
@@ -1173,7 +1177,10 @@ void ScDPRowFieldControl::ResetScrollBar()
     long nNewMax = std::max<long>(mnColumnBtnCount, GetFieldCount());
 
     if (nOldMax != nNewMax)
+    {
         maScroll.SetRangeMax(nNewMax);
+        maScroll.Show(GetFieldCount() > mnColumnBtnCount);
+    }
 }
 
 bool ScDPRowFieldControl::GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize)


More information about the Libreoffice-commits mailing list