diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-08-08 11:33:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-08-08 16:53:15 +0200 |
commit | 6aedcba229bcead97fdb54e90d12dac1f9e94eb8 (patch) | |
tree | 6776d4a4746415598ce32ffc62b3d6f4e344600b /svtools/source/brwbox/brwbox2.cxx | |
parent | bb24d34db707f574feb63e1ac657a159e21924c9 (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'svtools/source/brwbox/brwbox2.cxx')
-rw-r--r-- | svtools/source/brwbox/brwbox2.cxx | 36 |
1 files changed, 22 insertions, 14 deletions
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 ) ) { |