[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - include/svtools svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Feb 5 09:33:47 UTC 2019


 include/svtools/brwbox.hxx        |    6 +++++-
 svtools/source/brwbox/brwbox1.cxx |    8 +++++---
 svtools/source/brwbox/brwbox2.cxx |   19 ++++++++++++++-----
 3 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 792cb451d1d9b2dd6a55744f6fcc36d31c6762de
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 30 16:32:01 2019 +0000
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 5 10:33:25 2019 +0100

    tdf#115941 use max of scrollbar and statusbar height for record locater
    
    Change-Id: I639fd1c593e7cc440de5d2038562e64eab1a5af6
    Reviewed-on: https://gerrit.libreoffice.org/67167
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index ba09a67050b0..5ccf848e13ce 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -21,6 +21,7 @@
 
 #include <svtools/svtdllapi.h>
 #include <vcl/scrbar.hxx>
+#include <vcl/status.hxx>
 #include <vcl/ctrl.hxx>
 #include <vcl/vclptr.hxx>
 #include <tools/multisel.hxx>
@@ -201,6 +202,7 @@ private:
     VclPtr<BrowserDataWin> pDataWin;       // window to display data rows
     VclPtr<ScrollBar>      pVScroll;       // vertical scrollbar
     VclPtr<ScrollBar>      aHScroll;       // horizontal scrollbar
+    VclPtr<StatusBar>      aStatusBar;     // statusbar, just to measure its height
 
     long            nDataRowHeight; // height of a single data-row
     sal_uInt16      nTitleLines;    // number of lines in title row
@@ -296,7 +298,9 @@ private:
     DECL_DLLPRIVATE_LINK(    EndScrollHdl, ScrollBar*, void );
     DECL_DLLPRIVATE_LINK(    StartDragHdl, HeaderBar*, void );
 
-    SVT_DLLPRIVATE long            GetFrozenWidth() const;
+    SVT_DLLPRIVATE long GetFrozenWidth() const;
+
+    SVT_DLLPRIVATE long GetBarHeight() const;
 
     bool            GoToRow(long nRow, bool bRowColMove, bool bDoNotModifySelection = false );
 
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 8453aecd2fae..4df7a0797594 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -112,6 +112,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode )
     ,DragSourceHelper( this )
     ,DropTargetHelper( this )
     ,aHScroll( VclPtr<ScrollBar>::Create(this, WinBits( WB_HSCROLL )) )
+    ,aStatusBar( VclPtr<StatusBar>::Create(this) )
 {
     ConstructImpl( nMode );
 }
@@ -138,6 +139,7 @@ void BrowseBox::dispose()
     pDataWin.disposeAndClear();
     pVScroll.disposeAndClear();
     aHScroll.disposeAndClear();
+    aStatusBar.disposeAndClear();
 
     // free columns-space
     mvCols.clear();
@@ -2085,11 +2087,11 @@ bool BrowseBox::ReserveControlArea(sal_uInt16 nWidth)
 
 tools::Rectangle BrowseBox::GetControlArea() const
 {
-
+    auto nHeight = aHScroll->GetSizePixel().Height();
     return tools::Rectangle(
-        Point( 0, GetOutputSizePixel().Height() - aHScroll->GetSizePixel().Height() ),
+        Point( 0, GetOutputSizePixel().Height() - nHeight ),
         Size( GetOutputSizePixel().Width() - aHScroll->GetSizePixel().Width(),
-             aHScroll->GetSizePixel().Height() ) );
+             nHeight ) );
 }
 
 void BrowseBox::SetMode( BrowserMode nMode )
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 2674b5488694..039f2267ba24 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -475,9 +475,7 @@ void BrowseBox::Resize()
     pDataWin->bResizeOnPaint = false;
 
     // calc the size of the scrollbars
-    // (we can't ask the scrollbars for their widths cause if we're zoomed they still have to be
-    // resized - which is done in UpdateScrollbars)
-    sal_uLong nSBSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+    sal_uLong nSBSize = GetBarHeight();
     if (IsZoom())
         nSBSize = static_cast<sal_uLong>(nSBSize * static_cast<double>(GetZoom()));
 
@@ -1032,6 +1030,17 @@ void BrowseBox::PaintData( vcl::Window const & rWin, vcl::RenderContext& rRender
     ImplPaintData(rRenderContext, rRect, false, true);
 }
 
+long BrowseBox::GetBarHeight() const
+{
+    // tdf#115941 because some platforms have things like overlay scrollbars, take a max
+    // of a statusbar height and a scrollbar height as the control area height
+
+    // (we can't ask the scrollbars for their size cause if we're zoomed they still have to be
+    // resized - which is done in UpdateScrollbars)
+
+    return std::max(aStatusBar->GetSizePixel().Height(), GetSettings().GetStyleSettings().GetScrollBarSize());
+}
+
 void BrowseBox::UpdateScrollbars()
 {
 
@@ -1047,7 +1056,7 @@ void BrowseBox::UpdateScrollbars()
     pDataWin->bInUpdateScrollbars = true;
 
     // the size of the corner window (and the width of the VSB/height of the HSB)
-    sal_uLong nCornerSize = GetSettings().GetStyleSettings().GetScrollBarSize();
+    sal_uLong nCornerSize = GetBarHeight();
     if (IsZoom())
         nCornerSize = static_cast<sal_uLong>(nCornerSize * static_cast<double>(GetZoom()));
 
@@ -1962,7 +1971,7 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen)
     long nY = aRowBar.Top() - aRect.Top();
     Size aSize(aRect.GetSize());
 
-    return tools::Rectangle(aRowBar.TopRight(), Size(aSize.Width() - nX, aSize.Height() - nY - aHScroll->GetSizePixel().Height()) );
+    return tools::Rectangle(aRowBar.TopRight(), Size(aSize.Width() - nX, aSize.Height() - nY - GetBarHeight()) );
 }
 
 tools::Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen )


More information about the Libreoffice-commits mailing list