include/svtools/brwbox.hxx | 3 ++- svtools/source/brwbox/brwbox1.cxx | 3 ++- svtools/source/brwbox/brwbox2.cxx | 36 ++++++++++++++++++++++-------------- 3 files changed, 26 insertions(+), 16 deletions(-)
New commits: commit 6aedcba229bcead97fdb54e90d12dac1f9e94eb8 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Aug 8 11:33:32 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Aug 8 16:53:15 2022 +0200 use separate width and height for databrowser vert/horz scroll sizes the scrollbar in the statusbar can be thicker than the vertical one which looks weird when both set to the thick size Change-Id: I76496e47203a7cde72082f8e6b83f5af3e8c3759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137952 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 47729d3b261c..bba7585a0ba1 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -275,7 +275,8 @@ private: VclPtr<MeasureStatusBar> aStatusBarHeight; // statusbar, just to measure its height tools::Long m_nDataRowHeight; // height of a single data-row - tools::Long m_nCornerSize; // size of scrollbox corner + tools::Long m_nCornerHeight; // height of scrollbox corner + tools::Long m_nCornerWidth; // width of scrollbox corner tools::Long m_nActualCornerWidth; // size of scrollbox corner sal_uInt16 nTitleLines; // number of lines in title row sal_uLong nControlAreaWidth; // width of fixed area beneath hscroll diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 64c7011d258b..72cf3aba9ae2 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -164,7 +164,8 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode ) ,aHScroll( VclPtr<ScrollAdaptor>::Create(this, true) ) // see NavigationBar ctor, here we just want to know its height ,aStatusBarHeight(VclPtr<MeasureStatusBar>::Create(this)) - ,m_nCornerSize(0) + ,m_nCornerHeight(0) + ,m_nCornerWidth(0) ,m_nActualCornerWidth(0) { ConstructImpl( nMode ); diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index b691bd095a88..b9528941eefb 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -478,9 +478,13 @@ void BrowseBox::Resize() pDataWin->bResizeOnPaint = false; // calc the size of the scrollbars - sal_uLong nSBSize = GetBarHeight(); + sal_uLong nSBHeight = GetBarHeight(); + sal_uLong nSBWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); if (IsZoom()) - nSBSize = static_cast<sal_uLong>(nSBSize * static_cast<double>(GetZoom())); + { + nSBHeight = static_cast<sal_uLong>(nSBHeight * static_cast<double>(GetZoom())); + nSBWidth = static_cast<sal_uLong>(nSBWidth * static_cast<double>(GetZoom())); + } DoHideCursor(); sal_uInt16 nOldVisibleRows = 0; @@ -498,11 +502,11 @@ void BrowseBox::Resize() // calculate the size of the data window tools::Long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight(); if ( aHScroll->IsVisible() || ( nControlAreaWidth != USHRT_MAX ) ) - nDataHeight -= nSBSize; + nDataHeight -= nSBHeight; tools::Long nDataWidth = GetOutputSizePixel().Width(); if ( pVScroll->IsVisible() ) - nDataWidth -= nSBSize; + nDataWidth -= nSBWidth; // adjust position and size of data window pDataWin->SetPosSizePixel( @@ -637,7 +641,7 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle rRenderContext.SetFillColor(aColFace); rRenderContext.SetLineColor(aColFace); rRenderContext.DrawRect(tools::Rectangle(Point(GetOutputSizePixel().Width() - m_nActualCornerWidth, aHScroll->GetPosPixel().Y()), - Size(m_nActualCornerWidth, m_nCornerSize))); + Size(m_nActualCornerWidth, m_nCornerHeight))); rRenderContext.Pop(); } } @@ -1059,9 +1063,13 @@ void BrowseBox::UpdateScrollbars() pDataWin->bInUpdateScrollbars = true; // the size of the corner window (and the width of the VSB/height of the HSB) - m_nCornerSize = GetBarHeight(); + m_nCornerHeight = GetBarHeight(); + m_nCornerWidth = GetSettings().GetStyleSettings().GetScrollBarSize(); if (IsZoom()) - m_nCornerSize = static_cast<sal_uLong>(m_nCornerSize * static_cast<double>(GetZoom())); + { + m_nCornerHeight = static_cast<sal_uLong>(m_nCornerHeight * static_cast<double>(GetZoom())); + m_nCornerWidth = static_cast<sal_uLong>(m_nCornerWidth * static_cast<double>(GetZoom())); + } bool bNeedsVScroll = false; sal_Int32 nMaxRows = 0; @@ -1087,7 +1095,7 @@ void BrowseBox::UpdateScrollbars() else if ( !pVScroll->IsVisible() ) { Size aNewSize( aDataWinSize ); - aNewSize.setWidth( GetOutputSizePixel().Width() - m_nCornerSize ); + aNewSize.setWidth( GetOutputSizePixel().Width() - m_nCornerWidth ); aDataWinSize = aNewSize; } @@ -1106,12 +1114,12 @@ void BrowseBox::UpdateScrollbars() } aDataWinSize.setHeight( GetOutputSizePixel().Height() - GetTitleHeight() ); if ( nControlAreaWidth != USHRT_MAX ) - aDataWinSize.AdjustHeight( -sal_Int32(m_nCornerSize) ); + aDataWinSize.AdjustHeight( -sal_Int32(m_nCornerHeight) ); } else if ( !aHScroll->IsVisible() ) { Size aNewSize( aDataWinSize ); - aNewSize.setHeight( GetOutputSizePixel().Height() - GetTitleHeight() - m_nCornerSize ); + aNewSize.setHeight( GetOutputSizePixel().Height() - GetTitleHeight() - m_nCornerHeight ); aDataWinSize = aNewSize; } @@ -1121,8 +1129,8 @@ void BrowseBox::UpdateScrollbars() : nControlAreaWidth; aHScroll->SetPosSizePixel( - Point( nHScrX, GetOutputSizePixel().Height() - m_nCornerSize ), - Size( aDataWinSize.Width() - nHScrX, m_nCornerSize ) ); + Point( nHScrX, GetOutputSizePixel().Height() - m_nCornerHeight ), + Size( aDataWinSize.Width() - nHScrX, m_nCornerHeight ) ); // total scrollable columns short nScrollCols = short(mvCols.size()) - static_cast<short>(nFrozenCols); @@ -1163,7 +1171,7 @@ void BrowseBox::UpdateScrollbars() pVScroll->SetRange( Range( 0, nRowCount ) ); pVScroll->SetPosSizePixel( Point( aDataWinSize.Width(), GetTitleHeight() ), - Size( m_nCornerSize, aDataWinSize.Height()) ); + Size( m_nCornerWidth, aDataWinSize.Height()) ); tools::Long nLclDataRowHeight = GetDataRowHeight(); if ( nLclDataRowHeight > 0 && nRowCount < tools::Long( aDataWinSize.Height() / nLclDataRowHeight ) ) ScrollRows( -nTopRow ); @@ -1180,7 +1188,7 @@ void BrowseBox::UpdateScrollbars() if (aHScroll->IsVisible() && pVScroll && pVScroll->IsVisible() ) { // if we have both scrollbars, the corner window fills the point of intersection of these two - m_nActualCornerWidth = m_nCornerSize; + m_nActualCornerWidth = m_nCornerWidth; } else if ( !aHScroll->IsVisible() && ( nControlAreaWidth != USHRT_MAX ) ) {