include/svtools/brwbox.hxx | 4 +-- svtools/source/brwbox/brwbox1.cxx | 4 +-- svtools/source/brwbox/brwbox2.cxx | 46 +++++++++++++++++++------------------- svtools/source/brwbox/datwin.cxx | 4 --- svtools/source/brwbox/datwin.hxx | 1 5 files changed, 27 insertions(+), 32 deletions(-)
New commits: commit bb24d34db707f574feb63e1ac657a159e21924c9 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Aug 8 11:21:14 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Aug 8 16:52:21 2022 +0200 overpaint scrollbar junction with the face color Change-Id: Ib2dba2d5e47a8c39f79c3ab5a8e79e8185599da6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137951 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index f16a19f36f8b..47729d3b261c 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -137,7 +137,6 @@ public: }; class BrowseBox; -class ScrollBarBox; class BrowserMouseEvent; class BrowserDataWin final @@ -147,7 +146,6 @@ class BrowserDataWin final { public: VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW - VclPtr<ScrollBarBox> pCornerWin; // Window in the corner btw the ScrollBars bool bInDtor; AutoTimer aMouseTimer; // recalls MouseMove on dragging out MouseEvent aRepeatEvt; // a MouseEvent to repeat @@ -277,6 +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_nActualCornerWidth; // size of scrollbox corner sal_uInt16 nTitleLines; // number of lines in title row sal_uLong nControlAreaWidth; // width of fixed area beneath hscroll bool bColumnCursor; // single columns and fields selectable diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index c9f0dd681b94..64c7011d258b 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -27,7 +27,6 @@ #include <tools/fract.hxx> #include <sal/log.hxx> #include <vcl/InterimItemWindow.hxx> -#include <vcl/scrbar.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -165,6 +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_nActualCornerWidth(0) { ConstructImpl( nMode ); } @@ -193,7 +194,6 @@ void BrowseBox::dispose() Hide(); pDataWin->pHeaderBar.disposeAndClear(); - pDataWin->pCornerWin.disposeAndClear(); pDataWin.disposeAndClear(); pVScroll.disposeAndClear(); aHScroll.disposeAndClear(); diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 7bcdea5ca770..b691bd095a88 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -543,7 +543,6 @@ void BrowseBox::Resize() void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { - // initializations if (!bBootstrapped && IsReallyVisible()) BrowseBox::StateChanged(StateChangedType::InitShow); @@ -629,6 +628,18 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle Point(rRect.Right(), GetTitleHeight() - 2 ))); rRenderContext.Pop(); } + + if (m_nActualCornerWidth) + { + const StyleSettings &rSettings = rRenderContext.GetSettings().GetStyleSettings(); + Color aColFace(rSettings.GetFaceColor()); + rRenderContext.Push(vcl::PushFlags::FILLCOLOR | vcl::PushFlags::LINECOLOR); + rRenderContext.SetFillColor(aColFace); + rRenderContext.SetLineColor(aColFace); + rRenderContext.DrawRect(tools::Rectangle(Point(GetOutputSizePixel().Width() - m_nActualCornerWidth, aHScroll->GetPosPixel().Y()), + Size(m_nActualCornerWidth, m_nCornerSize))); + rRenderContext.Pop(); + } } void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) @@ -1048,9 +1059,9 @@ 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 = GetBarHeight(); + m_nCornerSize = GetBarHeight(); if (IsZoom()) - nCornerSize = static_cast<sal_uLong>(nCornerSize * static_cast<double>(GetZoom())); + m_nCornerSize = static_cast<sal_uLong>(m_nCornerSize * static_cast<double>(GetZoom())); bool bNeedsVScroll = false; sal_Int32 nMaxRows = 0; @@ -1076,7 +1087,7 @@ void BrowseBox::UpdateScrollbars() else if ( !pVScroll->IsVisible() ) { Size aNewSize( aDataWinSize ); - aNewSize.setWidth( GetOutputSizePixel().Width() - nCornerSize ); + aNewSize.setWidth( GetOutputSizePixel().Width() - m_nCornerSize ); aDataWinSize = aNewSize; } @@ -1095,12 +1106,12 @@ void BrowseBox::UpdateScrollbars() } aDataWinSize.setHeight( GetOutputSizePixel().Height() - GetTitleHeight() ); if ( nControlAreaWidth != USHRT_MAX ) - aDataWinSize.AdjustHeight( -sal_Int32(nCornerSize) ); + aDataWinSize.AdjustHeight( -sal_Int32(m_nCornerSize) ); } else if ( !aHScroll->IsVisible() ) { Size aNewSize( aDataWinSize ); - aNewSize.setHeight( GetOutputSizePixel().Height() - GetTitleHeight() - nCornerSize ); + aNewSize.setHeight( GetOutputSizePixel().Height() - GetTitleHeight() - m_nCornerSize ); aDataWinSize = aNewSize; } @@ -1110,8 +1121,8 @@ void BrowseBox::UpdateScrollbars() : nControlAreaWidth; aHScroll->SetPosSizePixel( - Point( nHScrX, GetOutputSizePixel().Height() - nCornerSize ), - Size( aDataWinSize.Width() - nHScrX, nCornerSize ) ); + Point( nHScrX, GetOutputSizePixel().Height() - m_nCornerSize ), + Size( aDataWinSize.Width() - nHScrX, m_nCornerSize ) ); // total scrollable columns short nScrollCols = short(mvCols.size()) - static_cast<short>(nFrozenCols); @@ -1152,7 +1163,7 @@ void BrowseBox::UpdateScrollbars() pVScroll->SetRange( Range( 0, nRowCount ) ); pVScroll->SetPosSizePixel( Point( aDataWinSize.Width(), GetTitleHeight() ), - Size( nCornerSize, aDataWinSize.Height()) ); + Size( m_nCornerSize, aDataWinSize.Height()) ); tools::Long nLclDataRowHeight = GetDataRowHeight(); if ( nLclDataRowHeight > 0 && nRowCount < tools::Long( aDataWinSize.Height() / nLclDataRowHeight ) ) ScrollRows( -nTopRow ); @@ -1165,29 +1176,18 @@ void BrowseBox::UpdateScrollbars() // needs corner-window? // (do that AFTER positioning BOTH scrollbars) - sal_uLong nActualCorderWidth = 0; + m_nActualCornerWidth = 0; if (aHScroll->IsVisible() && pVScroll && pVScroll->IsVisible() ) { // if we have both scrollbars, the corner window fills the point of intersection of these two - nActualCorderWidth = nCornerSize; + m_nActualCornerWidth = m_nCornerSize; } else if ( !aHScroll->IsVisible() && ( nControlAreaWidth != USHRT_MAX ) ) { // if we have no horizontal scrollbar, but a control area, we need the corner window to // fill the space between the control are and the right border - nActualCorderWidth = GetOutputSizePixel().Width() - nControlAreaWidth; + m_nActualCornerWidth = GetOutputSizePixel().Width() - nControlAreaWidth; } - if ( nActualCorderWidth ) - { - if ( !pDataWin->pCornerWin ) - pDataWin->pCornerWin = VclPtr<ScrollBarBox>::Create( this, 0 ); - pDataWin->pCornerWin->SetPosSizePixel( - Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ), - Size( nActualCorderWidth, nCornerSize ) ); - pDataWin->pCornerWin->Show(); - } - else - pDataWin->pCornerWin.disposeAndClear(); // scroll headerbar, if necessary if ( pDataWin->pHeaderBar ) diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index 2eea4a5e4255..e3fd46bf1ecb 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -177,7 +177,6 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent ) ,DragSourceHelper( this ) ,DropTargetHelper( this ) ,pHeaderBar( nullptr ) - ,pCornerWin( nullptr ) ,bInDtor( false ) ,aMouseTimer("BrowserDataWin aMouseTimer") ,bInPaint( false ) @@ -202,7 +201,6 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent ) aMouseTimer.SetTimeout( 100 ); } - BrowserDataWin::~BrowserDataWin() { disposeOnce(); @@ -214,13 +212,11 @@ void BrowserDataWin::dispose() aInvalidRegion.clear(); pHeaderBar.clear(); - pCornerWin.clear(); DragSourceHelper::dispose(); DropTargetHelper::dispose(); Control::dispose(); } - void BrowserDataWin::LeaveUpdateLock() { if ( !--nUpdateLock ) diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx index acabcc0cf8d6..a345d28fee48 100644 --- a/svtools/source/brwbox/datwin.hxx +++ b/svtools/source/brwbox/datwin.hxx @@ -22,7 +22,6 @@ #include <svtools/brwbox.hxx> #include <tools/long.hxx> #include <utility> -#include <vcl/scrbar.hxx> #include <limits>