[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 10 21:01:47 UTC 2021
sc/source/ui/cctrl/tbzoomsliderctrl.cxx | 45 ++++++++++++++++++++------------
sc/source/ui/inc/tbzoomsliderctrl.hxx | 2 -
2 files changed, 30 insertions(+), 17 deletions(-)
New commits:
commit 8619e743564a241eb951866616aec82e1ab3965f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jun 10 14:04:17 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jun 10 23:01:14 2021 +0200
tdf#136766 Zoom slider in calc print preview has white background
I cannot figure out any way to make transparent stuff on the toolbar
behave under all rendering backends, so just revert this
this reverts
commit 00cffc20e40b2412c7e9867eed24c9834504e24f
Date: Mon Sep 7 13:28:33 2020 +0200
tdf#135181 Calc print preview zoom slider print preview not
transparent (gen)
commit 444c7c736be7545344298a9cbb3a69886edc5ecb
Date: Mon May 18 18:23:13 2020 +0200
tdf#125538 fix background of zoom control
Change-Id: I7c351796b2c0778c1520fc8177d05567b2ae8a48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116982
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
(cherry picked from commit d693223b84b518701d308678801ccc50877490dc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116904
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index 12d12c19beda..b7a6781dcd07 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -97,9 +97,8 @@ struct ScZoomSlider::ScZoomSliderWnd_Impl
Image maIncreaseButton;
Image maDecreaseButton;
bool mbOmitPaint;
- VclPtr<vcl::Window> mxParentWindow;
- explicit ScZoomSliderWnd_Impl( sal_uInt16 nCurrentZoom, vcl::Window* parentWindow ) :
+ explicit ScZoomSliderWnd_Impl( sal_uInt16 nCurrentZoom ) :
mnCurrentZoom( nCurrentZoom ),
mnMinZoom( 10 ),
mnMaxZoom( 400 ),
@@ -108,8 +107,7 @@ struct ScZoomSlider::ScZoomSliderWnd_Impl
maSliderButton(),
maIncreaseButton(),
maDecreaseButton(),
- mbOmitPaint( false ),
- mxParentWindow(parentWindow)
+ mbOmitPaint( false )
{
}
};
@@ -209,7 +207,7 @@ ScZoomSliderWnd::ScZoomSliderWnd( vcl::Window* pParent,
const css::uno::Reference< css::frame::XDispatchProvider >& rDispatchProvider,
sal_uInt16 nCurrentZoom ):
InterimItemWindow(pParent, "modules/scalc/ui/zoombox.ui", "ZoomBox"),
- mxWidget(new ScZoomSlider(rDispatchProvider, nCurrentZoom, pParent)),
+ mxWidget(new ScZoomSlider(rDispatchProvider, nCurrentZoom)),
mxWeld(new weld::CustomWeld(*m_xBuilder, "zoom", *mxWidget))
{
Size aLogicalSize( 115, 40 );
@@ -233,8 +231,8 @@ void ScZoomSliderWnd::dispose()
}
ScZoomSlider::ScZoomSlider(const css::uno::Reference< css::frame::XDispatchProvider>& rDispatchProvider,
- sal_uInt16 nCurrentZoom, vcl::Window* parentWindow)
- : mpImpl(new ScZoomSliderWnd_Impl(nCurrentZoom, parentWindow))
+ sal_uInt16 nCurrentZoom)
+ : mpImpl(new ScZoomSliderWnd_Impl(nCurrentZoom))
, m_xDispatchProvider(rDispatchProvider)
{
mpImpl->maSliderButton = Image(StockImage::Yes, RID_SVXBMP_SLIDERBUTTON);
@@ -277,8 +275,9 @@ bool ScZoomSlider::MouseButtonDown( const MouseEvent& rMEvt )
if( nOldZoom == mpImpl->mnCurrentZoom )
return true;
- // need to invalidate parent since we rely on the toolbox drawing it's fancy gradient background
- mpImpl->mxParentWindow->Invalidate();
+ tools::Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
+
+ Invalidate(aRect);
mpImpl->mbOmitPaint = true;
SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
@@ -312,8 +311,8 @@ bool ScZoomSlider::MouseMove( const MouseEvent& rMEvt )
{
mpImpl->mnCurrentZoom = Offset2Zoom( aPoint.X() );
- // need to invalidate parent since we rely on the toolbox drawing it's fancy gradient background
- mpImpl->mxParentWindow->Invalidate();
+ tools::Rectangle aRect(Point(0, 0), aSliderWindowSize);
+ Invalidate(aRect);
mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
@@ -379,9 +378,11 @@ void ScZoomSlider::UpdateFromItem(const SvxZoomSliderItem* pZoomSliderItem)
}
}
+ Size aSliderWindowSize = GetOutputSizePixel();
+ tools::Rectangle aRect(Point(0, 0), aSliderWindowSize);
+
if ( !mpImpl->mbOmitPaint )
- // need to invalidate parent since we rely on the toolbox drawing it's fancy gradient background
- mpImpl->mxParentWindow->Invalidate();
+ Invalidate(aRect);
}
void ScZoomSlider::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
@@ -399,9 +400,6 @@ void ScZoomSlider::DoPaint(vcl::RenderContext& rRenderContext)
ScopedVclPtrInstance< VirtualDevice > pVDev(rRenderContext, DeviceFormat::DEFAULT, DeviceFormat::BITMASK);
pVDev->SetOutputSizePixel(aSliderWindowSize);
- pVDev->SetFillColor( COL_TRANSPARENT );
- pVDev->SetLineColor( COL_TRANSPARENT );
- pVDev->DrawRect( aRect );
tools::Rectangle aSlider = aRect;
@@ -422,6 +420,21 @@ void ScZoomSlider::DoPaint(vcl::RenderContext& rRenderContext)
tools::Rectangle aRight(aSlider);
aRight.SetLeft( aRight.Right() );
+ // draw VirtualDevice's background color
+ Color aStartColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor();
+ Color aEndColor = rRenderContext.GetSettings().GetStyleSettings().GetFaceColor();
+
+ if (aEndColor.IsDark())
+ aStartColor = aEndColor;
+
+ Gradient aGradient;
+ aGradient.SetAngle( Degree10(0) );
+ aGradient.SetStyle(GradientStyle::Linear);
+
+ aGradient.SetStartColor(aStartColor);
+ aGradient.SetEndColor(aEndColor);
+ pVDev->DrawGradient(aRect, aGradient);
+
// draw slider
pVDev->SetLineColor(COL_WHITE);
pVDev->DrawRect(aSecondLine);
diff --git a/sc/source/ui/inc/tbzoomsliderctrl.hxx b/sc/source/ui/inc/tbzoomsliderctrl.hxx
index 944f9c86335e..5f193314bb2b 100644
--- a/sc/source/ui/inc/tbzoomsliderctrl.hxx
+++ b/sc/source/ui/inc/tbzoomsliderctrl.hxx
@@ -53,7 +53,7 @@ private:
void DoPaint(vcl::RenderContext& rRenderContext);
public:
ScZoomSlider(const css::uno::Reference<css::frame::XDispatchProvider>& rDispatchProvider,
- sal_uInt16 nCurrentZoom, vcl::Window*);
+ sal_uInt16 nCurrentZoom);
void UpdateFromItem(const SvxZoomSliderItem* pZoomSliderItem);
More information about the Libreoffice-commits
mailing list