From 6aedcba229bcead97fdb54e90d12dac1f9e94eb8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 8 Aug 2022 11:33:32 +0100 Subject: use separate width and height for databrowser vert/horz scroll sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- svtools/source/brwbox/brwbox1.cxx | 3 ++- svtools/source/brwbox/brwbox2.cxx | 36 ++++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 15 deletions(-) (limited to 'svtools/source/brwbox') 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::Create(this, true) ) // see NavigationBar ctor, here we just want to know its height ,aStatusBarHeight(VclPtr::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(nSBSize * static_cast(GetZoom())); + { + nSBHeight = static_cast(nSBHeight * static_cast(GetZoom())); + nSBWidth = static_cast(nSBWidth * static_cast(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(m_nCornerSize * static_cast(GetZoom())); + { + m_nCornerHeight = static_cast(m_nCornerHeight * static_cast(GetZoom())); + m_nCornerWidth = static_cast(m_nCornerWidth * static_cast(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(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 ) ) { -- cgit v1.2.3